forked from aloofcaterpillars/aloofcaterpillars
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapiRoutes.js
23 lines (22 loc) · 11.4 KB
/
apiRoutes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//| URL | Method | Why? | Request | Response Data | Codes |
//|:--------------------------------:|:------:|----------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|------------------------------------------|
//| '/boorish/users/' -- not use | GET | Retrieve a user | user decoded from token | { username: String, foodTokens: Number, displayName: String } | 200, OK 404, Not found |
//| '/boorish/users' | POST | Create a new user | { username: String, password: String, displayName: String } | { authToken: String } | 200, OK 403, Forbidden |
//| '/boorish/users/' | DELETE | Remove a user from the database | user decoded from token and { password: String } | | 200, OK 401, Unauthorized |
//| '/boorish/users/signin' | POST | User signs in | { username: String, password: String } | { username: String, displayName: String, authToken: String } | 200, OK 401, Unauthorized |
//| '/boorish/users/signedin' | GET | Check user authorization | No data | Status Code | 200, OK 401, Unauthorized |
//| | | | | | |
//| '/boorish/meals' | GET | Retrieve all available meals | No data | { meal_id: String, imgUrl: String, description: String, title: String, ingredients: Array, creator: String, consumers: Array, date_available: Number, portions: Number, tags: Array, feedback: Array , overall: Number } | 200, OK |
//| '/boorish/meals' | POST | Add a new meal to the database | { description: String, title: String, ingredients: Array, creator: String, date_available: Number, portions: Number, tags: Array } | { imgUrl: String } | 200, OK 401, Unauthorized |
//| '/boorish/meals/:id' | PUT | Edit a meal | params.mid (meal) { imgUrl: String, description: String, title: String, ingredients: Array, creator: String, date_available: Number, portions: Number, tags: Array } | No data | 200, OK 401, Unauthorized |
//| '/boorish/meals/:id' | DELETE | Delete a meal from the database | params.mid (meal) | No data | 200, OK 404, Not found |
//| | | | | | |
//| '/boorish/meals/users/' | GET | Get all meals where a user is a creator or eater | | { user_id: String, created: { current: Array, past: Array }, eating: { current: Array, past: Array } } | 200, OK |
//| '/boorish/meals/users/:id' | POST | Add a meal to a user's list | params.mid (meal) and user decoded from token | No data | 200, OK 404, Not found |
//| '/boorish/meals/users/:id' | PUT | Remove a meal from a user's current list | params.mid (meal) and user decoded from token | No data | 200, OK 404, Not found |
//| | | | | | |
//| '/boorish/feedback/meals/:id' | GET | Retrieve the feedback from a specific meal | params.mid (meal) | { meal_id: String, ratingOne: Number, ratingTwo: Number, ratingThree: Number, overall: Number } | 200, OK 404, Not found |
//| '/boorish/feedback/meals/:id' | POST | Give feedback on a meal | params.mid (meal) and { user_eater: String, ratingOne: Number, ratingTwo: Number, ratingThree: Number } | No data | 200, OK 404, Not found |
//| | | | | | |
//| '/boorish/tags/' | GET | Retrieve all meal tags | No data | { tags: Array } | 200, OK |
//| | | | | | |