-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move logic to backend #6
base: master
Are you sure you want to change the base?
Conversation
index.js
Outdated
@@ -3,14 +3,24 @@ const cors = require('cors'); | |||
const bodyparser = require('body-parser'); | |||
const app = express(); | |||
|
|||
require('./database-connection'); | |||
require('./database-connection.js') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need .js in module names, please remove these.
checkin/src/store/index.js
Outdated
axios.post('http://localhost:3000/seat-plan', selectedSeat) | ||
.then((response) => { | ||
console.log(response.data) | ||
commit('SET_DATA', selectedSeat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this syntax is wrong — you have to pass in an object.
index.js
Outdated
res.send('hello') | ||
}) | ||
|
||
app.get('/seat-plan', (req, res, next) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove these handlers.
models/flight-model.js
Outdated
|
||
const flightSchema = mongoose.Schema({ | ||
seatPlan: { | ||
type: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure it's a string? what would be its value? I think a flight has N rows of 6 seats each, and you should track if any of the seats are empty or reserved, and their prices...
|
||
const FlightService = require('../services/flight-service.js') | ||
|
||
router.post('/seat-plan', async (req, res, next) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you should get the chosen seat id from the request, and modify the current flight accordingly — see if the user can actually reserve this seat.
so the method call should be FlightService.chooseSeat(req.body)
instead of a generic add
— we're not adding a flight seating plan, we're not the admin who are designing flights, we are customers who just want to book a predefined seat in the flight.
No description provided.