Open HARISH-1222 opened 6 months ago
Hi @Mayank2808sharma I hope you are doing well
closes: #20
I completed the task
Schema Changes
Code Changes
create train
when the admin create the train schema they also need to give the compartments data Request :
{ "train_name":"Train_1", "source":"Chennai", "destination" : "Coimbatore", "compartments" : [{ "name":"T-1-C-1", "total_seats":10 },{ "name":"T-1-C-2", "total_seats":5 }] }
Response :
update train
Admin can able to add new compartments in for a train
request :
```json { "additionalCompartments":[{ "name":"T-1-C-3", "total_seats":10 },{ "name":"T-1-C-4", "total_seats":15 }] } ```
{ "message": "Train and compartments updated successfully.", "train": { "id": 1, "train_name": "train_1", "source": "chennai", "destination": "coimbatore", "createdAt": "2024-05-14T09:56:31.994Z", "updatedAt": "2024-05-14T09:56:31.994Z", "Compartments": [ { "id": 1, "compartment_name": "T-1-C-1", "createdAt": "2024-05-14T09:56:31.999Z", "updatedAt": "2024-05-14T09:56:31.999Z", "TrainId": 1 }, { "id": 2, "compartment_name": "T-1-C-2", "createdAt": "2024-05-14T09:56:32.000Z", "updatedAt": "2024-05-14T09:56:32.000Z", "TrainId": 1 }, { "id": 3, "compartment_name": "T-1-C-3", "createdAt": "2024-05-14T09:58:16.161Z", "updatedAt": "2024-05-14T09:58:16.161Z", "TrainId": 1 }, { "id": 4, "compartment_name": "T-1-C-4", "createdAt": "2024-05-14T09:58:16.161Z", "updatedAt": "2024-05-14T09:58:16.161Z", "TrainId": 1 } ] } }
Ticket Booking :
the use can book the ticket based on the compartment like how the real IRCTC is
And clear the edge case like
Request :
{ "train_id":1, "no_of_seats":2 }
{ [ { "status": "Booked", "train_id": 1, "train_name": "train_1", "seat_id": 3, "seat_no": "T-1-C-1_3" }, { "status": "Booked", "train_id": 1, "train_name": "train_1", "seat_id": 4, "seat_no": "T-1-C-1_4" } ] }
If there is no Enough seats
{ "train_id":1, "no_of_seats":50 }
{ "message": "Seat not available" }
Booked Ticket details :
Request : details?booking_id=17
{ "bookingId": 17, "bookingTime": "2024-05-14T11:20:13.571Z", "trainName": "train_1", "source": "chennai", "destination": "coimbatore", "username": "harish_admin", "seatNos": [ "T-1-C-3_2", "T-1-C-3_2" ] }
Hi @Mayank2808sharma it's seems like the conflict in package.json
it's because I use nodemon, and sequelize cli
so just ignore it :smiley:
Hi @Mayank2808sharma I hope you are doing well
closes: #20
I completed the task
Schema Changes
Code Changes
create train
when the admin create the train schema they also need to give the compartments data Request :
Response :
update train
Admin can able to add new compartments in for a train
request :
Response :
Ticket Booking :
the use can book the ticket based on the compartment like how the real IRCTC is
And clear the edge case like
Request :
Response :
If there is no Enough seats
Request :
Response :
Booked Ticket details :
Request :
details?booking_id=17
Response :