2023-11-30 10:10:30 -05:00
|
|
|
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
|
|
|
|
|
|
-- LibraryRepository.get
|
2025-01-15 22:01:28 +01:00
|
|
|
select
|
2025-07-14 10:13:06 -04:00
|
|
|
"library".*
|
2025-01-15 22:01:28 +01:00
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"
|
2025-01-15 22:01:28 +01:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"."id" = $1
|
|
|
|
|
and "library"."deletedAt" is null
|
2023-11-30 10:10:30 -05:00
|
|
|
|
|
|
|
|
-- LibraryRepository.getAll
|
2025-01-15 22:01:28 +01:00
|
|
|
select
|
2025-07-14 10:13:06 -04:00
|
|
|
"library".*
|
2025-01-15 22:01:28 +01:00
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"
|
2025-01-15 22:01:28 +01:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"."deletedAt" is null
|
2025-01-15 22:01:28 +01:00
|
|
|
order by
|
|
|
|
|
"createdAt" asc
|
2023-11-30 10:10:30 -05:00
|
|
|
|
|
|
|
|
-- LibraryRepository.getAllDeleted
|
2025-01-15 22:01:28 +01:00
|
|
|
select
|
2025-07-14 10:13:06 -04:00
|
|
|
"library".*
|
2025-01-15 22:01:28 +01:00
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"
|
2025-01-15 22:01:28 +01:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"."deletedAt" is not null
|
2025-01-15 22:01:28 +01:00
|
|
|
order by
|
|
|
|
|
"createdAt" asc
|
2023-11-30 10:10:30 -05:00
|
|
|
|
|
|
|
|
-- LibraryRepository.getStatistics
|
2025-01-15 22:01:28 +01:00
|
|
|
select
|
2025-01-22 15:17:42 -05:00
|
|
|
count(*) filter (
|
2025-01-15 22:01:28 +01:00
|
|
|
where
|
|
|
|
|
(
|
2025-07-14 10:13:06 -04:00
|
|
|
"asset"."type" = $1
|
|
|
|
|
and "asset"."visibility" != $2
|
2025-01-15 22:01:28 +01:00
|
|
|
)
|
|
|
|
|
) as "photos",
|
|
|
|
|
count(*) filter (
|
|
|
|
|
where
|
|
|
|
|
(
|
2025-07-14 10:13:06 -04:00
|
|
|
"asset"."type" = $3
|
|
|
|
|
and "asset"."visibility" != $4
|
2025-01-15 22:01:28 +01:00
|
|
|
)
|
|
|
|
|
) as "videos",
|
2025-07-14 10:13:06 -04:00
|
|
|
coalesce(sum("asset_exif"."fileSizeInByte"), $5) as "usage"
|
2025-01-15 22:01:28 +01:00
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"
|
|
|
|
|
inner join "asset" on "asset"."libraryId" = "library"."id"
|
|
|
|
|
left join "asset_exif" on "asset_exif"."assetId" = "asset"."id"
|
2025-01-15 22:01:28 +01:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"."id" = $6
|
2025-01-15 22:01:28 +01:00
|
|
|
group by
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"."id"
|
2025-01-22 15:17:42 -05:00
|
|
|
select
|
|
|
|
|
0::int as "photos",
|
|
|
|
|
0::int as "videos",
|
|
|
|
|
0::int as "usage",
|
|
|
|
|
0::int as "total"
|
|
|
|
|
from
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"
|
2025-01-22 15:17:42 -05:00
|
|
|
where
|
2025-07-14 10:13:06 -04:00
|
|
|
"library"."id" = $1
|