Reservation System - a2n-seattle/rms-app GitHub Wiki
Field | Value |
---|---|
Milestone: | Milestone |
Owner: | Johnny Chen, Russell Nyarko |
Contributors: | Johnny Chen, Russell Nyarko |
Reviewer: | Jeremy Yau |
Status: | In Progress |
Why?
As a user
I want to reserve an item beforehand
So that other people won't take the item unknowingly.
What?
Right now, there’s no way for users to reserve items ahead of time, potentially leading to items being unavailable when they are needed. We want to create a reservation system by creating a new scheduling schema and associated APIs, so that the frontend can call the APIs and the user can access a scheduling feature
We want the frontend to be able to do CRUD operations for this new scheduling table as well, so will have associated APIs for each. We will prioritize implementing CRD operations.
How?
Task Breakdown
-
Create TypeScript Schedule Schema (<Link to Task 1 Issue>)
- Add schedule table to TypeScript schema. It should have the following fields:
- Unique ID for each Reservation: ID!
- Who's reserving it (email): String!
- What they're trying to reserve (ID of each item): [String!]!
- Reservation start date time: AWSDateTime!
- Reservation end date time: AWSDateTime!
- Optional reservation message: String
- Make associated
ScheduleTable.ts
Class (SeeItemsTable.ts
orHistoryTable.ts
for example)
- Add schedule table to TypeScript schema. It should have the following fields:
-
Implement GraphQL Schema and Support Read Operations via DataStore
- Translate the TypeScript Schema to GraphQL
- We should support "Get reservation by ID" and "Get whole table" queries via DataStore
-
Implement the
CreateReservation
API (For each step, throw an error if the check fails)- The function should accept fields corresponding to all schema fields, except reservationID which is autogenerated here
- Implement the sms router function
- The input format for the items the user wants to borrow will be a comma separated list of itemID's for all items they want to borrow
- Be very explicit about the reservation start and end date-time format when prompting the user for it
- Set up field validations to make sure email, DateTime is properly formatted
- make email validation loose. Just make sure it's there (non-empty)
- Date time format will be a string in day-month-year-hour:minute format. Day and month should be two digit numbers. Hour in 24-hour format (i.e. 8pm is 20:00)
- Create a check if the reservation for each item can be made. That is, no other reservations for each item during the time range given
- Check for items. Fail message should list what items are not available and what times they are reserved for
- Generate random reservation ID (figure out a good way to do this. Can reuse generate random ID code). Check if generated reservation ID is unique
- Put all data into Schedule table. Update “schedule” array in associated Items table entry
- If the reservation was successful, return the reservation ID to the user
- See
AddItem.ts
for examples
-
Implement the
DeleteReservation
API- The function should accept the reservationID
- Implement the sms router function
- Check if the ID is valid. That is, it corresponds to an actual reservation row in the table
- Get reservation using ID. Get item associated with reservationID from schedule table, remove reservationID from “schedule” array in associated Items table entry
- Delete the row from the schedule table using ID
- See
DeleteItem.ts
for example
- See
-
Implement the
GetReservation
API -
Implement the
UpdateReservation
API
Acceptance Criteria
Scenario | Expected Response |
---|---|
When valid input fields are passed into ReserveItem |
Will successfully add entry to Schedule Table & update Items table |
When DataStore is queried |
Will return whole Schedule Table, or reservation by ID |
When valid reservationID is passed into DeleteReservation |
Will successfully delete entry from Schedule Table & update Items table |
These scenarios should be written up as tests, using the following naming convention:
'will <have expected response> when <a certain input is given>'