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

TE update README.md #234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ The table below describes the folders in this starter repository:

This starter code closely follows the best practices and patterns established in the Robust Server Structure module.

**Note**: Please do not submit a pull request to this repository with your solution.
_**Note**: Please do not submit a pull request to this repository with your solution._

### Backend Existing files
### Backend existing files

The `./back-end` folder contains all the code for the backend project.

Expand All @@ -46,7 +46,7 @@ The table below describes the existing files in the `./back-end` folder:
| `./back-end/test` | A folder that contains all of the integration tests. You will not need to make changes to the files in this folder. |
| `./back-end/vercel.json` | A vercel deployment configuration file. You will not need to make changes to this file. |

### Frontend Existing files
### Frontend existing files

The `./front-end` folder contains all the code for the frontend project.

Expand Down Expand Up @@ -111,7 +111,7 @@ Have a look at the following examples:

Whenever possible, frontend tests will run before backend tests to help you follow outside-in development.

> **Note** When running `npm run test:X` If the frontend tests fail, the tests will stop before running the backend tests. Remember, you can always run `npm run test:X:backend` or `npm run test:X:frontend` to target a specific part of the application.
> **Note:** When running `npm run test:X` If the frontend tests fail, the tests will stop before running the backend tests. Remember, you can always run `npm run test:X:backend` or `npm run test:X:frontend` to target a specific part of the application.

Since tests take time to run, you might want to consider running only the tests for the user story you're working on at any given time.

Expand Down Expand Up @@ -154,11 +154,11 @@ Although the user stories do not say anything about deployment, you should consi

### US-01 Create and list reservations

As a restaurant manager<br/>
As a restaurant manager,<br/>
I want to create a new reservation when a customer calls<br/>
so that I know how many customers will arrive at the restaurant on a given day.

#### Acceptance Criteria
#### Acceptance criteria

1. The `/reservations/new` page will
- have the following required and not-nullable fields:
Expand All @@ -178,19 +178,19 @@ so that I know how many customers will arrive at the restaurant on a given day.
1. The `/reservations` API will have the same validations as above and will return 400, along with an informative error message, when a validation error happens.
- seed the reservations table with the data contained in `./back-end/src/db/seeds/00-reservations.json`

