diff --git a/locker_server/api/sub/resources/views.py b/locker_server/api/sub/resources/views.py index 44a8fee..6d0883b 100644 --- a/locker_server/api/sub/resources/views.py +++ b/locker_server/api/sub/resources/views.py @@ -53,7 +53,20 @@ def list_enterprise_id(self, request, *args, **kwargs): @action(methods=["get"], detail=False) def list_channel(self, request, *args, **kwargs): - user_channels = ["organic", "ads", "affiliate"] + user_channels = [ + { + "id": 1, + "name": "organic" + }, + { + "id": 2, + "name": "ads" + }, + { + "id": 3, + "name": "affiliate" + } + ] return Response(status=status.HTTP_200_OK, data=user_channels) @action(methods=["get"], detail=False) diff --git a/locker_server/api_orm/repositories/enterprise_repository.py b/locker_server/api_orm/repositories/enterprise_repository.py index a157476..eea73fd 100644 --- a/locker_server/api_orm/repositories/enterprise_repository.py +++ b/locker_server/api_orm/repositories/enterprise_repository.py @@ -50,7 +50,7 @@ def list_enterprises(self, **filters) -> List[Enterprise]: ] def list_enterprise_ids(self) -> List[int]: - return list(set(EnterpriseORM.objects.all().values_list("id", flat=True))) + return list(EnterpriseORM.objects.all().order_by("id").values("id", "name").distinct()) def list_user_enterprises(self, user_id: int, **filter_params) -> List[Enterprise]: status_param = filter_params.get("status") diff --git a/locker_server/api_orm/repositories/payment_repository.py b/locker_server/api_orm/repositories/payment_repository.py index 09b3782..11ab023 100644 --- a/locker_server/api_orm/repositories/payment_repository.py +++ b/locker_server/api_orm/repositories/payment_repository.py @@ -157,7 +157,7 @@ def list_all_invoices(self, **filter_params) -> List[Payment]: return payments def list_saas_market(self) -> List[str]: - return list(set(SaasMarketORM.objects.all().values_list("name", flat=True))) + return list(SaasMarketORM.objects.all().order_by("id").values("id", "name").distinct()) def list_invoices_by_user(self, user_id: int, **filter_params) -> List[Payment]: payments_orm = PaymentORM.objects.filter(user_id=user_id).order_by('-created_time')