mirror of
https://github.com/immich-app/immich.git
synced 2025-04-14 12:06:25 +02:00
fix(server): no exif metadata in the deduplication utility (#15585)
add exif to `getDuplicates`
This commit is contained in:
parent
ede9c99adb
commit
a6ace5151c
2 changed files with 33 additions and 14 deletions
server/src
|
@ -306,17 +306,26 @@ order by
|
||||||
with
|
with
|
||||||
"duplicates" as (
|
"duplicates" as (
|
||||||
select
|
select
|
||||||
"duplicateId",
|
"assets"."duplicateId",
|
||||||
jsonb_agg("assets") as "assets"
|
jsonb_agg("asset") as "assets"
|
||||||
from
|
from
|
||||||
"assets"
|
"assets"
|
||||||
|
left join lateral (
|
||||||
|
select
|
||||||
|
"assets".*,
|
||||||
|
"exif" as "exifInfo"
|
||||||
|
from
|
||||||
|
"exif"
|
||||||
|
where
|
||||||
|
"exif"."assetId" = "assets"."id"
|
||||||
|
) as "asset" on true
|
||||||
where
|
where
|
||||||
"ownerId" = $1::uuid
|
"assets"."ownerId" = $1::uuid
|
||||||
and "duplicateId" is not null
|
and "assets"."duplicateId" is not null
|
||||||
and "deletedAt" is null
|
and "assets"."deletedAt" is null
|
||||||
and "isVisible" = $2
|
and "assets"."isVisible" = $2
|
||||||
group by
|
group by
|
||||||
"duplicateId"
|
"assets"."duplicateId"
|
||||||
),
|
),
|
||||||
"unique" as (
|
"unique" as (
|
||||||
select
|
select
|
||||||
|
|
|
@ -677,13 +677,23 @@ export class AssetRepository implements IAssetRepository {
|
||||||
.with('duplicates', (qb) =>
|
.with('duplicates', (qb) =>
|
||||||
qb
|
qb
|
||||||
.selectFrom('assets')
|
.selectFrom('assets')
|
||||||
.select('duplicateId')
|
.leftJoinLateral(
|
||||||
.select((eb) => eb.fn<Assets[]>('jsonb_agg', [eb.table('assets')]).as('assets'))
|
(qb) =>
|
||||||
.where('ownerId', '=', asUuid(userId))
|
qb
|
||||||
.where('duplicateId', 'is not', null)
|
.selectFrom('exif')
|
||||||
.where('deletedAt', 'is', null)
|
.selectAll('assets')
|
||||||
.where('isVisible', '=', true)
|
.select((eb) => eb.table('exif').as('exifInfo'))
|
||||||
.groupBy('duplicateId'),
|
.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) =>
|
.with('unique', (qb) =>
|
||||||
qb
|
qb
|
||||||
|
|
Loading…
Add table
Reference in a new issue