refactor: return data

This commit is contained in:
Methapon2001 2023-11-20 14:13:19 +07:00
parent b67a3d1b22
commit 627567abf6
No known key found for this signature in database
GPG key ID: 849924FEF46BD132

View file

@ -113,7 +113,6 @@ export class FileController extends Controller {
@Get("/{cabinetName}/drawer/{drawerName}/folder/{folderName}/file")
@Tags("File")
@Security("bearerAuth")
@SuccessResponse(HttpStatusCode.OK)
public async getFile(
@Path() cabinetName: string,
@ -138,31 +137,9 @@ export class FileController extends Controller {
.map((v) => {
if (!v._source) return;
const {
pathname,
title,
description,
keyword,
category,
attachment,
createdAt,
createdBy,
updatedAt,
updatedBy,
} = v._source;
const { attachment, ...rest } = v._source;
return {
pathname,
title,
description,
keyword,
category,
type: attachment["content_type"],
createdAt,
createdBy,
updatedAt,
updatedBy,
};
return rest;
})
.flatMap((v) => (v ? [v] : []));