update swagger done

This commit is contained in:
2024-11-27 07:44:45 +07:00
parent d5cd47f17a
commit 4a8fde1640
10 changed files with 477 additions and 255 deletions

View File

@ -44,7 +44,9 @@ export class UserController {
#swagger.parameters['order_direction'] = {
in: 'query',
required: true,
enum: [ "ASC", "DESC"]
schema: {
'@enum': ['ASC', 'DESC']
}
}
*/
@ -103,23 +105,21 @@ export class UserController {
static async create(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['User']
#swagger.security = [{
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['body'] = {
in: 'body',
description: 'User data',
#swagger.requestBody = {
required: true,
schema: {
email: "admin@gmail.com",
username: "admin",
password: "123456",
retype_password: "123456",
name: "Administrator",
id_role: "4a6991b6-78a0-4b3b-bf5c-fa0af5f69be8",
status:"Y"
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/user"
}
}
}
}*/
}
*/
try {
const schema = Joi.object().keys({
@ -158,7 +158,7 @@ export class UserController {
static async updateProfile(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['User']
#swagger.security = [{
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
@ -168,16 +168,17 @@ export class UserController {
type: 'string'
}
#swagger.parameters['body'] = {
in: 'body',
description: 'User data',
#swagger.requestBody = {
required: true,
schema: {
email: "admin@gmail.com",
username: "admin",
name: "Administrator"
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/user_profile"
}
}
}
}*/
}
*/
try {
const schema = Joi.object().keys({
@ -217,7 +218,7 @@ export class UserController {
static async updatePassword(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['User']
#swagger.security = [{
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
@ -227,15 +228,17 @@ export class UserController {
type: 'string'
}
#swagger.parameters['body'] = {
in: 'body',
description: 'User data',
#swagger.requestBody = {
required: true,
schema: {
password: "123456",
retype_password: "123456",
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/user_password"
}
}
}
}*/
}
*/
try {
const schema = Joi.object().keys({
@ -275,7 +278,7 @@ export class UserController {
static async update(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['User']
#swagger.security = [{
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
@ -285,20 +288,17 @@ export class UserController {
type: 'string'
}
#swagger.parameters['body'] = {
in: 'body',
description: 'User data',
#swagger.requestBody = {
required: true,
schema: {
email: "admin@gmail.com",
username: "admin",
password: "123456",
retype_password: "123456",
name: "Administrator",
id_role: "4a6991b6-78a0-4b3b-bf5c-fa0af5f69be8",
status:"Y"
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/user"
}
}
}
}*/
}
*/
try {
const schema = Joi.object().keys({
@ -349,7 +349,7 @@ export class UserController {
static async delete(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['User']
#swagger.security = [{
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {
@ -386,7 +386,7 @@ export class UserController {
static async restore(req: Request, res: Response, next: NextFunction): Promise<Response> {
/*
#swagger.tags = ['User']
#swagger.security = [{
#swagger.security = [{
"bearerAuth": []
}]
#swagger.parameters['id'] = {