chore: small adjust
This commit is contained in:
parent
e424a23c3b
commit
bbeda11fc6
3 changed files with 189 additions and 2 deletions
|
|
@ -634,7 +634,7 @@ export class StorageController extends Controller {
|
|||
const pathname = body.path.join("/") + `/${body.file}`;
|
||||
|
||||
const search = await esClient.search<StorageFile & { attachment: Record<string, string> }>({
|
||||
index: DEFAULT_INDEX!,
|
||||
index: DEFAULT_INDEX,
|
||||
query: {
|
||||
match: { pathname },
|
||||
},
|
||||
|
|
|
|||
|
|
@ -138,6 +138,15 @@ const models: TsoaRoute.Models = {
|
|||
"additionalProperties": false,
|
||||
},
|
||||
// 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
|
||||
"DownloadFileBody": {
|
||||
"dataType": "refObject",
|
||||
"properties": {
|
||||
"path": {"dataType":"array","array":{"dataType":"string"},"required":true},
|
||||
"file": {"dataType":"string","required":true},
|
||||
},
|
||||
"additionalProperties": false,
|
||||
},
|
||||
// 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
|
||||
};
|
||||
const validationService = new ValidationService(models);
|
||||
|
||||
|
|
@ -914,6 +923,32 @@ 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('/storage/file/download',
|
||||
authenticateMiddleware([{"bearerAuth":["management-role","admin"]}]),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController)),
|
||||
...(fetchMiddlewares<RequestHandler>(StorageController.prototype.downloadFile)),
|
||||
|
||||
function StorageController_downloadFile(request: any, response: any, next: any) {
|
||||
const args = {
|
||||
body: {"in":"body","name":"body","required":true,"ref":"DownloadFileBody"},
|
||||
};
|
||||
|
||||
// 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 StorageController();
|
||||
|
||||
|
||||
const promise = controller.downloadFile.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',
|
||||
authenticateMiddleware([{"bearerAuth":[]}]),
|
||||
...(fetchMiddlewares<RequestHandler>(SubFolderController)),
|
||||
|
|
|
|||
|
|
@ -467,6 +467,31 @@
|
|||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
},
|
||||
"DownloadFileBody": {
|
||||
"properties": {
|
||||
"path": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array",
|
||||
"example": [
|
||||
"แฟ้ม 1",
|
||||
"แฟ้ม 2",
|
||||
"แฟ้ม 3"
|
||||
]
|
||||
},
|
||||
"file": {
|
||||
"type": "string",
|
||||
"example": "ไฟล์ 1 แก้ไข.xlsx"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"path",
|
||||
"file"
|
||||
],
|
||||
"type": "object",
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
|
|
@ -2119,7 +2144,7 @@
|
|||
"description": "สำเร็จ"
|
||||
}
|
||||
},
|
||||
"description": "ลบ Folder หรือ File ออกจากระบบ",
|
||||
"description": "ลบ Folder ออกจากระบบ",
|
||||
"tags": [
|
||||
"Storage Folder"
|
||||
],
|
||||
|
|
@ -2327,6 +2352,7 @@
|
|||
"description": "สำเร็จ"
|
||||
}
|
||||
},
|
||||
"description": "ลบ File ออกจากระบบ",
|
||||
"tags": [
|
||||
"Storage File"
|
||||
],
|
||||
|
|
@ -2351,6 +2377,132 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/storage/file/download": {
|
||||
"post": {
|
||||
"operationId": "DownloadFile",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "สำเร็จ",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"createdBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
]
|
||||
},
|
||||
"updatedBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
]
|
||||
},
|
||||
"upload": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"path": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyword": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"category": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
},
|
||||
"fileType": {
|
||||
"type": "string"
|
||||
},
|
||||
"fileSize": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"fileName": {
|
||||
"type": "string"
|
||||
},
|
||||
"pathname": {
|
||||
"type": "string"
|
||||
},
|
||||
"downloadUrl": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"createdBy",
|
||||
"createdAt",
|
||||
"updatedBy",
|
||||
"updatedAt",
|
||||
"upload",
|
||||
"path",
|
||||
"keyword",
|
||||
"category",
|
||||
"description",
|
||||
"title",
|
||||
"fileType",
|
||||
"fileSize",
|
||||
"fileName",
|
||||
"pathname",
|
||||
"downloadUrl"
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"Download"
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": [
|
||||
"management-role",
|
||||
"admin"
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": [],
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DownloadFileBody"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/cabinet/{cabinetName}/drawer/{drawerName}/folder/{folderName}/subfolder": {
|
||||
"get": {
|
||||
"operationId": "ListFolder",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue