* wip * wip: add tags * wip * sql * pr feedback * pr feedback * ergonomic * pr feedback * pr feedback
96 lines
1.9 KiB
SQL
96 lines
1.9 KiB
SQL
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
-- StackRepository.search
|
|
select
|
|
"asset_stack".*,
|
|
(
|
|
select
|
|
coalesce(json_agg(agg), '[]')
|
|
from
|
|
(
|
|
select
|
|
*
|
|
from
|
|
"assets"
|
|
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
|
|
*,
|
|
(
|
|
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"
|
|
from
|
|
"assets"
|
|
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
|
|
*,
|
|
(
|
|
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"
|
|
from
|
|
"assets"
|
|
where
|
|
"assets"."deletedAt" is null
|
|
and "assets"."stackId" = "asset_stack"."id"
|
|
) as agg
|
|
) as "assets"
|
|
from
|
|
"asset_stack"
|
|
where
|
|
"id" = $1::uuid
|