refactor: route
This commit is contained in:
parent
911db7802c
commit
1ec2b69f87
3 changed files with 51 additions and 5 deletions
|
|
@ -19,16 +19,16 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import HttpError from "../interfaces/http-error";
|
||||
import { listFolder, pathExist } from "../utils/minio";
|
||||
|
||||
@Route("/cabinet")
|
||||
@Route("/cabinet/{cabinetName}/drawer")
|
||||
export class DrawerController extends Controller {
|
||||
@Get("/{cabinetName}/drawer")
|
||||
@Get("/")
|
||||
@Tags("Drawer")
|
||||
@SuccessResponse(HttpStatusCode.OK)
|
||||
public listDrawer(@Path() cabinetName: string) {
|
||||
return listFolder(`${cabinetName}/`);
|
||||
}
|
||||
|
||||
@Post("/{cabinetName}/drawer")
|
||||
@Post("/")
|
||||
@Tags("Drawer")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.CREATED)
|
||||
|
|
@ -55,7 +55,7 @@ export class DrawerController extends Controller {
|
|||
return this.setStatus(HttpStatusCode.CREATED);
|
||||
}
|
||||
|
||||
@Put("/{cabinetName}/drawer/{drawerName}")
|
||||
@Put("/{drawerName}")
|
||||
@Tags("Drawer")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT)
|
||||
|
|
@ -95,7 +95,7 @@ export class DrawerController extends Controller {
|
|||
});
|
||||
}
|
||||
|
||||
@Delete("/{cabinetName}/drawer/{drawerName}")
|
||||
@Delete("/{drawerName}")
|
||||
@Tags("Drawer")
|
||||
@Security("bearerAuth")
|
||||
@SuccessResponse(HttpStatusCode.NO_CONTENT)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ 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';
|
||||
// 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 { SearchController } from './controllers/searchController';
|
||||
// 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 { SubFolderController } from './controllers/subFolderController';
|
||||
// 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 { SubFolderFileController } from './controllers/subFolderFileController';
|
||||
|
|
@ -515,6 +517,30 @@ 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('/search',
|
||||
...(fetchMiddlewares<RequestHandler>(SearchController)),
|
||||
...(fetchMiddlewares<RequestHandler>(SearchController.prototype.searchFile)),
|
||||
|
||||
function SearchController_searchFile(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
};
|
||||
|
||||
// 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 SearchController();
|
||||
|
||||
|
||||
const promise = controller.searchFile.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.get('/cabinet/:cabinetName/drawer/:drawerName/folder/:folderName/subfolder',
|
||||
...(fetchMiddlewares<RequestHandler>(SubFolderController)),
|
||||
...(fetchMiddlewares<RequestHandler>(SubFolderController.prototype.listFolder)),
|
||||
|
|
|
|||
|
|
@ -919,6 +919,26 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/search": {
|
||||
"post": {
|
||||
"operationId": "SearchFile",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"items": {},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [],
|
||||
"parameters": []
|
||||
}
|
||||
},
|
||||
"/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/subfolder": {
|
||||
"get": {
|
||||
"operationId": "ListFolder",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue