This documentation provides an overview of the available routes and data models for the Host and Toast Application.
In this section, you will find detailed information about the different routes available in the API. The API offers a variety of routes to work with user, meal and rating documents. Each route is associated with a specific HTTP verb and URL, allowing you to perform CRUD (Create, Read, Update, and Delete) actions on the data.
| HTTP verb | URL | Request body | Action |
|---|---|---|---|
| POST | /auth/signup |
JSON | Creates a new user |
| POST | /auth/login |
JSON | Logges the user in and generates JWT Token |
| GET | /auth/verify |
(empty) | Verifies the users JWT token, which is sent in the headers |
| GET | /auth/users |
(empty) | Returns all the users in JSON format |
| GET | /auth/user/:userId |
(empty) | Returns the specified user by id |
| PUT | /auth/user/:userId |
JSON | Updates the specified user by id |
| DELETE | /auth/user/:userId |
(empty) | Deletes the specified user by id |
| GET | /auth/users/rating/:userId |
(empty) | Get the average rating for the user |
| HTTP verb | URL | Request body | Action |
| --------- | ---------------------------- | ------------ | ---------------------------------------------------------- |
| POST | /auth/signup |
JSON | Creates a new user |
| POST | /auth/login |
JSON | Logges the user in and generates JWT Token |
| GET | /auth/verify |
(empty) | Verifies the users JWT token, which is sent in the headers |
| GET | /auth/users |
(empty) | Returns all the users in JSON format |
| GET | /auth/users/:userId |
(empty) | Returns the specified user by id |
| PUT | /auth/users/:userId |
JSON | Updates the specified user by id |
| DELETE | /auth/users/:userId |
(empty) | Deletes the specified user by id |
| HTTP verb | URL | Request body | Action |
|---|---|---|---|
| GET | /api/addresses |
(empty) | Returns all the addresses in JSON format |
| GET | /api/addresses/:addressId |
(empty) | Returns the specified address by id |
| POST | /api/addresses/users/:userId |
JSON | Creates a new address and adds the reference to the user object |
| PUT | /api/addresses/:addressId |
JSON | Updates the specified address by id |
| DELETE | /api/addresses/:addressId |
(empty) | Deletes the specified address by id |
| HTTP verb | URL | Request body | Action |
|---|---|---|---|
| GET | /api/meals |
(empty) | Returns all the meals in JSON format |
| GET | /api/meals/:mealId |
(empty) | Returns the specified meal by id |
| GET | /api/meals/user/:userId |
(empty) | Returns all the meals of a specified user in JSON format |
| POST | /api/meals |
JSON | Creates a new meal with its respective user id |
| PUT | /api/meals/:mealId |
JSON | Updates the specified meal by id |
| DELETE | /api/meals/:mealId |
(empty) | Deletes the specified meal by id |
| HTTP verb | URL | Request body | Action |
|---|---|---|---|
| GET | /api/ratings |
(empty) | Returns all the ratings in JSON format |
| GET | /api/ratings/:ratingId |
(empty) | Returns the specified meal by id |
| GET | /api/ratings/meals/:mealId |
(empty) | Returns all the ratings of a specified meal in JSON format |
| POST | /api/ratings |
JSON | Creates a new rating with its respective meal id |
| PUT | /api/ratings/:ratingId |
JSON | Updates the specified rating by id |
| DELETE | /api/ratings/:ratingId |
(empty) | Deletes the specified rating by id |
| HTTP verb | URL | Request body | Action |
|---|---|---|---|
| GET | /api/orders |
(empty) | Returns all the orders in JSON format |
| GET | /api/orders/:orderId |
(empty) | Returns the specified order by id |
| GET | /api/orders/user/:userId |
(empty) | Returns all the orders of a specified user in JSON format |
| GET | /api/orders/chef-stats/:userId |
(empty) | Returns all the orders states of a specified user in JSON format |
| POST | /api/orders |
JSON | Creates a new order w.r.t user id & meal id. Updates the meal Model for leftover plates |
| PUT | /api/orders/:orderId |
JSON | Updates the specified order by id |
| DELETE | /api/orders/:orderId |
(empty) | Deletes the specified order by id |
| HTTP verb | URL | Request body | Action |
|---|---|---|---|
| POST | /api/multiple-uploads |
JSON | Uploads imgs on Cloudinary and return the URL |
The Models section holds information about the data models for your database. It outlines the structure of the documents in the database, providing you with a clear understanding of how your data should be organized.
| field | data type | description |
|---|---|---|
username |
String |
Unique identifier for the user. required. |
email |
String |
Email of the cohort. required. unique. |
password |
String |
Password of that user. encrypted. required. |
address |
ObjectId |
Reference to address. |
imageUrl |
String |
URL of profile image. |
description |
String |
Description of user. |
specialty |
String |
Specialty in cooking of user. |
| Field | Data Type | Description |
|---|---|---|
displayName |
String |
Display name coming from leaflet api. Required. |
long |
Number |
Longitude of Location. |
lat |
Number |
Latitude of Location |
| Field | Data Type | Description |
|---|---|---|
cuisine |
String |
Cuisine of meal. Required. |
title |
String |
Title of meal. Required. |
description |
String |
Description of meal. Required. |
allergies |
Array of Strings |
Array holding different values. |
plates |
Number |
Number of plates available. |
hosted |
Boolean |
Hosted or pickup. Required. |
completeMeal |
Boolean |
Complete meal or single ingredient. |
date |
Date |
Date for pickup/hosted. |
user |
ObjectId |
Reference to user. Required. |
imageUrl |
Array of Strings |
URL of image. |
price |
Number |
Price of the meal. |
| Field | Data Type | Description |
|---|---|---|
stars |
Number |
Rating of meal. Required. |
comment |
String |
Comment to rating. |
meal |
ObjectId |
Reference to rated meal. Required. |
user |
ObjectId |
Reference to user who rated the meal. Required. |
| Field | Data Type | Description |
|---|---|---|
meal |
String |
Reference to meal. Required. |
plates |
plates |
Number of plates ordered. Required. |
price |
Number |
Price of the order. |
user |
ObjectId |
Reference to user. Required. |
status |
String |
Status of the order ["FINISHED", "IN_PROGRESS"]. Required. |