mirror of
https://github.com/immich-app/immich.git
synced 2025-06-23 15:30:51 -04:00
237 lines
5.6 KiB
SQL
237 lines
5.6 KiB
SQL
-- NOTE: This file is auto generated by ./sql-generator
|
|
|
|
-- AccessRepository.activity.checkOwnerAccess
|
|
select
|
|
"activity"."id"
|
|
from
|
|
"activity"
|
|
where
|
|
"activity"."id" in ($1)
|
|
and "activity"."userId" = $2
|
|
|
|
-- AccessRepository.activity.checkAlbumOwnerAccess
|
|
select
|
|
"activity"."id"
|
|
from
|
|
"activity"
|
|
left join "albums" on "activity"."albumId" = "albums"."id"
|
|
and "albums"."deletedAt" is null
|
|
where
|
|
"activity"."id" in ($1)
|
|
and "albums"."ownerId" = $2::uuid
|
|
|
|
-- AccessRepository.activity.checkCreateAccess
|
|
select
|
|
"albums"."id"
|
|
from
|
|
"albums"
|
|
left join "albums_shared_users_users" as "albumUsers" on "albumUsers"."albumsId" = "albums"."id"
|
|
left join "users" on "users"."id" = "albumUsers"."usersId"
|
|
and "users"."deletedAt" is null
|
|
where
|
|
"albums"."id" in ($1)
|
|
and "albums"."isActivityEnabled" = $2
|
|
and (
|
|
"albums"."ownerId" = $3
|
|
or "users"."id" = $4
|
|
)
|
|
and "albums"."deletedAt" is null
|
|
|
|
-- AccessRepository.album.checkOwnerAccess
|
|
select
|
|
"albums"."id"
|
|
from
|
|
"albums"
|
|
where
|
|
"albums"."id" in ($1)
|
|
and "albums"."ownerId" = $2
|
|
and "albums"."deletedAt" is null
|
|
|
|
-- AccessRepository.album.checkSharedAlbumAccess
|
|
select
|
|
"albums"."id"
|
|
from
|
|
"albums"
|
|
left join "albums_shared_users_users" as "albumUsers" on "albumUsers"."albumsId" = "albums"."id"
|
|
left join "users" on "users"."id" = "albumUsers"."usersId"
|
|
and "users"."deletedAt" is null
|
|
where
|
|
"albums"."id" in ($1)
|
|
and "albums"."deletedAt" is null
|
|
and "users"."id" = $2
|
|
and "albumUsers"."role" in ($3, $4)
|
|
|
|
-- AccessRepository.album.checkSharedLinkAccess
|
|
select
|
|
"shared_links"."albumId"
|
|
from
|
|
"shared_links"
|
|
where
|
|
"shared_links"."id" = $1
|
|
and "shared_links"."albumId" in ($2)
|
|
|
|
-- AccessRepository.asset.checkAlbumAccess
|
|
select
|
|
"assets"."id",
|
|
"assets"."livePhotoVideoId"
|
|
from
|
|
"albums"
|
|
inner join "albums_assets_assets" as "albumAssets" on "albums"."id" = "albumAssets"."albumsId"
|
|
inner join "assets" on "assets"."id" = "albumAssets"."assetsId"
|
|
and "assets"."deletedAt" is null
|
|
left join "albums_shared_users_users" as "albumUsers" on "albumUsers"."albumsId" = "albums"."id"
|
|
left join "users" on "users"."id" = "albumUsers"."usersId"
|
|
and "users"."deletedAt" is null
|
|
where
|
|
array["assets"."id", "assets"."livePhotoVideoId"] && array[$1]::uuid[]
|
|
and (
|
|
"albums"."ownerId" = $2
|
|
or "users"."id" = $3
|
|
)
|
|
and "albums"."deletedAt" is null
|
|
|
|
-- AccessRepository.asset.checkOwnerAccess
|
|
select
|
|
"assets"."id"
|
|
from
|
|
"assets"
|
|
where
|
|
"assets"."id" in ($1)
|
|
and "assets"."ownerId" = $2
|
|
and "assets"."visibility" != $3
|
|
|
|
-- AccessRepository.asset.checkPartnerAccess
|
|
select
|
|
"assets"."id"
|
|
from
|
|
"partners" as "partner"
|
|
inner join "users" as "sharedBy" on "sharedBy"."id" = "partner"."sharedById"
|
|
and "sharedBy"."deletedAt" is null
|
|
inner join "assets" on "assets"."ownerId" = "sharedBy"."id"
|
|
and "assets"."deletedAt" is null
|
|
where
|
|
"partner"."sharedWithId" = $1
|
|
and (
|
|
"assets"."visibility" = 'timeline'
|
|
or "assets"."visibility" = 'hidden'
|
|
)
|
|
and "assets"."id" in ($2)
|
|
|
|
-- AccessRepository.asset.checkSharedLinkAccess
|
|
select
|
|
"assets"."id" as "assetId",
|
|
"assets"."livePhotoVideoId" as "assetLivePhotoVideoId",
|
|
"albumAssets"."id" as "albumAssetId",
|
|
"albumAssets"."livePhotoVideoId" as "albumAssetLivePhotoVideoId"
|
|
from
|
|
"shared_links"
|
|
left join "albums" on "albums"."id" = "shared_links"."albumId"
|
|
and "albums"."deletedAt" is null
|
|
left join "shared_link__asset" on "shared_link__asset"."sharedLinksId" = "shared_links"."id"
|
|
left join "assets" on "assets"."id" = "shared_link__asset"."assetsId"
|
|
and "assets"."deletedAt" is null
|
|
left join "albums_assets_assets" on "albums_assets_assets"."albumsId" = "albums"."id"
|
|
left join "assets" as "albumAssets" on "albumAssets"."id" = "albums_assets_assets"."assetsId"
|
|
and "albumAssets"."deletedAt" is null
|
|
where
|
|
"shared_links"."id" = $1
|
|
and array[
|
|
"assets"."id",
|
|
"assets"."livePhotoVideoId",
|
|
"albumAssets"."id",
|
|
"albumAssets"."livePhotoVideoId"
|
|
] && array[$2]::uuid[]
|
|
|
|
-- AccessRepository.authDevice.checkOwnerAccess
|
|
select
|
|
"sessions"."id"
|
|
from
|
|
"sessions"
|
|
where
|
|
"sessions"."userId" = $1
|
|
and "sessions"."id" in ($2)
|
|
|
|
-- AccessRepository.memory.checkOwnerAccess
|
|
select
|
|
"memories"."id"
|
|
from
|
|
"memories"
|
|
where
|
|
"memories"."id" in ($1)
|
|
and "memories"."ownerId" = $2
|
|
and "memories"."deletedAt" is null
|
|
|
|
-- AccessRepository.notification.checkOwnerAccess
|
|
select
|
|
"notifications"."id"
|
|
from
|
|
"notifications"
|
|
where
|
|
"notifications"."id" in ($1)
|
|
and "notifications"."userId" = $2
|
|
|
|
-- AccessRepository.person.checkOwnerAccess
|
|
select
|
|
"person"."id"
|
|
from
|
|
"person"
|
|
where
|
|
"person"."id" in ($1)
|
|
and "person"."ownerId" = $2
|
|
|
|
-- AccessRepository.person.checkFaceOwnerAccess
|
|
select
|
|
"asset_faces"."id"
|
|
from
|
|
"asset_faces"
|
|
left join "assets" on "assets"."id" = "asset_faces"."assetId"
|
|
and "assets"."deletedAt" is null
|
|
where
|
|
"asset_faces"."id" in ($1)
|
|
and "assets"."ownerId" = $2
|
|
|
|
-- AccessRepository.partner.checkUpdateAccess
|
|
select
|
|
"partners"."sharedById"
|
|
from
|
|
"partners"
|
|
where
|
|
"partners"."sharedById" in ($1)
|
|
and "partners"."sharedWithId" = $2
|
|
|
|
-- AccessRepository.session.checkOwnerAccess
|
|
select
|
|
"sessions"."id"
|
|
from
|
|
"sessions"
|
|
where
|
|
"sessions"."id" in ($1)
|
|
and "sessions"."userId" = $2
|
|
|
|
-- AccessRepository.stack.checkOwnerAccess
|
|
select
|
|
"stacks"."id"
|
|
from
|
|
"asset_stack" as "stacks"
|
|
where
|
|
"stacks"."id" in ($1)
|
|
and "stacks"."ownerId" = $2
|
|
|
|
-- AccessRepository.tag.checkOwnerAccess
|
|
select
|
|
"tags"."id"
|
|
from
|
|
"tags"
|
|
where
|
|
"tags"."id" in ($1)
|
|
and "tags"."userId" = $2
|
|
|
|
-- AccessRepository.timeline.checkPartnerAccess
|
|
select
|
|
"partners"."sharedById"
|
|
from
|
|
"partners"
|
|
where
|
|
"partners"."sharedById" in ($1)
|
|
and "partners"."sharedWithId" = $2
|