fix(server): no exif metadata in the deduplication utility (#15585)

add exif to `getDuplicates`
This commit is contained in:
Mert
2025-01-24 12:42:39 -05:00
committed by GitHub
parent ede9c99adb
commit a6ace5151c
2 changed files with 33 additions and 14 deletions

View File

@@ -677,13 +677,23 @@ export class AssetRepository implements IAssetRepository {
.with('duplicates', (qb) =>
qb
.selectFrom('assets')
.select('duplicateId')
.select((eb) => eb.fn<Assets[]>('jsonb_agg', [eb.table('assets')]).as('assets'))
.where('ownerId', '=', asUuid(userId))
.where('duplicateId', 'is not', null)
.where('deletedAt', 'is', null)
.where('isVisible', '=', true)
.groupBy('duplicateId'),
.leftJoinLateral(
(qb) =>
qb
.selectFrom('exif')
.selectAll('assets')
.select((eb) => eb.table('exif').as('exifInfo'))
.whereRef('exif.assetId', '=', 'assets.id')
.as('asset'),
(join) => join.onTrue(),
)
.select('assets.duplicateId')
.select((eb) => eb.fn('jsonb_agg', [eb.table('asset')]).as('assets'))
.where('assets.ownerId', '=', asUuid(userId))
.where('assets.duplicateId', 'is not', null)
.where('assets.deletedAt', 'is', null)
.where('assets.isVisible', '=', true)
.groupBy('assets.duplicateId'),
)
.with('unique', (qb) =>
qb