accounts and config: add user list api, configurate swagger docs

This commit is contained in:
behruz
2025-12-11 15:40:18 +05:00
parent 19cc0dbb9c
commit 4174bd06b8
8 changed files with 266 additions and 5 deletions

View File

@@ -30,7 +30,27 @@ class UserViewSet(viewsets.GenericViewSet, ResponseMixin):
@swagger_auto_schema(
tags=['user'],
operation_description="User malumotlarini olish uchun api",
operation_summary="Get currently authenticated user's profile",
operation_description="""
Get information about the currently authenticated user.
Authentication:
- This endpoint requires an active Bearer access token.
Process:
- The system retrieves the user associated with the provided token.
- The user's information is serialized using the configured serializer.
- Returns the authenticated user's profile data.
Response:
- 200 OK: Successfully returns user details.
- 401 Unauthorized: Authorization header is missing or token is invalid.
- 500 Internal Server Error: An unexpected error occurred.
Notes:
- This endpoint does not require any request parameters.
- Useful for fetching the current user's profile without needing an ID.
""",
responses={
200: openapi.Response(
description="Success",
@@ -52,7 +72,19 @@ class UserViewSet(viewsets.GenericViewSet, ResponseMixin):
}
}
}
)
),
500: openapi.Response(
description="Error",
schema=None,
examples={
"application/json": {
"status_code": 500,
"status": "error",
"message": "Xatolik, Iltimos backend dasturchiga murojaat qiling",
"data": "string",
}
}
),
}
)
@action(