feat(trash): NoteRepository.trash with pending_jobs cleanup (#4 v0.2.3)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user