chore: update generated route and swagger

This commit is contained in:
Methapon2001 2023-11-17 14:44:30 +07:00
parent 9cb38ba9f6
commit c3c7a0ad27
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
2 changed files with 188 additions and 162 deletions

View file

@ -5,6 +5,8 @@ import { Controller, ValidationService, FieldErrors, ValidateError, TsoaRoute, H
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { CabinetController } from './controllers/cabinetController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { DrawerController } from './controllers/drawerController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { FileController } from './controllers/fileController';
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
import { FolderController } from './controllers/folderController';
@ -64,7 +66,6 @@ export function RegisterRoutes(app: Router) {
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.post('/cabinet',
authenticateMiddleware([{"bearerAuth":[]}]),
...(fetchMiddlewares<RequestHandler>(CabinetController)),
...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.createCabinet)),
@ -141,10 +142,10 @@ export function RegisterRoutes(app: Router) {
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/cabinet/:cabinetName/drawer',
...(fetchMiddlewares<RequestHandler>(CabinetController)),
...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.listDrawer)),
...(fetchMiddlewares<RequestHandler>(DrawerController)),
...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.listDrawer)),
function CabinetController_listDrawer(request: any, response: any, next: any) {
function DrawerController_listDrawer(request: any, response: any, next: any) {
const args = {
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
};
@ -155,7 +156,7 @@ export function RegisterRoutes(app: Router) {
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new CabinetController();
const controller = new DrawerController();
const promise = controller.listDrawer.apply(controller, validatedArgs as any);
@ -166,10 +167,10 @@ export function RegisterRoutes(app: Router) {
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.post('/cabinet/:cabinetName/drawer',
...(fetchMiddlewares<RequestHandler>(CabinetController)),
...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.createDrawer)),
...(fetchMiddlewares<RequestHandler>(DrawerController)),
...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.createDrawer)),
function CabinetController_createDrawer(request: any, response: any, next: any) {
function DrawerController_createDrawer(request: any, response: any, next: any) {
const args = {
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
@ -181,21 +182,21 @@ export function RegisterRoutes(app: Router) {
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new CabinetController();
const controller = new DrawerController();
const promise = controller.createDrawer.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, 204, next);
promiseHandler(controller, promise, response, 201, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.put('/cabinet/:cabinetName/drawer/:drawerName',
...(fetchMiddlewares<RequestHandler>(CabinetController)),
...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.editDrawer)),
...(fetchMiddlewares<RequestHandler>(DrawerController)),
...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.editDrawer)),
function CabinetController_editDrawer(request: any, response: any, next: any) {
function DrawerController_editDrawer(request: any, response: any, next: any) {
const args = {
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
@ -208,7 +209,7 @@ export function RegisterRoutes(app: Router) {
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new CabinetController();
const controller = new DrawerController();
const promise = controller.editDrawer.apply(controller, validatedArgs as any);
@ -219,10 +220,10 @@ export function RegisterRoutes(app: Router) {
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.delete('/cabinet/:cabinetName/drawer/:drawerName',
...(fetchMiddlewares<RequestHandler>(CabinetController)),
...(fetchMiddlewares<RequestHandler>(CabinetController.prototype.deleteDrawer)),
...(fetchMiddlewares<RequestHandler>(DrawerController)),
...(fetchMiddlewares<RequestHandler>(DrawerController.prototype.deleteDrawer)),
function CabinetController_deleteDrawer(request: any, response: any, next: any) {
function DrawerController_deleteDrawer(request: any, response: any, next: any) {
const args = {
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
@ -234,17 +235,17 @@ export function RegisterRoutes(app: Router) {
try {
validatedArgs = getValidatedArgs(args, request, response);
const controller = new CabinetController();
const controller = new DrawerController();
const promise = controller.deleteDrawer.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, 200, next);
promiseHandler(controller, promise, response, 204, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.post('/file',
app.post('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName',
upload.single('file'),
...(fetchMiddlewares<RequestHandler>(FileController)),
...(fetchMiddlewares<RequestHandler>(FileController.prototype.uploadFile)),
@ -253,6 +254,9 @@ export function RegisterRoutes(app: Router) {
const args = {
file: {"in":"formData","name":"file","required":true,"dataType":"file"},
desc: {"in":"formData","name":"desc","required":true,"dataType":"string"},
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@ -265,21 +269,20 @@ export function RegisterRoutes(app: Router) {
const promise = controller.uploadFile.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, undefined, next);
promiseHandler(controller, promise, response, 204, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.get('/folder',
app.get('/cabinet/:cabinetName/drawer/:drawerName/folder',
...(fetchMiddlewares<RequestHandler>(FolderController)),
...(fetchMiddlewares<RequestHandler>(FolderController.prototype.listFolder)),
function FolderController_listFolder(request: any, response: any, next: any) {
const args = {
cabinet: {"in":"query","name":"cabinet","required":true,"dataType":"string"},
drawer: {"in":"query","name":"drawer","required":true,"dataType":"string"},
path: {"in":"query","name":"path","dataType":"string"},
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@ -298,16 +301,15 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.post('/folder',
app.post('/cabinet/:cabinetName/drawer/:drawerName/folder',
...(fetchMiddlewares<RequestHandler>(FolderController)),
...(fetchMiddlewares<RequestHandler>(FolderController.prototype.createFolder)),
function FolderController_createFolder(request: any, response: any, next: any) {
const args = {
body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
cabinet: {"in":"query","name":"cabinet","required":true,"dataType":"string"},
drawer: {"in":"query","name":"drawer","required":true,"dataType":"string"},
path: {"in":"query","name":"path","dataType":"string"},
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@ -326,16 +328,16 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.put('/folder',
app.put('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName',
...(fetchMiddlewares<RequestHandler>(FolderController)),
...(fetchMiddlewares<RequestHandler>(FolderController.prototype.editFolder)),
function FolderController_editFolder(request: any, response: any, next: any) {
const args = {
body: {"in":"body","name":"body","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"name":{"dataType":"string","required":true}}},
cabinet: {"in":"query","name":"cabinet","required":true,"dataType":"string"},
drawer: {"in":"query","name":"drawer","required":true,"dataType":"string"},
path: {"in":"query","name":"path","required":true,"dataType":"string"},
cabinetName: {"in":"query","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"query","name":"drawerName","required":true,"dataType":"string"},
folderName: {"in":"query","name":"folderName","required":true,"dataType":"string"},
};
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
@ -354,68 +356,36 @@ export function RegisterRoutes(app: Router) {
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
app.delete('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName',
...(fetchMiddlewares<RequestHandler>(FolderController)),
...(fetchMiddlewares<RequestHandler>(FolderController.prototype.deleteFolder)),
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
function authenticateMiddleware(security: TsoaRoute.Security[] = []) {
return async function runAuthenticationMiddleware(request: any, _response: any, next: any) {
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// keep track of failed auth attempts so we can hand back the most
// recent one. This behavior was previously existing so preserving it
// here
const failedAttempts: any[] = [];
const pushAndRethrow = (error: any) => {
failedAttempts.push(error);
throw error;
function FolderController_deleteFolder(request: any, response: any, next: any) {
const args = {
cabinetName: {"in":"path","name":"cabinetName","required":true,"dataType":"string"},
drawerName: {"in":"path","name":"drawerName","required":true,"dataType":"string"},
folderName: {"in":"path","name":"folderName","required":true,"dataType":"string"},
};
const secMethodOrPromises: Promise<any>[] = [];
for (const secMethod of security) {
if (Object.keys(secMethod).length > 1) {
const secMethodAndPromises: Promise<any>[] = [];
for (const name in secMethod) {
secMethodAndPromises.push(
expressAuthentication(request, name, secMethod[name])
.catch(pushAndRethrow)
);
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
secMethodOrPromises.push(Promise.all(secMethodAndPromises)
.then(users => { return users[0]; }));
} else {
for (const name in secMethod) {
secMethodOrPromises.push(
expressAuthentication(request, name, secMethod[name])
.catch(pushAndRethrow)
);
}
}
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
let validatedArgs: any[] = [];
try {
request['user'] = await promiseAny.call(Promise, secMethodOrPromises);
next();
}
catch(err) {
// Show most recent error as response
const error = failedAttempts.pop();
error.status = error.status || 401;
next(error);
}
validatedArgs = getValidatedArgs(args, request, response);
const controller = new FolderController();
const promise = controller.deleteFolder.apply(controller, validatedArgs as any);
promiseHandler(controller, promise, response, 204, next);
} catch (err) {
return next(err);
}
});
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
}
}
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa

View file

@ -101,11 +101,7 @@
"tags": [
"Cabinet"
],
"security": [
{
"bearerAuth": []
}
],
"security": [],
"parameters": [],
"requestBody": {
"required": true,
@ -232,7 +228,7 @@
"post": {
"operationId": "CreateDrawer",
"responses": {
"204": {
"201": {
"description": ""
}
},
@ -275,7 +271,7 @@
"operationId": "EditDrawer",
"responses": {
"204": {
"description": "Success"
"description": ""
}
},
"tags": [
@ -322,7 +318,7 @@
"delete": {
"operationId": "DeleteDrawer",
"responses": {
"200": {
"204": {
"description": "",
"content": {
"application/json": {
@ -355,16 +351,44 @@
]
}
},
"/file": {
"/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}": {
"post": {
"operationId": "UploadFile",
"responses": {
"204": {
"description": "No content"
"description": ""
}
},
"tags": [
"File"
],
"security": [],
"parameters": [],
"parameters": [
{
"in": "path",
"name": "cabinetName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "drawerName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "folderName",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
@ -388,22 +412,15 @@
}
}
}
}
},
"/folder": {
"get": {
"operationId": "ListFolder",
},
"put": {
"operationId": "EditFolder",
"responses": {
"200": {
"description": "List of folder under drawer or under subfolder",
"204": {
"description": "",
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/EhrFolder"
},
"type": "array"
}
"schema": {}
}
}
}
@ -415,7 +432,7 @@
"parameters": [
{
"in": "query",
"name": "cabinet",
"name": "cabinetName",
"required": true,
"schema": {
"type": "string"
@ -423,7 +440,7 @@
},
{
"in": "query",
"name": "drawer",
"name": "drawerName",
"required": true,
"schema": {
"type": "string"
@ -431,49 +448,11 @@
},
{
"in": "query",
"name": "path",
"required": false,
"schema": {
"type": "string"
}
}
]
},
"post": {
"operationId": "CreateFolder",
"responses": {
"201": {
"description": "Folder created."
}
},
"tags": [
"Folder"
],
"security": [],
"parameters": [
{
"in": "query",
"name": "cabinet",
"name": "folderName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "drawer",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "path",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
@ -495,11 +474,16 @@
}
}
},
"put": {
"operationId": "EditFolder",
"delete": {
"operationId": "DeleteFolder",
"responses": {
"204": {
"description": "Folder name changed."
"description": "",
"content": {
"application/json": {
"schema": {}
}
}
}
},
"tags": [
@ -508,24 +492,96 @@
"security": [],
"parameters": [
{
"in": "query",
"name": "cabinet",
"in": "path",
"name": "cabinetName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "drawer",
"in": "path",
"name": "drawerName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "query",
"name": "path",
"in": "path",
"name": "folderName",
"required": true,
"schema": {
"type": "string"
}
}
]
}
},
"/cabinet/{cabinetName}/drawer/{drawerName}/folder": {
"get": {
"operationId": "ListFolder",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/EhrFolder"
},
"type": "array"
}
}
}
}
},
"tags": [
"Folder"
],
"security": [],
"parameters": [
{
"in": "path",
"name": "cabinetName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "drawerName",
"required": true,
"schema": {
"type": "string"
}
}
]
},
"post": {
"operationId": "CreateFolder",
"responses": {
"201": {
"description": ""
}
},
"tags": [
"Folder"
],
"security": [],
"parameters": [
{
"in": "path",
"name": "cabinetName",
"required": true,
"schema": {
"type": "string"
}
},
{
"in": "path",
"name": "drawerName",
"required": true,
"schema": {
"type": "string"