Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update query to consider item in trash as non existent

Leendert de Borst85ad077834f1
diff --git a/core/client/src/database/queries/ItemQueries.ts b/core/client/src/database/queries/ItemQueries.ts
index e6ab1024d..8a27ce40e 100644
--- a/core/client/src/database/queries/ItemQueries.ts
+++ b/core/client/src/database/queries/ItemQueries.ts
@@ -91,7 +91,7 @@ export class ItemQueries {
/**
* Get a single item by its manifest-qualified key: an id alone does not identify a row, since the
- * same id can exist in two or more manifests.
+ * same id can exist in two or more manifests. Items in the trash count as not found.
*/
public static readonly GET_BY_ID = `
SELECT
@@ -113,7 +113,7 @@ export class ItemQueries {
i.ArchivedAt
FROM Items i
LEFT JOIN Logos l ON i.LogoId = l.Id AND l.ManifestId = i.ManifestId
- WHERE i.Id = ? AND i.ManifestId = ? AND i.IsDeleted = 0`;
+ WHERE i.Id = ? AND i.ManifestId = ? AND i.IsDeleted = 0 AND i.DeletedAt IS NULL`;
/**
* Count of recently deleted items.
diff --git a/core/client/src/database/repositories/ItemRepository.ts b/core/client/src/database/repositories/ItemRepository.ts
index 36d145953..eba86d122 100644
--- a/core/client/src/database/repositories/ItemRepository.ts
+++ b/core/client/src/database/repositories/ItemRepository.ts
@@ -204,7 +204,7 @@ export class ItemRepository extends BaseRepository {
/**
* Fetch a single item with its dynamic fields and tags.
* @param ref - The item, named by its manifest and id
- * @returns Item object or null if not found
+ * @returns Item object, or null if not found or in the trash
*/
public *getById(ref: ItemRef): DbOp<Item | null> {