Fix external library statistics for excluded assets

This commit is contained in:
Mimi 2026-05-17 16:15:52 +08:00
parent 1acc511b5c
commit d4b9a70304
2 changed files with 3 additions and 1 deletions

View file

@ -51,7 +51,8 @@ from
inner join "asset" on "asset"."libraryId" = "library"."id"
left join "asset_exif" on "asset_exif"."assetId" = "asset"."id"
where
"library"."id" = $6
"asset"."deletedAt" is null
and "library"."id" = $6
group by
"library"."id"
select

View file

@ -92,6 +92,7 @@ export class LibraryRepository {
.as('videos'),
)
.select((eb) => eb.fn.coalesce((eb) => eb.fn.sum('asset_exif.fileSizeInByte'), eb.val(0)).as('usage'))
.where('asset.deletedAt', 'is', null)
.groupBy('library.id')
.where('library.id', '=', id)
.executeTakeFirst();