- Load Events
- Edit Events - When a field is updated: undate also memory list record - Duplicate Event
This commit is contained in:
@@ -7,6 +7,8 @@ const server_constants = require('../tools/server_constants');
|
||||
const { authenticate } = require('../middleware/authenticate');
|
||||
|
||||
const { Booking } = require('../models/booking');
|
||||
const { MyEvent } = require('../models/myevent');
|
||||
const { Operator } = require('../models/operator');
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
@@ -25,7 +27,7 @@ function sendNotif(res, idapp, user, recbooking) {
|
||||
}
|
||||
|
||||
router.post('/', authenticate, (req, res) => {
|
||||
tools.mylog('INIZIO - booking');
|
||||
// tools.mylog('INIZIO - booking');
|
||||
// tools.mylog('req.body', req.body);
|
||||
const myrec = _.pick(req.body, tools.allfieldBooking());
|
||||
const id = myrec._id;
|
||||
@@ -113,7 +115,16 @@ router.get('/:userId/:idapp/:sall', authenticate, (req, res) => {
|
||||
|
||||
// Extract all the todos of the userId only
|
||||
Booking.findAllByUserIdAndIdApp(userId, idapp, sall).then((bookedevent) => {
|
||||
res.send({ bookedevent });
|
||||
|
||||
return MyEvent.findAllIdApp(idapp)
|
||||
.then((eventlist) => {
|
||||
return Operator.findAllIdApp(idapp)
|
||||
.then((operators) => {
|
||||
|
||||
res.send({ bookedevent, eventlist, operators });
|
||||
})
|
||||
})
|
||||
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
res.status(400).send(e);
|
||||
|
||||
Reference in New Issue
Block a user