refactor: handle detect faces job query (#17660)

This commit is contained in:
Daniel Dietzler 2025-04-16 22:52:54 +02:00 committed by GitHub
parent 1bbfacfc09
commit 586a7a173b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 80 additions and 32 deletions

View file

@ -219,6 +219,46 @@ from
where
"assets"."id" = $2
-- AssetJobRepository.getForDetectFacesJob
select
"assets"."id",
"assets"."isVisible",
to_json("exif") as "exifInfo",
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"asset_faces".*
from
"asset_faces"
where
"asset_faces"."assetId" = "assets"."id"
) as agg
) as "faces",
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"asset_files"."id",
"asset_files"."path",
"asset_files"."type"
from
"asset_files"
where
"asset_files"."assetId" = "assets"."id"
and "asset_files"."type" = $1
) as agg
) as "files"
from
"assets"
inner join "exif" on "assets"."id" = "exif"."assetId"
where
"assets"."id" = $2
-- AssetJobRepository.getForStorageTemplateJob
select
"assets"."id",