Update auth endpoints

This commit is contained in:
Alex Holliday committed 2024-09-24 13:56:58 +08:00
1 parent 4b35811897
commit d2ab33492a
3 files changed
+104 -81

No files matched your search

+93 -63
View File
@@ -81,7 +81,14 @@
"application/json": {
"schema": {
"type": "object",
"required": ["firstName", "lastName", "email", "password", "role", "teamId"],
"required": [
"firstName",
"lastName",
"email",
"password",
"role",
"teamId"
],
"properties": {
"firstName": {
"type": "string"
@@ -103,7 +110,7 @@
},
"role": {
"type": "array",
"enum": [["user"], ["admin"], ["superadmin"]],
"enum": [["user"], ["admin"], ["superadmin"], ["Demo"]],
"default": ["superadmin"]
},
"teamId": {
@@ -207,78 +214,54 @@
}
}
},
"/auth/user/:userId": {
"/auth/user/{userId}": {
"put": {
"tags": ["auth"],
"description": "Change user informations",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserSuccessResponse"
}
}
"description": "Change user information",
"parameters": [
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserUpdateRequest"
}
}
}
}
},
"security": [
{
"bearerAuth": []
}
]
},
"delete": {
"tags": ["auth"],
"description": "Delete user",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserSuccessResponse"
}
}
}
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
"parameters": [
{
"name": "userId",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
}
],
"security": [
{
"bearerAuth": []
}
]
}
},
"/auth/users/admin": {
@@ -587,12 +570,20 @@
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"schemas": {
"ErrorResponse": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
"type": "boolean",
"default": false
},
"msg": {
"type": "string"
@@ -613,6 +604,45 @@
}
}
},
"UserUpdateRequest": {
"type": "object",
"required": [
"firstName",
"lastName",
"email",
"password",
"role",
"teamId"
],
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"password": {
"type": "string",
"format": "password"
},
"newPassword": {
"type": "string",
"format": "password"
},
"profileImage": {
"type": "file",
"format": "file"
},
"role": {
"type": "array",
"enum": [["user"], ["admin"], ["superadmin"], ["Demo"]],
"default": ["superadmin"]
},
"deleteProfileImage": {
"type": "boolean"
}
}
},
"UserSuccessResponse": {
"type": "object",
"properties": {