-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookings.js
106 lines (80 loc) · 2.23 KB
/
bookings.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const express = require ('express');
const router = express.Router();
//const {Pool} = require('pg');
//book a seat on a trip
router.post('/',(req, res) => {
res.status(200).json({
message: 'successful'
});
//console.log('post body', req.body) ;
//const sql = 'INSERT INTO bus (number_plate,manufacturer,model) values ($1,$2,$3)'
//const params = [req.body.number_plate, req.body.manufacturer,req.body.model];
//return pool.query(sql, params);
//})
//.then((result) => {
// console.log('results?', result);
//res.redirect('/');
// });
});
/*.then((result) => {
console.log('results?', result);
});
});*/
//get bookings view all bookings
router.get('/',(req, res) =>{
res.status(200).send({
status : 'success',
message : 'seeing all bookings',
data :{
/* booking_id: 4657,
user_id:65,
trip_id:76,
bus_id:857,
trip_date:24/05/2019,
seat_number: 75,
first_name: hyacinth,
last_name:afam,
email:westwizo,*/
}
//username : req.params.signupId
}) ;
});
//to get a particual seat
router.get('/:bookingId',(req, res) => {
res.status(200).send({
//const bookings {}
status : 'success',
message : 'delte successful',
bookingId : req.params.bookingId
});
//username : req.params.signupId
});
//to get a particular seat
router.put('/:bookingId',(req, res) =>{
res.status(200).send({
status : 'success',
message : 'update successful',
data :{
/* booking_id: 4657,
user_id:65,
trip_id:76,
bus_id:857,
trip_date:24/05/2019,
seat_number: 75,
first_name: hyacinth,
last_name:afam,
email:westwizo,*/
}
//username : req.params.signupId
}) ;
});
//to delete booking
router.delete('/:deleteId',(req, res) => {
res.status(200).send({
status : 'success',
message : 'delete successful',
deleteId : req.params.deleteId
});
//username : req.params.signupId
});
module.exports = router;