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:
Alex 2025-05-06 12:12:48 -05:00 committed by GitHub
parent 016d7a6ceb
commit d33ce13561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
90 changed files with 1137 additions and 867 deletions

View file

@ -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