Skip to content

Commit

Permalink
fix: Adds pagination to Facility linked list API (#1911)
Browse files Browse the repository at this point in the history
* fix(user): adds pagination to linked facilities list API

* fix(user): removed pagination class
  • Loading branch information
aeswibon authored Mar 1, 2024
1 parent 2170b37 commit aba0849
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions care/users/api/viewsets/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ def check_facility_user_exists(self, user, facility):
@action(detail=True, methods=["GET"], permission_classes=[IsAuthenticated])
def get_facilities(self, request, *args, **kwargs):
user = self.get_object()
facilities = Facility.objects.filter(users=user).select_related(
queryset = Facility.objects.filter(users=user).select_related(

Check warning on line 208 in care/users/api/viewsets/users.py

View check run for this annotation

Codecov / codecov/patch

care/users/api/viewsets/users.py#L208

Added line #L208 was not covered by tests
"local_body", "district", "state", "ward"
)
facilities = self.paginate_queryset(queryset)

Check warning on line 211 in care/users/api/viewsets/users.py

View check run for this annotation

Codecov / codecov/patch

care/users/api/viewsets/users.py#L211

Added line #L211 was not covered by tests
facilities = FacilityBasicInfoSerializer(facilities, many=True)
return Response(facilities.data)
return self.get_paginated_response(facilities.data)

Check warning on line 213 in care/users/api/viewsets/users.py

View check run for this annotation

Codecov / codecov/patch

care/users/api/viewsets/users.py#L213

Added line #L213 was not covered by tests

@extend_schema(tags=["users"])
@action(detail=True, methods=["PUT"], permission_classes=[IsAuthenticated])
Expand Down

0 comments on commit aba0849

Please sign in to comment.