Compare commits

...

2 Commits

Author SHA1 Message Date
577e87d8db Merge pull request 'refactor(meetings): change UserAppointmentStatsView from GET to POST' (#38) from feature/meetings into main
Reviewed-on: https://gitea.blackbusinesslabs.com/ATTUNE-HEART-THERAPY/alternative-backend-service/pulls/38
2025-11-26 16:18:25 +00:00
ea99552d95 refactor(meetings): change UserAppointmentStatsView from GET to POST
Modified UserAppointmentStatsView to accept POST requests instead of GET
and retrieve email from request body rather than from authenticated user.
This allows querying appointment statistics for any email address instead
of being limited to the current user's email.

Changes:
- Changed HTTP method from GET to POST
- Added email parameter extraction from request.data
- Updated filter to use provided email instead of request.user.email
2025-11-26 16:03:09 +00:00

View File

@ -176,9 +176,10 @@ class AppointmentStatsView(generics.GenericAPIView):
class UserAppointmentStatsView(generics.GenericAPIView):
permission_classes = [IsAuthenticated]
def get(self, request):
def post(self, request):
email = request.data.get('email')
stats = AppointmentRequest.objects.filter(
email=request.user.email
email=email
).aggregate(
total=Count('id'),
pending=Count('id', filter=Q(status='pending_review')),