Skip to content

High performance self-hosted photo and video management solution.

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

-- ClusterGroupRepository.create
insert into
  "cluster_group"
default values
returning
  *

-- ClusterGroupRepository.hasOtherMembers
select
  "user"."id"
from
  "user"
where
  "user"."clusterGroupId" = $1
  and "user"."id" != $2
  and "user"."deletedAt" is null

-- ClusterGroupRepository.createRequest
insert into
  "cluster_group_request" ("clusterGroupId", "userId")
values
  ($1, $2)
on conflict ("clusterGroupId", "userId") do update
set
  "clusterGroupId" = $3
returning
  *,
  (xmax = 0) as "isInserted"

-- ClusterGroupRepository.getRequest
select
  "cluster_group_request".*
from
  "cluster_group_request"
where
  "cluster_group_request"."id" = $1

-- ClusterGroupRepository.searchRequests
select
  "cluster_group_request".*
from
  "cluster_group_request"
where
  "cluster_group_request"."userId" = $1
  and "cluster_group_request"."clusterGroupId" = $2
order by
  "cluster_group_request"."createdAt" asc

-- ClusterGroupRepository.getUsers
select
  "id",
  "name",
  "email",
  "avatarColor",
  "profileImagePath",
  "profileChangedAt"
from
  "user"
where
  "user"."clusterGroupId" = $1
  and "user"."deletedAt" is null
order by
  "user"."id" = $2 desc,
  "user"."name" asc

-- ClusterGroupRepository.deleteRequest
delete from "cluster_group_request"
where
  "cluster_group_request"."id" = $1