add GET /api/v2/groups/{gid}/chat route (query)
This commit is contained in:
@@ -195,7 +195,9 @@ api.update = function(req, res, next) {
|
||||
}
|
||||
|
||||
api.attachGroup = function(req, res, next) {
|
||||
Group.findById(req.params.gid, function(err, group){
|
||||
var gid = req.params.gid;
|
||||
var q = (gid == 'party') ? Group.findOne({type: 'party', members: {'$in': [res.locals.user._id]}}) : Group.findById(gid);
|
||||
q.exec(function(err, group){
|
||||
if(err) return res.json(500, {err:err});
|
||||
if(!group) return res.json(404, {err: "Group not found"});
|
||||
res.locals.group = group;
|
||||
@@ -203,6 +205,10 @@ api.attachGroup = function(req, res, next) {
|
||||
})
|
||||
}
|
||||
|
||||
api.getChat = function(req, res, next) {
|
||||
return res.json(res.locals.group.chat);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO make this it's own ngResource so we don't have to send down group data with each chat post
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user