mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
chore!: migrate album owner to album_user (#27467)
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com> Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -14,27 +14,26 @@ select
|
||||
"activity"."id"
|
||||
from
|
||||
"activity"
|
||||
left join "album" on "activity"."albumId" = "album"."id"
|
||||
inner join "album" on "activity"."albumId" = "album"."id"
|
||||
and "album"."deletedAt" is null
|
||||
inner join "album_user" on "album"."id" = "album_user"."albumId"
|
||||
and "album_user"."role" = 'owner'
|
||||
and "album_user"."userId" = $1::uuid
|
||||
where
|
||||
"activity"."id" in ($1)
|
||||
and "album"."ownerId" = $2::uuid
|
||||
"activity"."id" in ($2)
|
||||
|
||||
-- AccessRepository.activity.checkCreateAccess
|
||||
select
|
||||
"album"."id"
|
||||
from
|
||||
"album"
|
||||
left join "album_user" as "albumUsers" on "albumUsers"."albumId" = "album"."id"
|
||||
left join "user" on "user"."id" = "albumUsers"."userId"
|
||||
inner join "album_user" as "albumUsers" on "albumUsers"."albumId" = "album"."id"
|
||||
inner join "user" on "user"."id" = "albumUsers"."userId"
|
||||
and "user"."deletedAt" is null
|
||||
where
|
||||
"album"."id" in ($1)
|
||||
and "album"."isActivityEnabled" = $2
|
||||
and (
|
||||
"album"."ownerId" = $3
|
||||
or "user"."id" = $4
|
||||
)
|
||||
and "user"."id" = $3
|
||||
and "album"."deletedAt" is null
|
||||
|
||||
-- AccessRepository.album.checkOwnerAccess
|
||||
@@ -42,9 +41,11 @@ select
|
||||
"album"."id"
|
||||
from
|
||||
"album"
|
||||
inner join "album_user" on "album"."id" = "album_user"."albumId"
|
||||
and "album_user"."role" = 'owner'
|
||||
and "album_user"."userId" = $1
|
||||
where
|
||||
"album"."id" in ($1)
|
||||
and "album"."ownerId" = $2
|
||||
"album"."id" in ($2)
|
||||
and "album"."deletedAt" is null
|
||||
|
||||
-- AccessRepository.album.checkSharedAlbumAccess
|
||||
@@ -52,8 +53,8 @@ select
|
||||
"album"."id"
|
||||
from
|
||||
"album"
|
||||
left join "album_user" on "album_user"."albumId" = "album"."id"
|
||||
left join "user" on "user"."id" = "album_user"."userId"
|
||||
inner join "album_user" on "album_user"."albumId" = "album"."id"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
and "user"."deletedAt" is null
|
||||
where
|
||||
"album"."id" in ($1)
|
||||
@@ -93,10 +94,7 @@ where
|
||||
"asset"."id" = any (target.ids)
|
||||
or "asset"."livePhotoVideoId" = any (target.ids)
|
||||
)
|
||||
and (
|
||||
"album"."ownerId" = $2
|
||||
or "user"."id" = $3
|
||||
)
|
||||
and "user"."id" = $2
|
||||
and "album"."deletedAt" is null
|
||||
|
||||
-- AccessRepository.asset.checkOwnerAccess
|
||||
|
||||
@@ -1,26 +1,17 @@
|
||||
-- NOTE: This file is auto generated by ./sql-generator
|
||||
|
||||
-- AlbumRepository.getById
|
||||
with
|
||||
"album_user" as (
|
||||
select
|
||||
*
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."albumId" = $1
|
||||
)
|
||||
select
|
||||
"album".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
) as obj
|
||||
) as "owner",
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
@@ -41,15 +32,21 @@ select
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album_user"."userId"
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"album_user"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
order by
|
||||
"album_user"."role",
|
||||
"album_user"."userId" = $2 desc,
|
||||
"user"."name" asc
|
||||
) as agg
|
||||
) as "albumUsers",
|
||||
(
|
||||
@@ -88,30 +85,12 @@ select
|
||||
from
|
||||
"album"
|
||||
where
|
||||
"album"."id" = $1
|
||||
"album"."id" = $3
|
||||
and "album"."deletedAt" is null
|
||||
|
||||
-- AlbumRepository.getByAssetId
|
||||
select
|
||||
"album".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
) as obj
|
||||
) as "owner",
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
@@ -132,36 +111,38 @@ select
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album_user"."userId"
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"album_user"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
order by
|
||||
"album_user"."role",
|
||||
"album_user"."userId" = $1 desc,
|
||||
"user"."name" asc
|
||||
) as agg
|
||||
) as "albumUsers"
|
||||
from
|
||||
"album"
|
||||
inner join "album_asset" on "album_asset"."albumId" = "album"."id"
|
||||
where
|
||||
(
|
||||
"album"."ownerId" = $1
|
||||
or exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = $2
|
||||
)
|
||||
exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = $2
|
||||
)
|
||||
and "album_asset"."assetId" = $3
|
||||
and "album"."deletedAt" is null
|
||||
order by
|
||||
"album"."createdAt" desc,
|
||||
"album"."createdAt" desc
|
||||
|
||||
-- AlbumRepository.getByAssetIds
|
||||
@@ -172,18 +153,15 @@ from
|
||||
"album"
|
||||
inner join "album_asset" on "album_asset"."albumId" = "album"."id"
|
||||
where
|
||||
(
|
||||
"album"."ownerId" = $1
|
||||
or exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = $2
|
||||
)
|
||||
exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = $1
|
||||
)
|
||||
and "album_asset"."assetId" in ($3)
|
||||
and "album_asset"."assetId" in ($2)
|
||||
and "album"."deletedAt" is null
|
||||
|
||||
-- AlbumRepository.getMetadataForIds
|
||||
@@ -210,24 +188,6 @@ group by
|
||||
-- AlbumRepository.getOwned
|
||||
select
|
||||
"album".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
) as obj
|
||||
) as "owner",
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
@@ -248,15 +208,21 @@ select
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album_user"."userId"
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"album_user"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
order by
|
||||
"album_user"."role",
|
||||
"album_user"."userId" = $1 desc,
|
||||
"user"."name" asc
|
||||
) as agg
|
||||
) as "albumUsers",
|
||||
(
|
||||
@@ -274,9 +240,11 @@ select
|
||||
) as "sharedLinks"
|
||||
from
|
||||
"album"
|
||||
inner join "album_user" on "album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = $2
|
||||
and "album_user"."role" = 'owner'
|
||||
where
|
||||
"album"."ownerId" = $1
|
||||
and "album"."deletedAt" is null
|
||||
"album"."deletedAt" is null
|
||||
order by
|
||||
"album"."createdAt" desc
|
||||
|
||||
@@ -303,35 +271,23 @@ select
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album_user"."userId"
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"album_user"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
order by
|
||||
"album_user"."role",
|
||||
"album_user"."userId" = $1 desc,
|
||||
"user"."name" asc
|
||||
) as agg
|
||||
) as "albumUsers",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
) as obj
|
||||
) as "owner",
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
@@ -347,29 +303,34 @@ select
|
||||
) as "sharedLinks"
|
||||
from
|
||||
"album"
|
||||
inner join (
|
||||
select
|
||||
"album_user"."albumId" as "id"
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."userId" = $2
|
||||
and "album_user"."albumId" in (
|
||||
select
|
||||
"album_user"."albumId"
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."role" != 'owner'
|
||||
)
|
||||
union
|
||||
select
|
||||
"shared_link"."albumId" as "id"
|
||||
from
|
||||
"shared_link"
|
||||
where
|
||||
"shared_link"."userId" = $3
|
||||
and "shared_link"."albumId" is not null
|
||||
) as "matching" on "matching"."id" = "album"."id"
|
||||
inner join "album_user" on "album_user"."albumId" = "album"."id"
|
||||
and "album_user"."role" = 'owner'
|
||||
where
|
||||
(
|
||||
exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
and (
|
||||
"album"."ownerId" = $1
|
||||
or "album_user"."userId" = $2
|
||||
)
|
||||
)
|
||||
or exists (
|
||||
select
|
||||
from
|
||||
"shared_link"
|
||||
where
|
||||
"shared_link"."albumId" = "album"."id"
|
||||
and "shared_link"."userId" = $3
|
||||
)
|
||||
)
|
||||
and "album"."deletedAt" is null
|
||||
"album"."deletedAt" is null
|
||||
order by
|
||||
"album"."createdAt" desc
|
||||
|
||||
@@ -378,33 +339,68 @@ select
|
||||
"album".*,
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
coalesce(json_agg(agg), '[]')
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
"shared_link".*
|
||||
from
|
||||
"user"
|
||||
"shared_link"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
) as obj
|
||||
) as "owner"
|
||||
"shared_link"."albumId" = "album"."id"
|
||||
) as agg
|
||||
) as "sharedLinks",
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
from
|
||||
(
|
||||
select
|
||||
"album_user"."role",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"album_user"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
order by
|
||||
"album_user"."role",
|
||||
"album_user"."userId" = $1 desc,
|
||||
"user"."name" asc
|
||||
) as agg
|
||||
) as "albumUsers"
|
||||
from
|
||||
"album"
|
||||
inner join "album_user" on "album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = $2
|
||||
and "album_user"."role" = 'owner'
|
||||
where
|
||||
"album"."ownerId" = $1
|
||||
and "album"."deletedAt" is null
|
||||
"album"."deletedAt" is null
|
||||
and not exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
"album_user" as "au"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
"au"."albumId" = "album"."id"
|
||||
and "au"."role" != 'owner'
|
||||
)
|
||||
and not exists (
|
||||
select
|
||||
@@ -430,6 +426,117 @@ where
|
||||
"album_asset"."albumId" = $1
|
||||
and "album_asset"."assetId" in ($2)
|
||||
|
||||
-- AlbumRepository.addAssetIds
|
||||
insert into
|
||||
"album_asset"
|
||||
select
|
||||
$1::uuid as "albumId",
|
||||
unnest($2::uuid[]) as "assetId"
|
||||
from
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
on conflict do nothing
|
||||
|
||||
-- AlbumRepository.create
|
||||
with
|
||||
"album" as (
|
||||
insert into
|
||||
"album" ("albumName")
|
||||
values
|
||||
($1)
|
||||
returning
|
||||
*
|
||||
),
|
||||
"album_user" as (
|
||||
insert into
|
||||
"album_user"
|
||||
select
|
||||
"album"."id" as "albumId",
|
||||
unnest($2::uuid[]) as "userId",
|
||||
unnest($3::album_user_role_enum[]) as "role"
|
||||
from
|
||||
"album"
|
||||
returning
|
||||
"album_user"."albumId",
|
||||
"album_user"."userId",
|
||||
"album_user"."role"
|
||||
),
|
||||
"album_asset" as (
|
||||
insert into
|
||||
"album_asset"
|
||||
select
|
||||
"album"."id" as "albumId",
|
||||
unnest($4::uuid[]) as "assetId"
|
||||
from
|
||||
"album"
|
||||
on conflict do nothing
|
||||
returning
|
||||
"album_asset"."albumId",
|
||||
"album_asset"."assetId"
|
||||
)
|
||||
select
|
||||
"album".*,
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
from
|
||||
(
|
||||
select
|
||||
"album_user"."role",
|
||||
(
|
||||
select
|
||||
to_json(obj)
|
||||
from
|
||||
(
|
||||
select
|
||||
"id",
|
||||
"name",
|
||||
"email",
|
||||
"avatarColor",
|
||||
"profileImagePath",
|
||||
"profileChangedAt"
|
||||
from
|
||||
(
|
||||
select
|
||||
1
|
||||
) as "dummy"
|
||||
) as obj
|
||||
) as "user"
|
||||
from
|
||||
"album_user"
|
||||
inner join "user" on "user"."id" = "album_user"."userId"
|
||||
where
|
||||
"album_user"."albumId" = "album"."id"
|
||||
order by
|
||||
"album_user"."role",
|
||||
"user"."name" asc
|
||||
) as agg
|
||||
) as "albumUsers",
|
||||
(
|
||||
select
|
||||
json_agg("asset") as "assets"
|
||||
from
|
||||
(
|
||||
select
|
||||
"asset".*,
|
||||
"asset_exif" as "exifInfo"
|
||||
from
|
||||
"asset"
|
||||
left join "asset_exif" on "asset"."id" = "asset_exif"."assetId"
|
||||
inner join "album_asset" on "album_asset"."assetId" = "asset"."id"
|
||||
where
|
||||
"album_asset"."albumId" = "album"."id"
|
||||
and "asset"."deletedAt" is null
|
||||
and "asset"."visibility" in ('archive', 'timeline')
|
||||
order by
|
||||
"asset"."fileCreatedAt" desc
|
||||
) as "asset"
|
||||
) as "assets"
|
||||
from
|
||||
"album"
|
||||
|
||||
-- AlbumRepository.getContributorCounts
|
||||
select
|
||||
"asset"."ownerId" as "userId",
|
||||
|
||||
@@ -139,7 +139,15 @@ from
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."role" = 'owner'
|
||||
and "album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = "user"."id"
|
||||
)
|
||||
and "user"."deletedAt" is null
|
||||
) as "owner" on true
|
||||
where
|
||||
@@ -201,7 +209,15 @@ from
|
||||
from
|
||||
"user"
|
||||
where
|
||||
"user"."id" = "album"."ownerId"
|
||||
exists (
|
||||
select
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."role" = 'owner'
|
||||
and "album_user"."albumId" = "album"."id"
|
||||
and "album_user"."userId" = "user"."id"
|
||||
)
|
||||
and "user"."deletedAt" is null
|
||||
) as "owner" on true
|
||||
where
|
||||
|
||||
@@ -29,7 +29,6 @@ order by
|
||||
-- SyncRepository.album.getUpserts
|
||||
select distinct
|
||||
on ("album"."id", "album"."updateId") "album"."id",
|
||||
"album"."ownerId",
|
||||
"album"."albumName" as "name",
|
||||
"album"."description",
|
||||
"album"."createdAt",
|
||||
@@ -44,13 +43,19 @@ from
|
||||
where
|
||||
"album"."updateId" < $1
|
||||
and "album"."updateId" > $2
|
||||
and (
|
||||
"album"."ownerId" = $3
|
||||
or "album_users"."userId" = $4
|
||||
)
|
||||
and "album_users"."userId" = $3
|
||||
order by
|
||||
"album"."updateId" asc
|
||||
|
||||
-- SyncRepository.album.getAlbumUsers
|
||||
select
|
||||
"userId",
|
||||
"role"
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"albumId" = $1
|
||||
|
||||
-- SyncRepository.albumAsset.getBackfill
|
||||
select
|
||||
"asset"."id",
|
||||
@@ -109,16 +114,12 @@ select
|
||||
from
|
||||
"asset" as "asset"
|
||||
inner join "album_asset" on "album_asset"."assetId" = "asset"."id"
|
||||
inner join "album" on "album"."id" = "album_asset"."albumId"
|
||||
left join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
inner join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
where
|
||||
"asset"."updateId" < $1
|
||||
and "asset"."updateId" > $2
|
||||
and "album_asset"."updateId" <= $3
|
||||
and (
|
||||
"album"."ownerId" = $4
|
||||
or "album_user"."userId" = $5
|
||||
)
|
||||
and "album_user"."userId" = $4
|
||||
order by
|
||||
"asset"."updateId" asc
|
||||
|
||||
@@ -147,15 +148,11 @@ select
|
||||
from
|
||||
"album_asset" as "album_asset"
|
||||
inner join "asset" on "asset"."id" = "album_asset"."assetId"
|
||||
inner join "album" on "album"."id" = "album_asset"."albumId"
|
||||
left join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
inner join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
where
|
||||
"album_asset"."updateId" < $1
|
||||
and "album_asset"."updateId" > $2
|
||||
and (
|
||||
"album"."ownerId" = $3
|
||||
or "album_user"."userId" = $4
|
||||
)
|
||||
and "album_user"."userId" = $3
|
||||
order by
|
||||
"album_asset"."updateId" asc
|
||||
|
||||
@@ -229,16 +226,12 @@ select
|
||||
from
|
||||
"asset_exif" as "asset_exif"
|
||||
inner join "album_asset" on "album_asset"."assetId" = "asset_exif"."assetId"
|
||||
inner join "album" on "album"."id" = "album_asset"."albumId"
|
||||
left join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
inner join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
where
|
||||
"asset_exif"."updateId" < $1
|
||||
and "asset_exif"."updateId" > $2
|
||||
and "album_asset"."updateId" <= $3
|
||||
and (
|
||||
"album"."ownerId" = $4
|
||||
or "album_user"."userId" = $5
|
||||
)
|
||||
and "album_user"."userId" = $4
|
||||
order by
|
||||
"asset_exif"."updateId" asc
|
||||
|
||||
@@ -278,10 +271,7 @@ from
|
||||
where
|
||||
"album_asset"."updateId" < $1
|
||||
and "album_asset"."updateId" > $2
|
||||
and (
|
||||
"album"."ownerId" = $3
|
||||
or "album_user"."userId" = $4
|
||||
)
|
||||
and "album_user"."userId" = $3
|
||||
order by
|
||||
"album_asset"."updateId" asc
|
||||
|
||||
@@ -312,20 +302,11 @@ where
|
||||
and "album_asset_audit"."id" > $2
|
||||
and "albumId" in (
|
||||
select
|
||||
"id"
|
||||
"album_user"."albumId" as "id"
|
||||
from
|
||||
"album"
|
||||
"album_user"
|
||||
where
|
||||
"ownerId" = $3
|
||||
union
|
||||
(
|
||||
select
|
||||
"album_user"."albumId" as "id"
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."userId" = $4
|
||||
)
|
||||
"album_user"."userId" = $3
|
||||
)
|
||||
order by
|
||||
"album_asset_audit"."id" asc
|
||||
@@ -337,15 +318,11 @@ select
|
||||
"album_asset"."updateId"
|
||||
from
|
||||
"album_asset" as "album_asset"
|
||||
inner join "album" on "album"."id" = "album_asset"."albumId"
|
||||
left join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
inner join "album_user" on "album_user"."albumId" = "album_asset"."albumId"
|
||||
where
|
||||
"album_asset"."updateId" < $1
|
||||
and "album_asset"."updateId" > $2
|
||||
and (
|
||||
"album"."ownerId" = $3
|
||||
or "album_user"."userId" = $4
|
||||
)
|
||||
and "album_user"."userId" = $3
|
||||
order by
|
||||
"album_asset"."updateId" asc
|
||||
|
||||
@@ -377,20 +354,11 @@ where
|
||||
and "album_user_audit"."id" > $2
|
||||
and "albumId" in (
|
||||
select
|
||||
"id"
|
||||
"album_user"."albumId" as "id"
|
||||
from
|
||||
"album"
|
||||
"album_user"
|
||||
where
|
||||
"ownerId" = $3
|
||||
union
|
||||
(
|
||||
select
|
||||
"album_user"."albumId" as "id"
|
||||
from
|
||||
"album_user"
|
||||
where
|
||||
"album_user"."userId" = $4
|
||||
)
|
||||
"album_user"."userId" = $3
|
||||
)
|
||||
order by
|
||||
"album_user_audit"."id" asc
|
||||
@@ -408,20 +376,11 @@ where
|
||||
and "album_user"."updateId" > $2
|
||||
and "album_user"."albumId" in (
|
||||
select
|
||||
"id"
|
||||
"albumUsers"."albumId" as "id"
|
||||
from
|
||||
"album"
|
||||
"album_user" as "albumUsers"
|
||||
where
|
||||
"ownerId" = $3
|
||||
union
|
||||
(
|
||||
select
|
||||
"albumUsers"."albumId" as "id"
|
||||
from
|
||||
"album_user" as "albumUsers"
|
||||
where
|
||||
"albumUsers"."userId" = $4
|
||||
)
|
||||
"albumUsers"."userId" = $3
|
||||
)
|
||||
order by
|
||||
"album_user"."updateId" asc
|
||||
|
||||
Reference in New Issue
Block a user