immich/server/src/queries/stack.repository.sql
Alex afc6e91c66
fix(web): No EXIF info on stack navigation (#15533)
* fix(web): No EXIF info on stack navigation

* fix(web): No EXIF info on stack navigation

* add exif info to get stack query

* e2e test
2025-01-23 15:22:27 +00:00

123 lines
2.7 KiB
SQL

-- NOTE: This file is auto generated by ./sql-generator
-- StackRepository.search
select
"asset_stack".*,
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"assets".*,
to_json("exifInfo") as "exifInfo"
from
"assets"
inner join lateral (
select
"exif".*
from
"exif"
where
"exif"."assetId" = "assets"."id"
) as "exifInfo" on true
where
"assets"."deletedAt" is null
and "assets"."stackId" = "asset_stack"."id"
) as agg
) as "assets"
from
"asset_stack"
where
"asset_stack"."ownerId" = $1
-- StackRepository.delete
select
*,
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"assets".*,
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"tags".*
from
"tags"
inner join "tag_asset" on "tags"."id" = "tag_asset"."tagsId"
where
"tag_asset"."assetsId" = "assets"."id"
) as agg
) as "tags",
to_json("exifInfo") as "exifInfo"
from
"assets"
inner join lateral (
select
"exif".*
from
"exif"
where
"exif"."assetId" = "assets"."id"
) as "exifInfo" on true
where
"assets"."deletedAt" is null
and "assets"."stackId" = "asset_stack"."id"
) as agg
) as "assets"
from
"asset_stack"
where
"id" = $1::uuid
-- StackRepository.getById
select
*,
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"assets".*,
(
select
coalesce(json_agg(agg), '[]')
from
(
select
"tags".*
from
"tags"
inner join "tag_asset" on "tags"."id" = "tag_asset"."tagsId"
where
"tag_asset"."assetsId" = "assets"."id"
) as agg
) as "tags",
to_json("exifInfo") as "exifInfo"
from
"assets"
inner join lateral (
select
"exif".*
from
"exif"
where
"exif"."assetId" = "assets"."id"
) as "exifInfo" on true
where
"assets"."deletedAt" is null
and "assets"."stackId" = "asset_stack"."id"
) as agg
) as "assets"
from
"asset_stack"
where
"id" = $1::uuid