mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-04 03:27:09 -05:00 
			
		
		
		
	perf(server): optimize mapAsset (#7331)
This commit is contained in:
		
							parent
							
								
									869e9f1399
								
							
						
					
					
						commit
						ec55acc98c
					
				@ -73,6 +73,7 @@ const peopleWithFaces = (faces: AssetFaceEntity[]): PersonWithFacesResponseDto[]
 | 
			
		||||
export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): AssetResponseDto {
 | 
			
		||||
  const { stripMetadata = false, withStack = false } = options;
 | 
			
		||||
 | 
			
		||||
  if (stripMetadata) {
 | 
			
		||||
    const sanitizedAssetResponse: SanitizedAssetResponseDto = {
 | 
			
		||||
      id: entity.id,
 | 
			
		||||
      type: entity.type,
 | 
			
		||||
@ -83,13 +84,10 @@ export function mapAsset(entity: AssetEntity, options: AssetMapOptions = {}): As
 | 
			
		||||
      livePhotoVideoId: entity.livePhotoVideoId,
 | 
			
		||||
      hasMetadata: false,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  if (stripMetadata) {
 | 
			
		||||
    return sanitizedAssetResponse as AssetResponseDto;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return {
 | 
			
		||||
    ...sanitizedAssetResponse,
 | 
			
		||||
    id: entity.id,
 | 
			
		||||
    deviceAssetId: entity.deviceAssetId,
 | 
			
		||||
    ownerId: entity.ownerId,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user