accounts and config: add user list api, configurate swagger docs
This commit is contained in:
@@ -23,6 +23,23 @@ class CreateUserApiView(generics.GenericAPIView, ResponseMixin):
|
||||
|
||||
@swagger_auto_schema(
|
||||
tags=['user'],
|
||||
operation_summary="Api for create employees",
|
||||
operation_description="""
|
||||
Create a new user account.
|
||||
|
||||
Request Body:
|
||||
- Requires user details based on the serializer fields.
|
||||
- All required fields must be provided in MULTIPART/DATA format.
|
||||
|
||||
Behavior:
|
||||
- Validates the incoming data using the serializer.
|
||||
- If validation succeeds, a new user is created and returned.
|
||||
- If validation fails, an appropriate error message is returned.
|
||||
|
||||
Response:
|
||||
- On success: Returns the newly created user object with a success message.
|
||||
- On error: Returns validation or processing error details.
|
||||
""",
|
||||
responses={
|
||||
201: openapi.Response(
|
||||
description="Created",
|
||||
@@ -44,7 +61,31 @@ class CreateUserApiView(generics.GenericAPIView, ResponseMixin):
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
),
|
||||
400: openapi.Response(
|
||||
description="Failure",
|
||||
schema=None,
|
||||
examples={
|
||||
"application/json": {
|
||||
"status_code": 400,
|
||||
"status": "failure",
|
||||
"message": "Kiritayotgan malumotingizni tekshirib ko'ring",
|
||||
"data": "string"
|
||||
}
|
||||
}
|
||||
),
|
||||
500: openapi.Response(
|
||||
description="Error",
|
||||
schema=None,
|
||||
examples={
|
||||
"application/json": {
|
||||
"status_code": 500,
|
||||
"status": "error",
|
||||
"message": "Xatolik, Iltimos backend dasturchiga murojaat qiling",
|
||||
"data": "string"
|
||||
}
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
def post(self, request):
|
||||
|
||||
Reference in New Issue
Block a user