-
Notifications
You must be signed in to change notification settings - Fork 0
Server
Install Java 21 from Oracle based on your OS.
Install the Database you want to use MySQL and the connector MySQL Connector.
Set up the database configuration from here
Setup the configuration file as outlined in configuration
To run the application, execute the command ./gradlew bootRun
Create a file src/main/resources/application.properties
This has configuration based off of Spring. An example configuration exists in src/main/resources/application.example.properties.
-
server.portthe port to host on (default 8080). -
spring.jpa.hibernate.ddl-autois how the program will manage the database during setup and shutdown. Docs -
spring.datasource.urlis where the database is stored via HTTP. Docs -
spring.datasource.driver-class-nameis the driver for the database. Docs
For unit and integration tests, create a file src/test/resources/application.properties. This has similar configuration, but with a different database that is in memory.
All APIs are in JSON format and can be accessed by managers. All, except for login, require a query with a token t.
GET login: logs into the server.
- Takes query
unamefor the username - Takes query
passwdfor the password - Returns a String for the token.
GET logout: logs out of the server.
GET getDetails: gets the worker's details.
- Returns WorkerDetails
GET items: Gets the items on the menu.
- Returns
{ items: [Item] }Item
GET waiter/order: gets all the orders for the waiter.
- Returns
{ orders: [WorkerOrder] }. WorkerOrder
GET waiter/tables: gets all the tables in the restaurant.
- Returns
{ tables: [ Table ]}. Table
POST waiter/addOrder: adds an order to be cooked.
- Takes a body of
{ items: [ int ], tableId: int }, where each int is the id of the item on the menu. - Returns int
orderId.
POST waiter/completeOrder: marks an order as delivered.
- Takes a body of
int, which is the orderId to complete. - Returns Boolean.
POST waiter/orderDone: marks an order as completed.
- Takes a body of
int, which is the orderId to complete. - Returns Boolean.
POST waiter/cancelOrder: marks an order as canceled.
- Takes a body of
int, which is the orderId to cancel. - Returns Boolean.
GET cook/getOrders: gets all the orders to cook.
- Returns
{ orders: [ Order ] }. Order
POST cook/setStatus: sets the status of the order (Only Cooked, InProgress, and Ordered).
- Takes a body of
Status - Returns Boolean
POST cook/itemDepleted marks an item as not in stock.
POST cook/itemRestocked marks an item as in stock.
POST manager/createWorker creates a new worker.
- Body: Worker
POST manager/deleteWorker deletes a worker.
- Body: Integer for worker's id.
POST manager/addItem creates a new item.
- Body: Item
POST manager/deleteItem deletes an item.
- Body: Integer for item's id.
- Returns boolean
POST manager/changeItem changes an item's values.
- Body:
{ id: int, details: item}. Item
POST manager/setTable sets a table's information.
- Body: Table
GET manager/workers gets all the workers.
- Returns `{ workers: [Worker] }. Worker
Websocket Endpoint: /websocket
To subscribe to a websocket, connect to /websocket and subscribe to /{broker}/{path}.
/message/{worker_id}: Fires whenever a manager sends a message to a worker with id worker_id.
- Returns a String in the form of
{manager} said: {message}.
/order/{waiter_id}: For waiters. Fires whenever an order that the waiter has placed is done.
- Returns a String in the form of
{order_id} {table_number}.
{
"id": "int",
"items": ["Items"],
"timeOrdered": "Date (or long)",
"status": "Status",
"totalPrice": "int"
}{
"items": ["Items"],
"timeOrdered": ["long"],
"status": "Status",
"id": "int"
}{
"firstName": "String",
"lastName": "String",
"age": "int",
"job": "Job",
"username": "String",
"password": "String",
"tableIds": { ["int"] }
}{
"name": "String",
"description": "String",
"price": "int (in cents)",
"inStock": "boolean",
"type:" "ItemType"
}{
"id": "int",
"name": "String",
"description": "String",
"type": "ItemType",
"price": "int (in cents)",
"inStock": "boolean"
}{
"id": "int",
"number": "number",
"waiter": {
"firstName": "String",
"lastName": "String",
"id": "int"
},
"isOccupied": "boolean",
"numSeats": "int",
"x": "int",
"y": "int"
}{
"x": "int",
"y": "int",
"waiter": "int",
"number": "int",
"numSeats": "int",
"isOccupied": "boolean",
"isActive": "boolean"
}{
"id": "int",
"firstName": "String",
"lastName": "String",
"age": "int",
"job": "Job"
}Cooked, Ordered, InProgress, Delivered, Completed, Canceled
Food, Beverage
Waiter, Host, Cook, Manager
- Table
- denotes information for table number
- must include information of table availability and a unique identifier for each table
- this table can be viewed by the hostess position of a restaurant, as well as the manager
- orders associated with each Table are given the table id as part of the foreign key