feat: Update deleted notes query to include notes with empty body in trash

This commit is contained in:
2026-05-21 17:10:23 +02:00
parent 62d47904d9
commit 48d09fe170
+6 -4
View File
@@ -217,11 +217,13 @@ class AppDatabase extends _$AppDatabase {
} }
Future<List<DbNote>> getDeletedNotes() { Future<List<DbNote>> getDeletedNotes() {
// A note is considered deleted (in the trash) when `is_deleted` is true
// and at least one of `title` or `body` is not empty. Previously the
// query required both title AND body to be non-empty which excluded
// notes that had an empty body (common) from appearing in the trash.
return (select(notes)..where( return (select(notes)..where(
(n) => (n) => n.isDeleted.equals(true) &
n.isDeleted.equals(true) & (n.title.isNotValue('') | n.body.isNotValue('')),
n.title.isNotValue('') &
n.body.isNotValue(''),
)) ))
.get(); .get();
} }