Add endpoints for resolving and reopening threads

This commit is contained in:
James Allen
2017-01-04 14:58:08 +01:00
parent cb88e1e41b
commit 1ff920e1b5
9 changed files with 190 additions and 34 deletions
@@ -27,8 +27,29 @@ module.exports = ThreadManager =
project_id: ObjectId(project_id.toString())
thread_id: { $exists: true }
}, {
thread_id: 1
thread_id: 1,
resolved: 1
}, callback
resolveThread: (project_id, thread_id, user_id, callback = (error) ->) ->
db.rooms.update {
project_id: ObjectId(project_id.toString())
thread_id: ObjectId(thread_id.toString())
}, {
$set: {
resolved: {
user_id: user_id
ts: new Date()
}
}
}, callback
reopenThread: (project_id, thread_id, callback = (error) ->) ->
db.rooms.update {
project_id: ObjectId(project_id.toString())
thread_id: ObjectId(thread_id.toString())
}, {
$unset: {
resolved: true
}
}, callback