feat: groups
This commit is contained in:
87
server/src/queries/album.group.repository.sql
Normal file
87
server/src/queries/album.group.repository.sql
Normal file
@@ -0,0 +1,87 @@
|
||||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- AlbumGroupRepository.getAll
|
||||
select
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"group"."id",
|
||||
"group"."name",
|
||||
"group"."description"
|
||||
from
|
||||
"group"
|
||||
where
|
||||
"group"."id" = "album_group"."groupId"
|
||||
) as obj
|
||||
) as "group",
|
||||
"album_group"."createdAt",
|
||||
"album_group"."updatedAt"
|
||||
from
|
||||
"album_group"
|
||||
inner join "group" on "album_group"."groupId" = "group"."id"
|
||||
where
|
||||
"albumId" = $1
|
||||
order by
|
||||
"group"."name"
|
||||
|
||||
-- AlbumGroupRepository.createAll
|
||||
insert into
|
||||
"album_group" ("albumId", "groupId", "role")
|
||||
values
|
||||
($1, $2, $3)
|
||||
on conflict ("albumId", "groupId") do update
|
||||
set
|
||||
"role" = "excluded"."role"
|
||||
returning
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
from
|
||||
"group"
|
||||
where
|
||||
"album_group"."groupId" = "group"."id"
|
||||
) as obj
|
||||
) as "group"
|
||||
|
||||
-- AlbumGroupRepository.deleteAll
|
||||
delete from "album_group"
|
||||
where
|
||||
"albumId" = $1
|
||||
and "groupId" in ($2)
|
||||
|
||||
-- AlbumGroupRepository.update
|
||||
update "album_group"
|
||||
set
|
||||
"role" = $1
|
||||
where
|
||||
"albumId" = $2
|
||||
and "groupId" = $3
|
||||
returning
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"description"
|
||||
from
|
||||
"group"
|
||||
where
|
||||
"album_group"."groupId" = "group"."id"
|
||||
) as obj
|
||||
) as "group"
|
||||
11
server/src/queries/group.repository.sql
Normal file
11
server/src/queries/group.repository.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- GroupRepository.search
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"createdAt",
|
||||
"updatedAt"
|
||||
from
|
||||
"group"
|
||||
65
server/src/queries/group.user.repository.sql
Normal file
65
server/src/queries/group.user.repository.sql
Normal file
@@ -0,0 +1,65 @@
|
||||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- GroupUserRepository.getAll
|
||||
select
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"user2"."id",
|
||||
"user2"."name",
|
||||
"user2"."email",
|
||||
"user2"."avatarColor",
|
||||
"user2"."profileImagePath",
|
||||
"user2"."profileChangedAt"
|
||||
from
|
||||
"user" as "user2"
|
||||
where
|
||||
"user2"."id" = "group_user"."userId"
|
||||
) as obj
|
||||
) as "user",
|
||||
"group_user"."createdAt",
|
||||
"group_user"."updatedAt"
|
||||
from
|
||||
"group_user"
|
||||
inner join "user" on "group_user"."userId" = "user"."id"
|
||||
where
|
||||
"groupId" = $1
|
||||
order by
|
||||
"user"."name"
|
||||
|
||||
-- GroupUserRepository.createAll
|
||||
insert into
|
||||
"group_user" ("userId", "groupId")
|
||||
values
|
||||
($1, $2)
|
||||
on conflict do nothing
|
||||
returning
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"user2"."id",
|
||||
"user2"."name",
|
||||
"user2"."email",
|
||||
"user2"."avatarColor",
|
||||
"user2"."profileImagePath",
|
||||
"user2"."profileChangedAt"
|
||||
from
|
||||
"user" as "user2"
|
||||
where
|
||||
"group_user"."userId" = "user2"."id"
|
||||
) as obj
|
||||
) as "user"
|
||||
|
||||
-- GroupUserRepository.deleteAll
|
||||
delete from "group_user"
|
||||
where
|
||||
"groupId" = $1
|
||||
and "userId" in ($2)
|
||||
Reference in New Issue
Block a user