mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 01:11:46 +03:00
feat(server): visibility column (#17939)
* feat: private view * pr feedback * sql generation * feat: visibility column * fix: set visibility value as the same as the still part after unlinked live photos * fix: test * pr feedback
This commit is contained in:
@@ -110,8 +110,11 @@ from
|
||||
and "assets"."deletedAt" is null
|
||||
where
|
||||
"partner"."sharedWithId" = $1
|
||||
and "assets"."isArchived" = $2
|
||||
and "assets"."id" in ($3)
|
||||
and (
|
||||
"assets"."visibility" = 'timeline'
|
||||
or "assets"."visibility" = 'hidden'
|
||||
)
|
||||
and "assets"."id" in ($2)
|
||||
|
||||
-- AccessRepository.asset.checkSharedLinkAccess
|
||||
select
|
||||
|
||||
@@ -7,7 +7,7 @@ select
|
||||
"ownerId",
|
||||
"duplicateId",
|
||||
"stackId",
|
||||
"isVisible",
|
||||
"visibility",
|
||||
"smart_search"."embedding",
|
||||
(
|
||||
select
|
||||
@@ -83,7 +83,7 @@ from
|
||||
inner join "asset_job_status" on "asset_job_status"."assetId" = "assets"."id"
|
||||
where
|
||||
"assets"."deletedAt" is null
|
||||
and "assets"."isVisible" = $1
|
||||
and "assets"."visibility" != $1
|
||||
and (
|
||||
"asset_job_status"."previewAt" is null
|
||||
or "asset_job_status"."thumbnailAt" is null
|
||||
@@ -118,7 +118,7 @@ where
|
||||
-- AssetJobRepository.getForGenerateThumbnailJob
|
||||
select
|
||||
"assets"."id",
|
||||
"assets"."isVisible",
|
||||
"assets"."visibility",
|
||||
"assets"."originalFileName",
|
||||
"assets"."originalPath",
|
||||
"assets"."ownerId",
|
||||
@@ -155,7 +155,7 @@ select
|
||||
"assets"."fileCreatedAt",
|
||||
"assets"."fileModifiedAt",
|
||||
"assets"."isExternal",
|
||||
"assets"."isVisible",
|
||||
"assets"."visibility",
|
||||
"assets"."libraryId",
|
||||
"assets"."livePhotoVideoId",
|
||||
"assets"."localDateTime",
|
||||
@@ -201,7 +201,7 @@ from
|
||||
"assets"
|
||||
inner join "asset_job_status" as "job_status" on "assetId" = "assets"."id"
|
||||
where
|
||||
"assets"."isVisible" = $1
|
||||
"assets"."visibility" != $1
|
||||
and "assets"."deletedAt" is null
|
||||
and "job_status"."previewAt" is not null
|
||||
and not exists (
|
||||
@@ -220,7 +220,7 @@ from
|
||||
"assets"
|
||||
inner join "asset_job_status" as "job_status" on "assetId" = "assets"."id"
|
||||
where
|
||||
"assets"."isVisible" = $1
|
||||
"assets"."visibility" != $1
|
||||
and "assets"."deletedAt" is null
|
||||
and "job_status"."previewAt" is not null
|
||||
and not exists (
|
||||
@@ -234,7 +234,7 @@ where
|
||||
-- AssetJobRepository.getForClipEncoding
|
||||
select
|
||||
"assets"."id",
|
||||
"assets"."isVisible",
|
||||
"assets"."visibility",
|
||||
(
|
||||
select
|
||||
coalesce(json_agg(agg), '[]')
|
||||
@@ -259,7 +259,7 @@ where
|
||||
-- AssetJobRepository.getForDetectFacesJob
|
||||
select
|
||||
"assets"."id",
|
||||
"assets"."isVisible",
|
||||
"assets"."visibility",
|
||||
to_json("exif") as "exifInfo",
|
||||
(
|
||||
select
|
||||
@@ -312,7 +312,7 @@ where
|
||||
-- AssetJobRepository.getForAssetDeletion
|
||||
select
|
||||
"assets"."id",
|
||||
"assets"."isVisible",
|
||||
"assets"."visibility",
|
||||
"assets"."libraryId",
|
||||
"assets"."ownerId",
|
||||
"assets"."livePhotoVideoId",
|
||||
@@ -372,7 +372,7 @@ from
|
||||
"assets" as "stacked"
|
||||
where
|
||||
"stacked"."deletedAt" is not null
|
||||
and "stacked"."isArchived" = $1
|
||||
and "stacked"."visibility" != $1
|
||||
and "stacked"."stackId" = "asset_stack"."id"
|
||||
group by
|
||||
"asset_stack"."id"
|
||||
@@ -391,7 +391,7 @@ where
|
||||
"assets"."encodedVideoPath" is null
|
||||
or "assets"."encodedVideoPath" = $2
|
||||
)
|
||||
and "assets"."isVisible" = $3
|
||||
and "assets"."visibility" != $3
|
||||
and "assets"."deletedAt" is null
|
||||
|
||||
-- AssetJobRepository.getForVideoConversion
|
||||
@@ -417,7 +417,7 @@ where
|
||||
"asset_job_status"."metadataExtractedAt" is null
|
||||
or "asset_job_status"."assetId" is null
|
||||
)
|
||||
and "assets"."isVisible" = $1
|
||||
and "assets"."visibility" != $1
|
||||
and "assets"."deletedAt" is null
|
||||
|
||||
-- AssetJobRepository.getForStorageTemplateJob
|
||||
@@ -480,7 +480,7 @@ where
|
||||
"assets"."sidecarPath" = $1
|
||||
or "assets"."sidecarPath" is null
|
||||
)
|
||||
and "assets"."isVisible" = $2
|
||||
and "assets"."visibility" != $2
|
||||
|
||||
-- AssetJobRepository.streamForDetectFacesJob
|
||||
select
|
||||
@@ -489,7 +489,7 @@ from
|
||||
"assets"
|
||||
inner join "asset_job_status" as "job_status" on "assetId" = "assets"."id"
|
||||
where
|
||||
"assets"."isVisible" = $1
|
||||
"assets"."visibility" != $1
|
||||
and "assets"."deletedAt" is null
|
||||
and "job_status"."previewAt" is not null
|
||||
and "job_status"."facesRecognizedAt" is null
|
||||
|
||||
@@ -43,21 +43,20 @@ with
|
||||
"asset_job_status"."previewAt" is not null
|
||||
and (assets."localDateTime" at time zone 'UTC')::date = today.date
|
||||
and "assets"."ownerId" = any ($3::uuid[])
|
||||
and "assets"."isVisible" = $4
|
||||
and "assets"."isArchived" = $5
|
||||
and "assets"."visibility" = $4
|
||||
and exists (
|
||||
select
|
||||
from
|
||||
"asset_files"
|
||||
where
|
||||
"assetId" = "assets"."id"
|
||||
and "asset_files"."type" = $6
|
||||
and "asset_files"."type" = $5
|
||||
)
|
||||
and "assets"."deletedAt" is null
|
||||
order by
|
||||
(assets."localDateTime" at time zone 'UTC')::date desc
|
||||
limit
|
||||
$7
|
||||
$6
|
||||
) as "a" on true
|
||||
inner join "exif" on "a"."id" = "exif"."assetId"
|
||||
)
|
||||
@@ -159,7 +158,7 @@ from
|
||||
where
|
||||
"ownerId" = $1::uuid
|
||||
and "deviceId" = $2
|
||||
and "isVisible" = $3
|
||||
and "visibility" != $3
|
||||
and "deletedAt" is null
|
||||
|
||||
-- AssetRepository.getLivePhotoCount
|
||||
@@ -241,7 +240,10 @@ with
|
||||
"assets"
|
||||
where
|
||||
"assets"."deletedAt" is null
|
||||
and "assets"."isVisible" = $2
|
||||
and (
|
||||
"assets"."visibility" = $2
|
||||
or "assets"."visibility" = $3
|
||||
)
|
||||
)
|
||||
select
|
||||
"timeBucket",
|
||||
@@ -271,7 +273,7 @@ from
|
||||
where
|
||||
"stacked"."stackId" = "asset_stack"."id"
|
||||
and "stacked"."deletedAt" is null
|
||||
and "stacked"."isArchived" = $1
|
||||
and "stacked"."visibility" != $1
|
||||
group by
|
||||
"asset_stack"."id"
|
||||
) as "stacked_assets" on "asset_stack"."id" is not null
|
||||
@@ -281,8 +283,11 @@ where
|
||||
or "assets"."stackId" is null
|
||||
)
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."isVisible" = $2
|
||||
and date_trunc($3, "localDateTime" at time zone 'UTC') at time zone 'UTC' = $4
|
||||
and (
|
||||
"assets"."visibility" = $2
|
||||
or "assets"."visibility" = $3
|
||||
)
|
||||
and date_trunc($4, "localDateTime" at time zone 'UTC') at time zone 'UTC' = $5
|
||||
order by
|
||||
"assets"."localDateTime" desc
|
||||
|
||||
@@ -307,7 +312,7 @@ with
|
||||
"assets"."ownerId" = $1::uuid
|
||||
and "assets"."duplicateId" is not null
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."isVisible" = $2
|
||||
and "assets"."visibility" != $2
|
||||
and "assets"."stackId" is null
|
||||
group by
|
||||
"assets"."duplicateId"
|
||||
@@ -365,12 +370,11 @@ from
|
||||
inner join "cities" on "exif"."city" = "cities"."city"
|
||||
where
|
||||
"ownerId" = $2::uuid
|
||||
and "isVisible" = $3
|
||||
and "isArchived" = $4
|
||||
and "type" = $5
|
||||
and "visibility" = $3
|
||||
and "type" = $4
|
||||
and "deletedAt" is null
|
||||
limit
|
||||
$6
|
||||
$5
|
||||
|
||||
-- AssetRepository.getAllForUserFullSync
|
||||
select
|
||||
@@ -394,7 +398,7 @@ from
|
||||
) as "stacked_assets" on "asset_stack"."id" is not null
|
||||
where
|
||||
"assets"."ownerId" = $1::uuid
|
||||
and "assets"."isVisible" = $2
|
||||
and "assets"."visibility" != $2
|
||||
and "assets"."updatedAt" <= $3
|
||||
and "assets"."id" > $4
|
||||
order by
|
||||
@@ -424,7 +428,7 @@ from
|
||||
) as "stacked_assets" on "asset_stack"."id" is not null
|
||||
where
|
||||
"assets"."ownerId" = any ($1::uuid[])
|
||||
and "assets"."isVisible" = $2
|
||||
and "assets"."visibility" != $2
|
||||
and "assets"."updatedAt" > $3
|
||||
limit
|
||||
$4
|
||||
|
||||
@@ -35,14 +35,14 @@ select
|
||||
where
|
||||
(
|
||||
"assets"."type" = $1
|
||||
and "assets"."isVisible" = $2
|
||||
and "assets"."visibility" != $2
|
||||
)
|
||||
) as "photos",
|
||||
count(*) filter (
|
||||
where
|
||||
(
|
||||
"assets"."type" = $3
|
||||
and "assets"."isVisible" = $4
|
||||
and "assets"."visibility" != $4
|
||||
)
|
||||
) as "videos",
|
||||
coalesce(sum("exif"."fileSizeInByte"), $5) as "usage"
|
||||
|
||||
@@ -14,7 +14,7 @@ from
|
||||
and "exif"."latitude" is not null
|
||||
and "exif"."longitude" is not null
|
||||
where
|
||||
"isVisible" = $1
|
||||
"assets"."visibility" = $1
|
||||
and "deletedAt" is null
|
||||
and (
|
||||
"ownerId" in ($2)
|
||||
|
||||
@@ -107,7 +107,7 @@ select
|
||||
(
|
||||
select
|
||||
"assets"."ownerId",
|
||||
"assets"."isArchived",
|
||||
"assets"."visibility",
|
||||
"assets"."fileCreatedAt"
|
||||
from
|
||||
"assets"
|
||||
@@ -203,7 +203,7 @@ from
|
||||
"asset_faces"
|
||||
left join "assets" on "assets"."id" = "asset_faces"."assetId"
|
||||
and "asset_faces"."personId" = $1
|
||||
and "assets"."isArchived" = $2
|
||||
and "assets"."visibility" != $2
|
||||
and "assets"."deletedAt" is null
|
||||
where
|
||||
"asset_faces"."deletedAt" is null
|
||||
@@ -220,7 +220,7 @@ from
|
||||
inner join "asset_faces" on "asset_faces"."personId" = "person"."id"
|
||||
inner join "assets" on "assets"."id" = "asset_faces"."assetId"
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."isArchived" = $2
|
||||
and "assets"."visibility" != $2
|
||||
where
|
||||
"person"."ownerId" = $3
|
||||
and "asset_faces"."deletedAt" is null
|
||||
|
||||
@@ -7,11 +7,11 @@ from
|
||||
"assets"
|
||||
inner join "exif" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"assets"."fileCreatedAt" >= $1
|
||||
and "exif"."lensModel" = $2
|
||||
and "assets"."ownerId" = any ($3::uuid[])
|
||||
and "assets"."isFavorite" = $4
|
||||
and "assets"."isArchived" = $5
|
||||
"assets"."visibility" = $1
|
||||
and "assets"."fileCreatedAt" >= $2
|
||||
and "exif"."lensModel" = $3
|
||||
and "assets"."ownerId" = any ($4::uuid[])
|
||||
and "assets"."isFavorite" = $5
|
||||
and "assets"."deletedAt" is null
|
||||
order by
|
||||
"assets"."fileCreatedAt" desc
|
||||
@@ -28,11 +28,11 @@ offset
|
||||
"assets"
|
||||
inner join "exif" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"assets"."fileCreatedAt" >= $1
|
||||
and "exif"."lensModel" = $2
|
||||
and "assets"."ownerId" = any ($3::uuid[])
|
||||
and "assets"."isFavorite" = $4
|
||||
and "assets"."isArchived" = $5
|
||||
"assets"."visibility" = $1
|
||||
and "assets"."fileCreatedAt" >= $2
|
||||
and "exif"."lensModel" = $3
|
||||
and "assets"."ownerId" = any ($4::uuid[])
|
||||
and "assets"."isFavorite" = $5
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."id" < $6
|
||||
order by
|
||||
@@ -48,11 +48,11 @@ union all
|
||||
"assets"
|
||||
inner join "exif" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"assets"."fileCreatedAt" >= $8
|
||||
and "exif"."lensModel" = $9
|
||||
and "assets"."ownerId" = any ($10::uuid[])
|
||||
and "assets"."isFavorite" = $11
|
||||
and "assets"."isArchived" = $12
|
||||
"assets"."visibility" = $8
|
||||
and "assets"."fileCreatedAt" >= $9
|
||||
and "exif"."lensModel" = $10
|
||||
and "assets"."ownerId" = any ($11::uuid[])
|
||||
and "assets"."isFavorite" = $12
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."id" > $13
|
||||
order by
|
||||
@@ -71,11 +71,11 @@ from
|
||||
inner join "exif" on "assets"."id" = "exif"."assetId"
|
||||
inner join "smart_search" on "assets"."id" = "smart_search"."assetId"
|
||||
where
|
||||
"assets"."fileCreatedAt" >= $1
|
||||
and "exif"."lensModel" = $2
|
||||
and "assets"."ownerId" = any ($3::uuid[])
|
||||
and "assets"."isFavorite" = $4
|
||||
and "assets"."isArchived" = $5
|
||||
"assets"."visibility" = $1
|
||||
and "assets"."fileCreatedAt" >= $2
|
||||
and "exif"."lensModel" = $3
|
||||
and "assets"."ownerId" = any ($4::uuid[])
|
||||
and "assets"."isFavorite" = $5
|
||||
and "assets"."deletedAt" is null
|
||||
order by
|
||||
smart_search.embedding <=> $6
|
||||
@@ -97,7 +97,7 @@ with
|
||||
where
|
||||
"assets"."ownerId" = any ($2::uuid[])
|
||||
and "assets"."deletedAt" is null
|
||||
and "assets"."isVisible" = $3
|
||||
and "assets"."visibility" != $3
|
||||
and "assets"."type" = $4
|
||||
and "assets"."id" != $5::uuid
|
||||
and "assets"."stackId" is null
|
||||
@@ -176,14 +176,13 @@ with recursive
|
||||
inner join "assets" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"assets"."ownerId" = any ($1::uuid[])
|
||||
and "assets"."isVisible" = $2
|
||||
and "assets"."isArchived" = $3
|
||||
and "assets"."type" = $4
|
||||
and "assets"."visibility" = $2
|
||||
and "assets"."type" = $3
|
||||
and "assets"."deletedAt" is null
|
||||
order by
|
||||
"city"
|
||||
limit
|
||||
$5
|
||||
$4
|
||||
)
|
||||
union all
|
||||
(
|
||||
@@ -200,16 +199,15 @@ with recursive
|
||||
"exif"
|
||||
inner join "assets" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"assets"."ownerId" = any ($6::uuid[])
|
||||
and "assets"."isVisible" = $7
|
||||
and "assets"."isArchived" = $8
|
||||
and "assets"."type" = $9
|
||||
"assets"."ownerId" = any ($5::uuid[])
|
||||
and "assets"."visibility" = $6
|
||||
and "assets"."type" = $7
|
||||
and "assets"."deletedAt" is null
|
||||
and "exif"."city" > "cte"."city"
|
||||
order by
|
||||
"city"
|
||||
limit
|
||||
$10
|
||||
$8
|
||||
) as "l" on true
|
||||
)
|
||||
)
|
||||
@@ -231,7 +229,7 @@ from
|
||||
inner join "assets" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"ownerId" = any ($1::uuid[])
|
||||
and "isVisible" = $2
|
||||
and "visibility" != $2
|
||||
and "deletedAt" is null
|
||||
and "state" is not null
|
||||
|
||||
@@ -243,7 +241,7 @@ from
|
||||
inner join "assets" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"ownerId" = any ($1::uuid[])
|
||||
and "isVisible" = $2
|
||||
and "visibility" != $2
|
||||
and "deletedAt" is null
|
||||
and "city" is not null
|
||||
|
||||
@@ -255,7 +253,7 @@ from
|
||||
inner join "assets" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"ownerId" = any ($1::uuid[])
|
||||
and "isVisible" = $2
|
||||
and "visibility" != $2
|
||||
and "deletedAt" is null
|
||||
and "make" is not null
|
||||
|
||||
@@ -267,6 +265,6 @@ from
|
||||
inner join "assets" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"ownerId" = any ($1::uuid[])
|
||||
and "isVisible" = $2
|
||||
and "visibility" != $2
|
||||
and "deletedAt" is null
|
||||
and "model" is not null
|
||||
|
||||
@@ -84,7 +84,7 @@ select
|
||||
"type",
|
||||
"deletedAt",
|
||||
"isFavorite",
|
||||
"isVisible",
|
||||
"visibility",
|
||||
"updateId"
|
||||
from
|
||||
"assets"
|
||||
@@ -106,7 +106,7 @@ select
|
||||
"type",
|
||||
"deletedAt",
|
||||
"isFavorite",
|
||||
"isVisible",
|
||||
"visibility",
|
||||
"updateId"
|
||||
from
|
||||
"assets"
|
||||
|
||||
@@ -285,14 +285,14 @@ select
|
||||
where
|
||||
(
|
||||
"assets"."type" = 'IMAGE'
|
||||
and "assets"."isVisible" = true
|
||||
and "assets"."visibility" != 'hidden'
|
||||
)
|
||||
) as "photos",
|
||||
count(*) filter (
|
||||
where
|
||||
(
|
||||
"assets"."type" = 'VIDEO'
|
||||
and "assets"."isVisible" = true
|
||||
and "assets"."visibility" != 'hidden'
|
||||
)
|
||||
) as "videos",
|
||||
coalesce(
|
||||
|
||||
@@ -7,8 +7,7 @@ from
|
||||
"assets"
|
||||
where
|
||||
"ownerId" = $2::uuid
|
||||
and "isVisible" = $3
|
||||
and "isArchived" = $4
|
||||
and "visibility" = $3
|
||||
and "deletedAt" is null
|
||||
and "fileCreatedAt" is not null
|
||||
and "fileModifiedAt" is not null
|
||||
@@ -23,13 +22,12 @@ from
|
||||
left join "exif" on "assets"."id" = "exif"."assetId"
|
||||
where
|
||||
"ownerId" = $1::uuid
|
||||
and "isVisible" = $2
|
||||
and "isArchived" = $3
|
||||
and "visibility" = $2
|
||||
and "deletedAt" is null
|
||||
and "fileCreatedAt" is not null
|
||||
and "fileModifiedAt" is not null
|
||||
and "localDateTime" is not null
|
||||
and "originalPath" like $4
|
||||
and "originalPath" not like $5
|
||||
and "originalPath" like $3
|
||||
and "originalPath" not like $4
|
||||
order by
|
||||
regexp_replace("assets"."originalPath", $6, $7) asc
|
||||
regexp_replace("assets"."originalPath", $5, $6) asc
|
||||
|
||||
Reference in New Issue
Block a user