Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions server/src/queries/access.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ from
left join "user" on "user"."id" = "albumUsers"."usersId"
and "user"."deletedAt" is null
where
array["asset"."id", "asset"."livePhotoVideoId"] && array[$1]::uuid[]
(
"asset"."id" in ($1)
or "asset"."livePhotoVideoId" in ($2)
)
and (
"album"."ownerId" = $2
or "user"."id" = $3
"album"."ownerId" = $3
or "user"."id" = $4
)
and "album"."deletedAt" is null

Expand Down
6 changes: 1 addition & 5 deletions server/src/repositories/access.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ class AssetAccess {
.leftJoin('album_user as albumUsers', 'albumUsers.albumsId', 'album.id')
.leftJoin('user', (join) => join.onRef('user.id', '=', 'albumUsers.usersId').on('user.deletedAt', 'is', null))
.select(['asset.id', 'asset.livePhotoVideoId'])
.where(
sql`array["asset"."id", "asset"."livePhotoVideoId"]`,
'&&',
sql`array[${sql.join([...assetIds])}]::uuid[] `,
)
.where((eb) => eb.or([eb('asset.id', 'in', [...assetIds]), eb('asset.livePhotoVideoId', 'in', [...assetIds])]))
Comment thread
mertalev marked this conversation as resolved.
Outdated
Comment thread
mertalev marked this conversation as resolved.
Outdated
.where((eb) => eb.or([eb('album.ownerId', '=', userId), eb('user.id', '=', userId)]))
.where('album.deletedAt', 'is', null)
.execute()
Expand Down
Loading