mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-29 00:36:22 +02:00
Improved inline edit feature
This commit is contained in:
parent
10c035e359
commit
0eeb4866f4
10 changed files with 65 additions and 21 deletions
|
@ -13,7 +13,7 @@ exports.create = function(req, res){
|
|||
exports.show = function(req, res, next){
|
||||
Event.findById(req.params.id, function(err, event){
|
||||
if (err) return handleError(res, err);
|
||||
if (!event) return res.status(404);
|
||||
if (!event) return res.status(404).end();
|
||||
return res.json(event);
|
||||
});
|
||||
}
|
||||
|
@ -39,6 +39,23 @@ exports.createParticipant = function(req, res, next){
|
|||
});
|
||||
}
|
||||
|
||||
exports.updateParticipant = function(req, res, next){
|
||||
var eventId = req.params.id;
|
||||
var participantId = req.params.pid;
|
||||
Event.update({
|
||||
'_id' : eventId,
|
||||
'participants._id': participantId
|
||||
}, {
|
||||
'$set': {
|
||||
'updated' : Date.now(),
|
||||
'participants.$' : req.body
|
||||
}
|
||||
}, function(err, num){
|
||||
if (err) return next(err);
|
||||
res.status(204).end();
|
||||
});
|
||||
}
|
||||
|
||||
exports.deleteParticipant = function(req, res, next){
|
||||
var eventId = req.params.id;
|
||||
var participantId = req.params.pid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue