Skip to content

Commit

Permalink
Merge pull request #52 from blank-project/dev
Browse files Browse the repository at this point in the history
1.0.0-beta.2
  • Loading branch information
erwanosouf authored Nov 10, 2017
2 parents b3aa30c + 4d1c1d1 commit 8abd91c
Show file tree
Hide file tree
Showing 48 changed files with 1,105 additions and 346 deletions.
28 changes: 28 additions & 0 deletions app/business/TagManager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var Tag = require('../models/Tag')
, Contact = require('../models/Contact')
, ObjectID = require('mongodb').ObjectID;


module.exports = class TagManager {

/**
* Deletes a Tag.
*/
delete(id) {
if (typeof id === "string") {
id = new ObjectID(id);
}
return Tag.findByIdAndRemove(id).exec()
.then(() => {
return Contact.update({
// Update contacts with deleted id.
tags : { _id : id }
}, {
$pull : { tags : id }
}, {
multi : true
}).exec();
});
}

}
Loading

0 comments on commit 8abd91c

Please sign in to comment.