Skip to content

High performance self-hosted photo and video management solution.

1.2 KB
Raw Blame
-- NOTE: This file is auto generated by ./sql-generator

-- LibraryRepository.get
select
  "library".*
from
  "library"
where
  "library"."id" = $1
  and "library"."deletedAt" is null

-- LibraryRepository.getAll
select
  "library".*
from
  "library"
where
  "library"."deletedAt" is null
order by
  "createdAt" asc

-- LibraryRepository.getAllDeleted
select
  "library".*
from
  "library"
where
  "library"."deletedAt" is not null
order by
  "createdAt" asc

-- LibraryRepository.getStatistics
select
  count(*) filter (
    where
      (
        "asset"."type" = $1
        and "asset"."visibility" != $2
      )
  ) as "photos",
  count(*) filter (
    where
      (
        "asset"."type" = $3
        and "asset"."visibility" != $4
      )
  ) as "videos",
  coalesce(sum("asset_exif"."fileSizeInByte"), $5) as "usage"
from
  "library"
  inner join "asset" on "asset"."libraryId" = "library"."id"
  left join "asset_exif" on "asset_exif"."assetId" = "asset"."id"
where
  "asset"."deletedAt" is null
  and "library"."id" = $6
group by
  "library"."id"
select
  0::int as "photos",
  0::int as "videos",
  0::int as "usage",
  0::int as "total"
from
  "library"
where
  "library"."id" = $1