refactor: optional metadata field (for file upload only)

This commit is contained in:
Methapon2001 2023-11-27 17:30:20 +07:00
parent 17b70e8d5e
commit bc13f0e5ce
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
4 changed files with 22 additions and 34 deletions

View file

@ -78,10 +78,10 @@ export class SubFolderFileController extends Controller {
@Body()
body: {
file: string;
title: string;
description: string;
category: string;
keyword: string;
title?: string;
description?: string;
category?: string;
keyword?: string;
},
@Path() cabinetName: string,
@Path() drawerName: string,
@ -122,10 +122,10 @@ export class SubFolderFileController extends Controller {
fileName: body.file,
fileSize: 0,
fileType: "",
title: body.title,
description: body.description,
category: body.category.split(","),
keyword: body.keyword.split(","),
title: body.title ?? "",
description: body.description ?? "",
category: body.category?.split(",") ?? [],
keyword: body.keyword?.split(",") ?? [],
upload: false,
createdAt: new Date().toISOString(),
createdBy: rec ? rec.createdBy : "n/a",