mirror of
https://github.com/immich-app/immich.git
synced 2024-11-28 09:33:27 +02:00
fix(server): Return correct asset count in album (#5465)
* fix(server): Return correct asset count in album * Update album.repository.sql Add generated sql
This commit is contained in:
parent
bdbaa166d9
commit
1a63d3837e
@ -76,7 +76,7 @@ export class AlbumRepository implements IAlbumRepository {
|
||||
.select('album.id')
|
||||
.addSelect('MIN(assets.fileCreatedAt)', 'start_date')
|
||||
.addSelect('MAX(assets.fileCreatedAt)', 'end_date')
|
||||
.addSelect('COUNT(album_assets.assetsId)', 'asset_count')
|
||||
.addSelect('COUNT(assets.id)', 'asset_count')
|
||||
.leftJoin('albums_assets_assets', 'album_assets', 'album_assets.albumsId = album.id')
|
||||
.leftJoin('assets', 'assets', 'assets.id = album_assets.assetsId')
|
||||
.where('album.id IN (:...ids)', { ids })
|
||||
|
@ -207,7 +207,7 @@ SELECT
|
||||
"album"."id" AS "album_id",
|
||||
MIN("assets"."fileCreatedAt") AS "start_date",
|
||||
MAX("assets"."fileCreatedAt") AS "end_date",
|
||||
COUNT("album_assets"."assetsId") AS "asset_count"
|
||||
COUNT("assets"."id") AS "asset_count"
|
||||
FROM
|
||||
"albums" "album"
|
||||
LEFT JOIN "albums_assets_assets" "album_assets" ON "album_assets"."albumsId" = "album"."id"
|
||||
|
Loading…
Reference in New Issue
Block a user