Files
immich/server/src/queries/library.repository.sql

66 lines
1.2 KiB
MySQL
Raw Normal View History

-- NOTE: This file is auto generated by ./sql-generator
-- LibraryRepository.get
select
"libraries".*
from
"libraries"
where
"libraries"."id" = $1
and "libraries"."deletedAt" is null
-- LibraryRepository.getAll
select
"libraries".*
from
"libraries"
where
"libraries"."deletedAt" is null
order by
"createdAt" asc
-- LibraryRepository.getAllDeleted
select
"libraries".*
from
"libraries"
where
"libraries"."deletedAt" is not null
order by
"createdAt" asc
-- LibraryRepository.getStatistics
select
2025-01-22 15:17:42 -05:00
count(*) filter (
where
(
"assets"."type" = $1
and "assets"."visibility" != $2
)
) as "photos",
count(*) filter (
where
(
"assets"."type" = $3
and "assets"."visibility" != $4
)
) as "videos",
coalesce(sum("exif"."fileSizeInByte"), $5) as "usage"
from
"libraries"
inner join "assets" on "assets"."libraryId" = "libraries"."id"
2025-01-22 15:17:42 -05:00
left join "exif" on "exif"."assetId" = "assets"."id"
where
"libraries"."id" = $6
group by
"libraries"."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
"libraries"
where
"libraries"."id" = $1