Perform the following commands in your Terminal
or Git Bash
git clone https://gitlab.com/benk9/cpen491.git backendServer
cd backendServer/backend
git checkout mobile-fake-sql
npm install
-
/GET
routes have hard-coded data -
/POST
and/PATCH
routes simplyconsole.log()
whatever the HTTP request body contained. -
/POST
endpoints also return anid
hardcoded to123
. You should save these ID on the mobile client as they represent your "key" to make/change future requests. -
If you attempt to hit any endpoint with an improperly formatted JSON payload in the body, or an improper URL parameter, it will reject it and tell you why in the HTTP response payload.
-
You can view all the available routes in
restaurant.controller.ts
and the hard-coded data insql-stored-procedure-fake.service.ts
.
Once the customer taps the NFC, you can start a session by performing a
/POST
to http://localhost:3001/restaurants/1/sessions
with the following payload
{
tableNumber: 85
}
Perform a /GET
to http://localhost:3001/restaurants/1/categories
Perform a /GET
to http://localhost:3001/restaurants/1/categories/1/products
- In this version of Fake SQL: Supplying a category ID between 1 and 10 returns different categories :) Any other ID will return an empty list
Perform a /GET
to http://localhost:3001/restaurants/1/categories/10/products/57/options
- Only product ID 57 return options, all other product ID will return empty list signifying there are no customizable options
Perform a /POST
to http://localhost:3001/restaurants/1/sessions/123/orders
with the following payload:
{
tableNumber: 85,
category: "MyCategory",
product: "MyProduct",
options: "",
finalProductPrice: 14.99,
comments: null
}
- Note: Ideally we should be submitting the IDs instead of the names for the
category
,product
,options
, and let the backend compute the actualfinalProductPrice
; but we're short on time so we'll blindly trust the mobile requests.
Perform a /POST
to http://localhost:3001/restaurants/1/waitlist
with the following payload:
{
phone: "604-123-4567",
name: "John Doe",
seatRequest: 3
}
Perform a /POST
to http://localhost:3001/restaurants/1/sessions/123/assist
with the following payload:
{
tableNumber: 85
}
Perform a /PATCH
to http://localhost:3001/restaurants/1/sessions/123/orders/123
with the following payload:
{
requestState: 2
}
Perform a /PATCH
to http://localhost:3001/restaurants/1/sessions/123/assist/123
with the following payload:
{
requestState: 2
}
Perform a /PATCH
to http://localhost:3001/restaurants/1/waitlist/123
with the following payload:
{
requestState: 2
}
Perform a /PATCH
to http://localhost:3001/restaurants/1/sessions/123
with the following payload:
{
sessionState: 1
}