High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
perf(server): optimize mapAsset (#7331)
Michel Heusschenec55acc98c29
diff --git a/server/src/domain/asset/response-dto/asset-response.dto.ts b/server/src/domain/asset/response-dto/asset-response.dto.tsindex 94a9f8a42d..4cc0bd6672 100644--- a/server/src/domain/asset/response-dto/asset-response.dto.ts+++ b/server/src/domain/asset/response-dto/asset-response.dto.ts@@ -73,23 +73,21 @@ const peopleWithFaces = (faces: AssetFaceEntity[]): PersonWithFacesResponseDto[]export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): AssetResponseDto {const { stripMetadata = false, withStack = false } = options;- const sanitizedAssetResponse: SanitizedAssetResponseDto = {- id: entity.id,- type: entity.type,- thumbhash: entity.thumbhash?.toString('base64') ?? null,- localDateTime: entity.localDateTime,- resized: !!entity.resizePath,- duration: entity.duration ?? '0:00:00.00000',- livePhotoVideoId: entity.livePhotoVideoId,- hasMetadata: false,- };-if (stripMetadata) {+ const sanitizedAssetResponse: SanitizedAssetResponseDto = {+ id: entity.id,+ type: entity.type,+ thumbhash: entity.thumbhash?.toString('base64') ?? null,+ localDateTime: entity.localDateTime,+ resized: !!entity.resizePath,+ duration: entity.duration ?? '0:00:00.00000',+ livePhotoVideoId: entity.livePhotoVideoId,+ hasMetadata: false,+ };return sanitizedAssetResponse as AssetResponseDto;}return {- ...sanitizedAssetResponse,id: entity.id,deviceAssetId: entity.deviceAssetId,ownerId: entity.ownerId,