Skip to content

Commit

Permalink
feat: replace hard delete by soft delete
Browse files Browse the repository at this point in the history
delete documents by adding the special _delete key to the document
  • Loading branch information
stropitek committed Feb 16, 2018
1 parent f44d241 commit 1033951
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/couch/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ const methods = {

async deleteEntry(uuid, user) {
debug(`deleteEntry (${uuid}, ${user})`);
await this.getEntryWithRights(uuid, user, 'delete');
return nanoPromise.destroyDocument(this._db, uuid);
const entry = await this.getEntryWithRights(uuid, user, 'delete');
entry._deleted = true;
return nanoMethods.saveEntry(this._db, entry, user);
},

// Create entry if does not exist
Expand Down

0 comments on commit 1033951

Please sign in to comment.