-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequests.js
36 lines (33 loc) · 1.15 KB
/
requests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
this.index = function (req, res) {
res.send('Go me!');
};
this.getMeeting = function (req, res) {
var meetingId = req.params.id
req.models.meeting.get(meetingId, function (err, meeting) {
meeting.getUsers(function (err, users) {
for (var i = 0; i < users.length; i++) {
var user = {};
user.name = users[i].username;
user.email = users[i].email;
users[i] = user;
}
meeting.users = users;
meeting.getProposedTimes(function (err, proposedTimes) {
for (var i = 0; i < proposedTimes.length; i++) {
var proposedTime = {};
proposedTime.start = proposedTimes[i].start.valueOf();
proposedTime.end = proposedTimes[i].end.valueOf();
proposedTimes[i] = proposedTime
}
meeting.proposedTimes = proposedTimes;
res.json(meeting);
});
});
});
};
this.createMeeting = function (req, res) {
console.log(req.body);
};
this.acceptTimes = function (req, res) {
console.log(req.body);
};