As a restaurant manager,
When a customer with an existing reservation arrives at the restaurant
I want to seat (assign) their reservation to a specific table
so that I know which tables are occupied and free.
Acceptance Criteria
The /tables/new page will
have the following required and not-nullable fields:
Table name: <input name="table_name" />, which must be at least 2 characters long.
Capacity: <input name="capacity" />, this is the number of people that can be seated at the table, which must be at least 1 person.
display a Submit button that, when clicked, saves the new table then displays the /dashboard page
display a Cancel button that, when clicked, returns the user to the previous page
The /dashboard page will:
display a list of all reservations in one area.
each reservation in the list will:
Display a "Seat" button on each reservation.
The "Seat" button must be a link with an href attribute that equals /reservations/${reservation_id}/seat, so it can be found by the tests.
display a list of all tables, sorted by table_name, in another area of the dashboard
Each table will display "Free" or "Occupied" depending on whether a reservation is seated at the table.
The "Free" or "Occupied" text must have a data-table-id-status=${table.table_id} attribute, so it can be found by the tests.
The /reservations/:reservation_id/seat page will
have the following required and not-nullable fields:
Table number: <select name="table_id" />. The text of each option must be {table.table_name} - {table.capacity} so the tests can find the options.
do not seat a reservation with more people than the capacity of the table
display a Submit button that, when clicked, assigns the table to the reservation then displays the /dashboard page
PUT to /tables/:table_id/seat/ in order to save the table assignment. The body of the request must be { data: { reservation_id: x } } where X is the reservation_id of the reservation being seated. The tests do not check the body returned by this request.
display a Cancel button that, when clicked, returns the user to the previous page
The tables table must be seeded with the following data:
Bar #1 & Bar #2, each with a capacity of 1.
#1 & #2, each with a capacity of 6.
The /tables API will have the same validations as above and will return 400, along with an informative error message, when a validation error happens.
if the table capacity is less than the number of people in the reservation, return 400 with an error message.
if the table is occupied, return 400 with an error message.
Hint Work through the acceptance criteria in the order listed, step-by-step. A different order may be more challenging.
Hint Seed the tables table in a similar way as it's done with the reservations table.
Hint Add a reservation_id column in the tables table. Use the .references() and inTable() knex functions to add the foreign key reference.
US-04 Seat reservation
As a restaurant manager,
When a customer with an existing reservation arrives at the restaurant
I want to seat (assign) their reservation to a specific table
so that I know which tables are occupied and free.
Acceptance Criteria
The
/tables/new
page will<input name="table_name" />
, which must be at least 2 characters long.<input name="capacity" />
, this is the number of people that can be seated at the table, which must be at least 1 person.Submit
button that, when clicked, saves the new table then displays the/dashboard
pageCancel
button that, when clicked, returns the user to the previous pageThe
/dashboard
page will:href
attribute that equals/reservations/${reservation_id}/seat
, so it can be found by the tests.table_name
, in another area of the dashboarddata-table-id-status=${table.table_id}
attribute, so it can be found by the tests.The
/reservations/:reservation_id/seat
page will<select name="table_id" />
. The text of each option must be{table.table_name} - {table.capacity}
so the tests can find the options.Submit
button that, when clicked, assigns the table to the reservation then displays the/dashboard
page/tables/:table_id/seat/
in order to save the table assignment. The body of the request must be{ data: { reservation_id: x } }
where X is the reservation_id of the reservation being seated. The tests do not check the body returned by this request.Cancel
button that, when clicked, returns the user to the previous pageThe
tables
table must be seeded with the following data:Bar #1
&Bar #2
, each with a capacity of 1.#1

, each with a capacity of 6.The
/tables
API will have the same validations as above and will return 400, along with an informative error message, when a validation error happens.