feat: user preference url and sort order change (#6505)

* fix: change url

* Change order of user preference keys
This commit is contained in:
Sangeetha
2025-01-30 13:29:39 +05:30
committed by GitHub
parent 58a4ca9f36
commit 8f5ce6b232
3 changed files with 9 additions and 5 deletions

View File

@@ -261,12 +261,12 @@ urlpatterns = [
),
# User Preference
path(
"workspaces/<str:slug>/user-preferences/",
"workspaces/<str:slug>/sidebar-preferences/",
WorkspaceUserPreferenceViewSet.as_view(),
name="workspace-user-preference",
),
path(
"workspaces/<str:slug>/user-preferences/<str:key>/",
"workspaces/<str:slug>/sidebar-preferences/<str:key>/",
WorkspaceUserPreferenceViewSet.as_view(),
name="workspace-user-preference",
),

View File

@@ -27,7 +27,11 @@ class WorkspaceUserPreferenceViewSet(BaseAPIView):
create_preference_keys = []
keys = [key for key, _ in WorkspaceUserPreference.UserPreferenceKeys.choices]
keys = [
key
for key, _ in WorkspaceUserPreference.UserPreferenceKeys.choices
if key not in ["projects"]
]
for preference in keys:
if preference not in get_preference.values_list("key", flat=True):

View File

@@ -392,10 +392,10 @@ class WorkspaceUserPreference(BaseModel):
"""Preference for the workspace for a user"""
class UserPreferenceKeys(models.TextChoices):
PROJECTS = "projects", "Projects"
ANALYTICS = "analytics", "Analytics"
CYCLES = "cycles", "Cycles"
VIEWS = "views", "Views"
ANALYTICS = "analytics", "Analytics"
PROJECTS = "projects", "Projects"
workspace = models.ForeignKey(
"db.Workspace",