feat(trash): NoteRepository.trash with pending_jobs cleanup (#4 v0.2.3)

This commit is contained in:
altair823
2026-05-01 20:38:17 +09:00
parent 3797e6c4f3
commit 13da554461
2 changed files with 41 additions and 0 deletions

View File

@@ -221,6 +221,16 @@ export class NoteRepository {
.run(date, now, id);
}
trash(id: string, deletedAt: string): void {
const tx = this.db.transaction(() => {
this.db
.prepare(`UPDATE notes SET deleted_at = ?, updated_at = ? WHERE id = ?`)
.run(deletedAt, deletedAt, id);
this.db.prepare(`DELETE FROM pending_jobs WHERE note_id = ?`).run(id);
});
tx();
}
delete(id: string): void {
this.db.prepare('DELETE FROM notes WHERE id=?').run(id);
}