Skip to content

Commit

Permalink
Merge branch 'develop' into 'main'
Browse files Browse the repository at this point in the history
chore: Update list saas market, channel, enterprise ids return data

See merge request locker/api-core!398
  • Loading branch information
phuongntt-cystack committed Mar 18, 2024
2 parents 0ddb395 + 5e59c82 commit 5ef04e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion locker_server/api/sub/resources/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion locker_server/api_orm/repositories/payment_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 5ef04e5

Please sign in to comment.