lindseyindev / restaurant-reservations

0 stars 0 forks source link

User Story 05 Finish and Occupied Table #6

Open lindseyindev opened 2 years ago

lindseyindev commented 2 years ago

US-05 Finish an occupied table

As a restaurant manager I want to free up an occupied table when the guests leave so that I can seat new guests at that table.

Acceptance Criteria

  1. The /dashboard page will
    • Display a "Finish" button on each occupied table.
    • the "Finish" button must have a data-table-id-finish={table.table_id} attribute, so it can be found by the tests.
    • Clicking the "Finish" button will display the following confirmation: "Is this table ready to seat new guests? This cannot be undone." If the user selects "Ok" the system will: - Send a DELETE request to /tables/:table_id/seat in order to remove the table assignment. The tests do not check the body returned by this request. - The server should return 400 if the table is not occupied. - Refresh the list of tables to show that the table is now available.
    • Clicking the "Cancel" makes no changes.

Hint The end-to-end test waits for the tables list to be refreshed before checking the free/occupied status of the table, so be sure to send a GET request to /tables to refresh the tables list.

US-06 Reservation Status

As a restaurant manager
I want a reservation to have a status of either booked, seated, or finished
so that I can see which reservation parties are seated, and finished reservations are hidden from the dashboard.

Acceptance Criteria

  1. The /dashboard page will
    • display the status of the reservation. The default status is "booked"
      • the status text must have a data-reservation-id-status={reservation.reservation_id} attribute, so it can be found by the tests.
    • display the Seat button only when the reservation status is "booked".
    • clicking the Seat button changes the status to "seated" and hides the Seat button.
    • clicking the Finish button associated with the table changes the reservation status to "finished" and removes the reservation from the dashboard.
    • to set the status, PUT to /reservations/:reservation_id/status with a body of {data: { status: "<new-status>" } } where <new-status> is one of booked, seated, or finished

Hint You can add a field to a table in a migration up method by defining a new column. E.g. table.string("last_name", null).notNullable(); will create a new last_name column. Be sure to remove the column in the down function using dropColumn(). E.g. table.dropColumn("last_name"); Hint Use Knex.transaction() to make sure the tables and reservations records are always in sync with each other.