fix(server): deleting stacked assets (#25874)

* fix(server): deleting stacked assets

* fix: log a warning when removing an empty directory fails
This commit is contained in:
Jason Rasmussen
2026-02-04 12:33:37 -05:00
committed by GitHub
parent 9dddccd831
commit 6cdebdd3b3
6 changed files with 127 additions and 80 deletions
+21 -35
View File
@@ -430,30 +430,6 @@ select
"asset"."originalPath",
"asset"."isOffline",
to_json("asset_exif") as "exifInfo",
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"asset_face".*,
"person" as "person"
from
"asset_face"
left join lateral (
select
"person".*
from
"person"
where
"asset_face"."personId" = "person"."id"
) as "person" on true
where
"asset_face"."assetId" = "asset"."id"
and "asset_face"."deletedAt" is null
and "asset_face"."isVisible" is true
) as agg
) as "faces",
(
select
coalesce(json_agg(agg), '[]')
@@ -470,27 +446,37 @@ select
"asset_file"."assetId" = "asset"."id"
) as agg
) as "files",
to_json("stacked_assets") as "stack"
to_json("stack_result") as "stack"
from
"asset"
left join "asset_exif" on "asset"."id" = "asset_exif"."assetId"
left join "stack" on "stack"."id" = "asset"."stackId"
left join lateral (
select
"stack"."id",
"stack"."primaryAssetId",
array_agg("stacked") as "assets"
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"stack_asset"."id"
from
"asset" as "stack_asset"
where
"stack_asset"."stackId" = "stack"."id"
and "stack_asset"."id" != "stack"."primaryAssetId"
and "stack_asset"."visibility" = $1
and "stack_asset"."status" != $2
) as agg
) as "assets"
from
"asset" as "stacked"
"stack"
where
"stacked"."deletedAt" is not null
and "stacked"."visibility" = $1
and "stacked"."stackId" = "stack"."id"
group by
"stack"."id"
) as "stacked_assets" on "stack"."id" is not null
"stack"."id" = "asset"."stackId"
) as "stack_result" on true
where
"asset"."id" = $2
"asset"."id" = $3
-- AssetJobRepository.streamForVideoConversion
select