Skip to content
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

User Story 4 #4

Open
SVinnik99 opened this issue Jan 5, 2024 · 1 comment
Open

User Story 4 #4

SVinnik99 opened this issue Jan 5, 2024 · 1 comment

Comments

@SVinnik99
Copy link
Owner

No description provided.

@SVinnik99 SVinnik99 converted this from a draft issue Jan 5, 2024
@SVinnik99
Copy link
Owner Author

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

  1. 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
  2. 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.
  3. 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
  4. 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.
  5. 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.

@SVinnik99 SVinnik99 moved this from Todo to In Progress in @SVinnik99's Thinkful Capstone Jan 12, 2024
@SVinnik99 SVinnik99 moved this from In Progress to Done in @SVinnik99's Thinkful Capstone Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant