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

@@ -21,6 +21,32 @@ class LoginApiView(generics.GenericAPIView, ResponseMixin):
@swagger_auto_schema(
tags=["auth"],
operation_summary="Authenticate a user and returns access/refresh tokens",
operation_description="""
Authenticate a user using their login credentials and return JWT tokens.
Request:
- Accepts user login credentials in JSON format.
- The payload is validated using the LoginSerializer.
Process:
- If the credentials are valid, the corresponding user is retrieved.
- A pair of JWT tokens (access and refresh) is generated for the user.
- User data and tokens are returned in the response.
Response:
- 200 OK: Returns authenticated user details along with access and refresh tokens.
- 400 Bad Request: Returned when validation fails (e.g., invalid credentials or missing fields).
- 500 Internal Server Error: Returned if an unexpected error occurs during authentication.
Authentication:
- This endpoint does not require authentication.
- It is used to obtain new JWT tokens for authorized access to protected endpoints.
Notes:
- The response includes both user profile data and JWT token pair.
- Make sure to store the refresh token securely for token renewal flows.
""",
responses={
200: openapi.Response(
description="Success",