From a7048f17f7b1dc4374eae95b5b7f1a1239c05294 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Thu, 22 Dec 2022 14:45:20 +0100 Subject: [PATCH] server: simplify duplicated code --- .../src/models/repositories/drive-file.ts | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts index b4a7691b5..2eb534033 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -152,26 +152,7 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({ const file = typeof src === 'object' ? src : await this.findOneBy({ id: src }); if (file == null) return null; - return await awaitAll>({ - id: file.id, - createdAt: file.createdAt.toISOString(), - name: file.name, - type: file.type, - md5: file.md5, - size: file.size, - isSensitive: file.isSensitive, - blurhash: file.blurhash, - properties: opts.self ? file.properties : this.getPublicProperties(file), - url: opts.self ? file.url : this.getPublicUrl(file, false), - thumbnailUrl: this.getPublicUrl(file, true), - comment: file.comment, - folderId: file.folderId, - folder: opts.detail && file.folderId ? DriveFolders.pack(file.folderId, { - detail: true, - }) : null, - userId: opts.withUser ? file.userId : null, - user: (opts.withUser && file.userId) ? Users.pack(file.userId) : null, - }); + return await this.pack(file); }, async packMany(