mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
refactor(server): remove face, person and face search entities (#17535)
* remove face, person and face search entities update tests and mappers check if face relation exists update sql unused imports * pr feedback generate sql, remove unused imports
This commit is contained in:
parent
ae6653392e
commit
25f2b9602f
19 changed files with 384 additions and 322 deletions
|
|
@ -23,7 +23,7 @@ REINDEX TABLE person
|
|||
-- PersonRepository.delete
|
||||
delete from "person"
|
||||
where
|
||||
"person"."id" in ($1)
|
||||
"person"."id" in $1
|
||||
|
||||
-- PersonRepository.deleteFaces
|
||||
delete from "asset_faces"
|
||||
|
|
@ -95,41 +95,72 @@ where
|
|||
"asset_faces"."id" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getFaceByIdWithAssets
|
||||
-- PersonRepository.getFaceForFacialRecognitionJob
|
||||
select
|
||||
"asset_faces".*,
|
||||
"asset_faces"."id",
|
||||
"asset_faces"."personId",
|
||||
"asset_faces"."sourceType",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"person".*
|
||||
from
|
||||
"person"
|
||||
where
|
||||
"person"."id" = "asset_faces"."personId"
|
||||
) as obj
|
||||
) as "person",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"assets".*
|
||||
"assets"."ownerId",
|
||||
"assets"."isArchived",
|
||||
"assets"."fileCreatedAt"
|
||||
from
|
||||
"assets"
|
||||
where
|
||||
"assets"."id" = "asset_faces"."assetId"
|
||||
) as obj
|
||||
) as "asset"
|
||||
) as "asset",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"face_search".*
|
||||
from
|
||||
"face_search"
|
||||
where
|
||||
"face_search"."faceId" = "asset_faces"."id"
|
||||
) as obj
|
||||
) as "faceSearch"
|
||||
from
|
||||
"asset_faces"
|
||||
where
|
||||
"asset_faces"."id" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getDataForThumbnailGenerationJob
|
||||
select
|
||||
"person"."ownerId",
|
||||
"asset_faces"."boundingBoxX1" as "x1",
|
||||
"asset_faces"."boundingBoxY1" as "y1",
|
||||
"asset_faces"."boundingBoxX2" as "x2",
|
||||
"asset_faces"."boundingBoxY2" as "y2",
|
||||
"asset_faces"."imageWidth" as "oldWidth",
|
||||
"asset_faces"."imageHeight" as "oldHeight",
|
||||
"exif"."exifImageWidth",
|
||||
"exif"."exifImageHeight",
|
||||
"assets"."type",
|
||||
"assets"."originalPath",
|
||||
"asset_files"."path" as "previewPath"
|
||||
from
|
||||
"person"
|
||||
inner join "asset_faces" on "asset_faces"."id" = "person"."faceAssetId"
|
||||
inner join "assets" on "asset_faces"."assetId" = "assets"."id"
|
||||
inner join "exif" on "exif"."assetId" = "assets"."id"
|
||||
inner join "asset_files" on "asset_files"."assetId" = "assets"."id"
|
||||
where
|
||||
"person"."id" = $1
|
||||
and "asset_faces"."deletedAt" is null
|
||||
and "asset_files"."type" = $2
|
||||
and "exif"."exifImageWidth" > $3
|
||||
and "exif"."exifImageHeight" > $4
|
||||
|
||||
-- PersonRepository.reassignFace
|
||||
update "asset_faces"
|
||||
set
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue