From 1191978d50a566f16ae7d4adc40c238fa0b99e25 Mon Sep 17 00:00:00 2001 From: Mert <101130780+mertalev@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:42:55 -0400 Subject: [PATCH] fix(server): library refresh not checking trashed assets (#10495) * set `withDeleted` * update sql --- server/src/queries/asset.repository.sql | 10 ++-------- server/src/repositories/asset.repository.ts | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/server/src/queries/asset.repository.sql b/server/src/queries/asset.repository.sql index 6968a2b8f5..29d98b9c6f 100644 --- a/server/src/queries/asset.repository.sql +++ b/server/src/queries/asset.repository.sql @@ -320,17 +320,11 @@ FROM FROM "assets" "AssetEntity" LEFT JOIN "libraries" "AssetEntity__AssetEntity_library" ON "AssetEntity__AssetEntity_library"."id" = "AssetEntity"."libraryId" - AND ( - "AssetEntity__AssetEntity_library"."deletedAt" IS NULL - ) WHERE ( - ( - ((("AssetEntity__AssetEntity_library"."id" = $1))) - AND ("AssetEntity"."originalPath" = $2) - ) + ((("AssetEntity__AssetEntity_library"."id" = $1))) + AND ("AssetEntity"."originalPath" = $2) ) - AND ("AssetEntity"."deletedAt" IS NULL) ) "distinctAlias" ORDER BY "AssetEntity_id" ASC diff --git a/server/src/repositories/asset.repository.ts b/server/src/repositories/asset.repository.ts index ee7a97004a..358d7e2bbf 100644 --- a/server/src/repositories/asset.repository.ts +++ b/server/src/repositories/asset.repository.ts @@ -188,7 +188,8 @@ export class AssetRepository implements IAssetRepository { @GenerateSql({ params: [DummyValue.UUID, DummyValue.STRING] }) getByLibraryIdAndOriginalPath(libraryId: string, originalPath: string): Promise { return this.repository.findOne({ - where: { library: { id: libraryId }, originalPath: originalPath }, + where: { library: { id: libraryId }, originalPath }, + withDeleted: true, }); }