mirror of
https://github.com/immich-app/immich.git
synced 2025-12-20 09:15:35 +03:00
fix(server): don't return archived assets by default (#7278)
* don't show archived results by default * fix e2e * generate sql * set default in dto --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@ class BaseSearchDto {
|
||||
isArchived?: boolean;
|
||||
|
||||
@QueryBoolean({ optional: true })
|
||||
@ApiProperty({ default: false })
|
||||
withArchived?: boolean;
|
||||
|
||||
@QueryBoolean({ optional: true })
|
||||
|
||||
@@ -183,7 +183,7 @@ export function searchAssetBuilder(
|
||||
_.omitBy(
|
||||
{
|
||||
...status,
|
||||
isArchived: isArchived ?? withArchived,
|
||||
isArchived: isArchived ?? (withArchived ? undefined : false),
|
||||
encodedVideoPath: isEncoded ? Not(IsNull()) : undefined,
|
||||
livePhotoVideoId: isMotion ? Not(IsNull()) : undefined,
|
||||
},
|
||||
|
||||
@@ -434,7 +434,7 @@ WHERE
|
||||
AND 1 = 1
|
||||
AND "asset"."ownerId" IN ($2)
|
||||
AND 1 = 1
|
||||
AND 1 = 1
|
||||
AND "asset"."isArchived" = $3
|
||||
)
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
ORDER BY
|
||||
|
||||
@@ -79,7 +79,10 @@ FROM
|
||||
AND "exifInfo"."lensModel" = $2
|
||||
AND 1 = 1
|
||||
AND 1 = 1
|
||||
AND "asset"."isFavorite" = $3
|
||||
AND (
|
||||
"asset"."isFavorite" = $3
|
||||
AND "asset"."isArchived" = $4
|
||||
)
|
||||
AND (
|
||||
"stack"."primaryAssetId" = "asset"."id"
|
||||
OR "asset"."stackId" IS NULL
|
||||
@@ -177,16 +180,19 @@ WHERE
|
||||
AND "exifInfo"."lensModel" = $2
|
||||
AND 1 = 1
|
||||
AND 1 = 1
|
||||
AND "asset"."isFavorite" = $3
|
||||
AND (
|
||||
"asset"."isFavorite" = $3
|
||||
AND "asset"."isArchived" = $4
|
||||
)
|
||||
AND (
|
||||
"stack"."primaryAssetId" = "asset"."id"
|
||||
OR "asset"."stackId" IS NULL
|
||||
)
|
||||
AND "asset"."ownerId" IN ($4)
|
||||
AND "asset"."ownerId" IN ($5)
|
||||
)
|
||||
AND ("asset"."deletedAt" IS NULL)
|
||||
ORDER BY
|
||||
"search"."embedding" <= > $5 ASC
|
||||
"search"."embedding" <= > $6 ASC
|
||||
LIMIT
|
||||
101
|
||||
COMMIT
|
||||
|
||||
Reference in New Issue
Block a user