> **Hint** Dates and times in JavaScript and databases can be challenging.
> **Hint:** Dates and times in JavaScript and databases can be challenging.
>
> The users have confirmed that they will be using Chrome to access the site. This means you can use `<input type="date" />` and `<input type="time" />`, which are supported by Chrome but may not work in other browsers.
>
> `<input type="date" />` will store the date in `YYYY-MM-DD` format. This is a format that works well with the PostgreSQL `date` data type.
>
> `<input type="time" />` will store the time in `HH:MM:SS` format. This is a format that works well with the PostgreSQL `time` data type.
>
> **Optional** If you want to add support to other browsers such as Safari or IE, you can use the pattern and placeholder attributes along with the date and time inputs in your form. For the date input you can use `<input type="date" placeholder="YYYY-MM-DD" pattern="\d{4}-\d{2}-\d{2}"/>`, and for the time input you can use `<input type="time" placeholder="HH:MM" pattern="[0-9]{2}:[0-9]{2}"/>`. You can read more about handling browser support [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#handling_browser_support).
> **Optional:** If you want to add support to other browsers such as Safari or IE, you can use the pattern and placeholder attributes along with the date and time inputs in your form. For the date input you can use `<input type="date" placeholder="YYYY-MM-DD" pattern="\d{4}-\d{2}-\d{2}"/>`, and for the time input you can use `<input type="time" placeholder="HH:MM" pattern="[0-9]{2}:[0-9]{2}"/>`. You can read more about handling browser support [here](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#handling_browser_support).
>
> You can assume that all dates and times will be in your local time zone.

> **Hint** In the backend code, be sure to wrap any async controller functions in an `asyncErrorBoundary` call to ensure errors in async code are property handled.
> **Hint:** In the backend code, be sure to wrap any async controller functions in an `asyncErrorBoundary` call to ensure errors in async code are property handled.

In `back-end/src/errors/asyncErrorBoundary.js`

Expand Down Expand Up @@ -220,9 +220,9 @@ module.exports = {
}
```

### US-02 Create reservation on a future, working date
### US-02 Create reservation on a future working date

As a restaurant manager<br/>
As a restaurant manager,<br/>
I only want to allow reservations to be created on a day when we are open<br/>
so that users do not accidentally create a reservation for days when we are closed.<br/>

Expand All @@ -233,7 +233,7 @@ so that users do not accidentally create a reservation for days when we are clos
- The reservation date is in the past. Only future reservations are allowed.
1. The `/reservations` API will have the same validations as above and will return 400, along with an informative error message, when a validation error happens.

> **Hint** There may be more than one validation error on the page at time.
> **Hint:** There may be more than one validation error on the page at time.
>
> For example, a reservation in the past on a Tuesday violates both rules, so the page should display two errors within a single `className="alert alert-danger"`
>
Expand All @@ -246,8 +246,8 @@ so that users do not accidentally create a reservation for days when we are clos

### US-03 Create reservation within eligible timeframe

As a restaurant manager<br/>
I only want to allow reservations to be created during business hours, up to 60 minutes before closing<br/>
As a restaurant manager,<br/>
I only want to allow reservations to be created during business hours, up to 60 minutes before closing,<br/>
so that users do not accidentally create a reservation for a time we cannot accommodate.

#### Acceptance criteria
Expand All @@ -258,16 +258,16 @@ so that users do not accidentally create a reservation for a time we cannot acco
- The reservation date and time combination is in the past. Only future reservations are allowed. E.g., if it is noon, only allow reservations starting _after_ noon today.
1. The `/reservations` API will have the same validations as above and will return 400, along with an informative error message, when a validation error happens.

> **Hint** Parsing a Date that includes the time in JavaScript can be tricky. Again, keep an eye out for which time zone is being used for your Dates.
> **Hint:** Parsing a Date that includes the time in JavaScript can be tricky. Again, keep an eye out for which time zone is being used for your Dates.

### US-04 Seat reservation

As a restaurant manager, <br/>
When a customer with an existing reservation arrives at the restaurant<br/>
When a customer with an existing reservation arrives at the restaurant,<br/>
I want to seat (assign) their reservation to a specific table<br/>
so that I know which tables are occupied and free.
so that I know which tables are occupied or free.

#### Acceptance Criteria
#### Acceptance criteria

1. The `/tables/new` page will
- have the following required and not-nullable fields:
Expand Down Expand Up @@ -300,35 +300,35 @@ so that I know which tables are occupied and free.
- 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:** 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:** 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.
> **Hint:** Add a `reservation_id` column in the `tables` table. Use the `.references()` and `inTable()` knex functions to add the foreign key reference.

### US-05 Finish an occupied table

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

#### Acceptance Criteria
#### 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.
> **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
### US-06 Reservation status

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

#### Acceptance Criteria
#### Acceptance criteria

1. The `/dashboard` page will
- display the status of the reservation. The default status is "booked"
Expand All @@ -338,17 +338,17 @@ so that I can see which reservation parties are seated, and finished reservation
- 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. Please note that this is only tested in the back-end for now.

> **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:** 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()`](http://knexjs.org/#Transactions) to make sure the `tables` and `reservations` records are always in sync with each other.
> **Hint:** Use [`Knex.transaction()`](http://knexjs.org/#Transactions) to make sure the `tables` and `reservations` records are always in sync with each other.

### US-07 Search for a reservation by phone number

As a restaurant manager<br/>
As a restaurant manager,<br/>
I want to search for a reservation by phone number (partial or complete)<br/>
so that I can quickly access a customer's reservation when they call about their reservation.<br/>

#### Acceptance Criteria
#### Acceptance criteria

1. The `/search` page will
- Display a search box `<input name="mobile_number" />` that displays the placeholder text: "Enter a customer's phone number"
Expand All @@ -358,7 +358,7 @@ so that I can quickly access a customer's reservation when they call about their
- the search page will display all reservations matching the phone number, regardless of status.
- display `No reservations found` if there are no records found after clicking the Find button.

> **Hint** To search for a partial or complete phone number, you should ignore all formatting and search only for the digits.
> **Hint:** To search for a partial or complete phone number, you should ignore all formatting and search only for the digits.
> You will need to remove any non-numeric characters from the submitted mobile number and also use the PostgreSQL translate function.
>
> The following function will perform the correct search.
Expand All @@ -376,11 +376,11 @@ so that I can quickly access a customer's reservation when they call about their

### US-08 Change an existing reservation

As a restaurant manager<br/>
As a restaurant manager,<br/>
I want to be able to modify a reservation if a customer calls to change or cancel their reservation<br/>
so that reservations are accurate and current.

#### Acceptance Criteria
#### Acceptance criteria

1. The `/dashboard` and the `/search` page will
- Display an "Edit" button next to each reservation
Expand All @@ -397,4 +397,4 @@ so that reservations are accurate and current.
- Clicking the "Submit" button will save the reservation, then displays the previous page.
- Clicking "Cancel" makes no changes, then display the previous page.

> **Hint** The same validation used for create applies to editing a reservation. The form and the API for updating a reservation must not allow the user to violate any of the rules specified when creating a reservation.
> **Hint:** The same validation used for create applies to editing a reservation. The form and the API for updating a reservation must not allow the user to violate any of the rules specified when creating a reservation.
Loading