mirror of
https://github.com/immich-app/immich.git
synced 2025-12-26 23:00:38 -05:00
* feat: plugins * feat: table definition * feat: type and migration * feat: add repositories * feat: validate manifest with class-validator and load manifest info to database * feat: workflow/plugin controller/service layer * feat: implement workflow logic * feat: make trigger static * feat: dynamical instantiate plugin instances * fix: access control and helper script * feat: it works * chore: simplify * refactor: refactor and use queue for workflow execution * refactor: remove unsused property in plugin-schema * build wasm in prod * feat: plugin loader in transaction * fix: docker build arm64 * generated files * shell check * fix tests * fix: waiting for migration to finish before loading plugin * remove context reassignment * feat: use mise to manage extism tools (#23760) * pr feedback * refactor: create workflow now including create filters and actions * feat: workflow medium tests * fix: broken medium test * feat: medium tests * chore: unify workflow job * sign user id with jwt * chore: query plugin with filters and action * chore: read manifest in repository * chore: load manifest from server configs * merge main * feat: endpoint documentation * pr feedback * load plugin from absolute path * refactor:handle trigger * throw error and return early * pr feedback * unify plugin services * fix: plugins code * clean up * remove triggerConfig * clean up * displayName and methodName --------- Co-authored-by: Jason Rasmussen <jason@rasm.me> Co-authored-by: bo0tzz <git@bo0tzz.me>
255 lines
5.6 KiB
SQL
255 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 "album" on "activity"."albumId" = "album"."id"
|
|
and "album"."deletedAt" is null
|
|
where
|
|
"activity"."id" in ($1)
|
|
and "album"."ownerId" = $2::uuid
|
|
|
|
-- 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"
|
|
and "user"."deletedAt" is null
|
|
where
|
|
"album"."id" in ($1)
|
|
and "album"."isActivityEnabled" = $2
|
|
and (
|
|
"album"."ownerId" = $3
|
|
or "user"."id" = $4
|
|
)
|
|
and "album"."deletedAt" is null
|
|
|
|
-- AccessRepository.album.checkOwnerAccess
|
|
select
|
|
"album"."id"
|
|
from
|
|
"album"
|
|
where
|
|
"album"."id" in ($1)
|
|
and "album"."ownerId" = $2
|
|
and "album"."deletedAt" is null
|
|
|
|
-- AccessRepository.album.checkSharedAlbumAccess
|
|
select
|
|
"album"."id"
|
|
from
|
|
"album"
|
|
left join "album_user" on "album_user"."albumId" = "album"."id"
|
|
left join "user" on "user"."id" = "album_user"."userId"
|
|
and "user"."deletedAt" is null
|
|
where
|
|
"album"."id" in ($1)
|
|
and "album"."deletedAt" is null
|
|
and "user"."id" = $2
|
|
and "album_user"."role" in ($3, $4)
|
|
|
|
-- AccessRepository.album.checkSharedLinkAccess
|
|
select
|
|
"shared_link"."albumId"
|
|
from
|
|
"shared_link"
|
|
where
|
|
"shared_link"."id" = $1
|
|
and "shared_link"."albumId" in ($2)
|
|
|
|
-- AccessRepository.asset.checkAlbumAccess
|
|
with
|
|
"target" as (
|
|
select
|
|
array[$1]::uuid[] as "ids"
|
|
)
|
|
select
|
|
"asset"."id",
|
|
"asset"."livePhotoVideoId"
|
|
from
|
|
"album"
|
|
inner join "album_asset" as "albumAssets" on "album"."id" = "albumAssets"."albumId"
|
|
inner join "asset" on "asset"."id" = "albumAssets"."assetId"
|
|
and "asset"."deletedAt" is null
|
|
left join "album_user" as "albumUsers" on "albumUsers"."albumId" = "album"."id"
|
|
left join "user" on "user"."id" = "albumUsers"."userId"
|
|
and "user"."deletedAt" is null
|
|
cross join "target"
|
|
where
|
|
(
|
|
"asset"."id" = any (target.ids)
|
|
or "asset"."livePhotoVideoId" = any (target.ids)
|
|
)
|
|
and (
|
|
"album"."ownerId" = $2
|
|
or "user"."id" = $3
|
|
)
|
|
and "album"."deletedAt" is null
|
|
|
|
-- AccessRepository.asset.checkOwnerAccess
|
|
select
|
|
"asset"."id"
|
|
from
|
|
"asset"
|
|
where
|
|
"asset"."id" in ($1)
|
|
and "asset"."ownerId" = $2
|
|
and "asset"."visibility" != $3
|
|
|
|
-- AccessRepository.asset.checkPartnerAccess
|
|
select
|
|
"asset"."id"
|
|
from
|
|
"partner"
|
|
inner join "user" as "sharedBy" on "sharedBy"."id" = "partner"."sharedById"
|
|
and "sharedBy"."deletedAt" is null
|
|
inner join "asset" on "asset"."ownerId" = "sharedBy"."id"
|
|
and "asset"."deletedAt" is null
|
|
where
|
|
"partner"."sharedWithId" = $1
|
|
and (
|
|
"asset"."visibility" = 'timeline'
|
|
or "asset"."visibility" = 'hidden'
|
|
)
|
|
and "asset"."id" in ($2)
|
|
|
|
-- AccessRepository.asset.checkSharedLinkAccess
|
|
select
|
|
"asset"."id" as "assetId",
|
|
"asset"."livePhotoVideoId" as "assetLivePhotoVideoId",
|
|
"albumAssets"."id" as "albumAssetId",
|
|
"albumAssets"."livePhotoVideoId" as "albumAssetLivePhotoVideoId"
|
|
from
|
|
"shared_link"
|
|
left join "album" on "album"."id" = "shared_link"."albumId"
|
|
and "album"."deletedAt" is null
|
|
left join "shared_link_asset" on "shared_link_asset"."sharedLinkId" = "shared_link"."id"
|
|
left join "asset" on "asset"."id" = "shared_link_asset"."assetId"
|
|
and "asset"."deletedAt" is null
|
|
left join "album_asset" on "album_asset"."albumId" = "album"."id"
|
|
left join "asset" as "albumAssets" on "albumAssets"."id" = "album_asset"."assetId"
|
|
and "albumAssets"."deletedAt" is null
|
|
where
|
|
"shared_link"."id" = $1
|
|
and array[
|
|
"asset"."id",
|
|
"asset"."livePhotoVideoId",
|
|
"albumAssets"."id",
|
|
"albumAssets"."livePhotoVideoId"
|
|
] && array[$2]::uuid[]
|
|
|
|
-- AccessRepository.authDevice.checkOwnerAccess
|
|
select
|
|
"session"."id"
|
|
from
|
|
"session"
|
|
where
|
|
"session"."userId" = $1
|
|
and "session"."id" in ($2)
|
|
|
|
-- AccessRepository.memory.checkOwnerAccess
|
|
select
|
|
"memory"."id"
|
|
from
|
|
"memory"
|
|
where
|
|
"memory"."id" in ($1)
|
|
and "memory"."ownerId" = $2
|
|
and "memory"."deletedAt" is null
|
|
|
|
-- AccessRepository.notification.checkOwnerAccess
|
|
select
|
|
"notification"."id"
|
|
from
|
|
"notification"
|
|
where
|
|
"notification"."id" in ($1)
|
|
and "notification"."userId" = $2
|
|
|
|
-- AccessRepository.person.checkOwnerAccess
|
|
select
|
|
"person"."id"
|
|
from
|
|
"person"
|
|
where
|
|
"person"."id" in ($1)
|
|
and "person"."ownerId" = $2
|
|
|
|
-- AccessRepository.person.checkFaceOwnerAccess
|
|
select
|
|
"asset_face"."id"
|
|
from
|
|
"asset_face"
|
|
left join "asset" on "asset"."id" = "asset_face"."assetId"
|
|
and "asset"."deletedAt" is null
|
|
where
|
|
"asset_face"."id" in ($1)
|
|
and "asset"."ownerId" = $2
|
|
|
|
-- AccessRepository.partner.checkUpdateAccess
|
|
select
|
|
"partner"."sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"partner"."sharedById" in ($1)
|
|
and "partner"."sharedWithId" = $2
|
|
|
|
-- AccessRepository.session.checkOwnerAccess
|
|
select
|
|
"session"."id"
|
|
from
|
|
"session"
|
|
where
|
|
"session"."id" in ($1)
|
|
and "session"."userId" = $2
|
|
|
|
-- AccessRepository.stack.checkOwnerAccess
|
|
select
|
|
"stack"."id"
|
|
from
|
|
"stack"
|
|
where
|
|
"stack"."id" in ($1)
|
|
and "stack"."ownerId" = $2
|
|
|
|
-- AccessRepository.tag.checkOwnerAccess
|
|
select
|
|
"tag"."id"
|
|
from
|
|
"tag"
|
|
where
|
|
"tag"."id" in ($1)
|
|
and "tag"."userId" = $2
|
|
|
|
-- AccessRepository.timeline.checkPartnerAccess
|
|
select
|
|
"partner"."sharedById"
|
|
from
|
|
"partner"
|
|
where
|
|
"partner"."sharedById" in ($1)
|
|
and "partner"."sharedWithId" = $2
|
|
|
|
-- AccessRepository.workflow.checkOwnerAccess
|
|
select
|
|
"workflow"."id"
|
|
from
|
|
"workflow"
|
|
where
|
|
"workflow"."id" in ($1)
|
|
and "workflow"."ownerId" = $2
|