From 44259437f6fcc129cf59762538d8c458d446ea9f Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:13:26 +0700 Subject: [PATCH] chore: updated route --- Prototype/server/src/routes.ts | 37 ++++++++- Prototype/server/src/swagger.json | 133 ++++++++++++++++++++++++------ 2 files changed, 144 insertions(+), 26 deletions(-) diff --git a/Prototype/server/src/routes.ts b/Prototype/server/src/routes.ts index 749a396..01ceec9 100644 --- a/Prototype/server/src/routes.ts +++ b/Prototype/server/src/routes.ts @@ -291,7 +291,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.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file', - authenticateMiddleware([{"bearerAuth":[]}]), ...(fetchMiddlewares(FileController)), ...(fetchMiddlewares(FileController.prototype.getFile)), @@ -318,6 +317,42 @@ 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.patch('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file/:fileName', + authenticateMiddleware([{"bearerAuth":[]}]), + upload.single('file'), + ...(fetchMiddlewares(FileController)), + ...(fetchMiddlewares(FileController.prototype.updateFile)), + + function FileController_updateFile(request: any, response: any, next: any) { + const args = { + request: {"in":"request","name":"request","required":true,"dataType":"object"}, + 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"}, + fileName: {"in":"path","name":"fileName","required":true,"dataType":"string"}, + file: {"in":"formData","name":"file","dataType":"file"}, + title: {"in":"formData","name":"title","dataType":"string"}, + description: {"in":"formData","name":"description","dataType":"string"}, + keyword: {"in":"formData","name":"keyword","dataType":"string"}, + category: {"in":"formData","name":"category","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 + + let validatedArgs: any[] = []; + try { + validatedArgs = getValidatedArgs(args, request, response); + + const controller = new FileController(); + + + const promise = controller.updateFile.apply(controller, validatedArgs as any); + promiseHandler(controller, promise, response, 200, 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.delete('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/file/:fileName', authenticateMiddleware([{"bearerAuth":[]}]), ...(fetchMiddlewares(FileController)), diff --git a/Prototype/server/src/swagger.json b/Prototype/server/src/swagger.json index 41ab6e3..8cf67eb 100644 --- a/Prototype/server/src/swagger.json +++ b/Prototype/server/src/swagger.json @@ -463,20 +463,6 @@ "schema": { "items": { "properties": { - "updatedBy": { - "type": "string" - }, - "updatedAt": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "string", - "format": "date-time" - } - ] - }, "createdBy": { "type": "string" }, @@ -491,16 +477,27 @@ } ] }, - "type": { + "updatedBy": { "type": "string" }, - "category": { + "updatedAt": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "string", + "format": "date-time" + } + ] + }, + "keyword": { "items": { "type": "string" }, "type": "array" }, - "keyword": { + "category": { "items": { "type": "string" }, @@ -512,20 +509,32 @@ "title": { "type": "string" }, + "fileType": { + "type": "string" + }, + "fileSize": { + "type": "number", + "format": "double" + }, + "fileName": { + "type": "string" + }, "pathname": { "type": "string" } }, "required": [ - "updatedBy", - "updatedAt", "createdBy", "createdAt", - "type", - "category", + "updatedBy", + "updatedAt", "keyword", + "category", "description", "title", + "fileType", + "fileSize", + "fileName", "pathname" ], "type": "object" @@ -539,6 +548,46 @@ "tags": [ "File" ], + "security": [], + "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" + } + } + ] + } + }, + "/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/file/{fileName}": { + "patch": { + "operationId": "UpdateFile", + "responses": { + "200": { + "description": "" + } + }, + "tags": [ + "File" + ], "security": [ { "bearerAuth": [] @@ -568,11 +617,45 @@ "schema": { "type": "string" } + }, + { + "in": "path", + "name": "fileName", + "required": true, + "schema": { + "type": "string" + } } - ] - } - }, - "/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/file/{fileName}": { + ], + "requestBody": { + "required": false, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "keyword": { + "type": "string" + }, + "category": { + "type": "string" + } + } + } + } + } + } + }, "delete": { "operationId": "DeleteFile", "responses": {