0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-02-18 01:24:26 -05:00

Update map.repository.ts

Fixes assets in multiple albums from being counted more than once. Query returns only one row per unique asset.

Tested and working!
This commit is contained in:
jbcodemonkey 2025-02-15 19:22:05 -05:00 committed by GitHub
parent 194c567a45
commit 9750ab62fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -82,6 +82,7 @@ export class MapRepository {
return this.db
.selectFrom('assets')
.distinctOn(['assets.id'])
.innerJoin('exif', (builder) =>
builder
.onRef('assets.id', '=', 'exif.assetId')
@ -109,6 +110,7 @@ export class MapRepository {
return builder.or(expression);
})
.orderBy('assets.id', 'asc')
.orderBy('fileCreatedAt', 'desc')
.execute() as Promise<MapMarker[]>;
}