- Node.js v16.13.1 or above
1- Clone this repository from the main
branch.
2- In your preferred CLI do npm install
at the repository's root folder.
3- Do npm start
at the repository's root folder.
It should be ready when it prints out Listening to port 3001
.
Use this host: https://restobares-app-api.herokuapp.com/ then append to it any of the routes listed below.
Before you begin playing around with any table, check if someone is using it already. To check that, perform a GET to https://restobares-app-api.herokuapp.com/resto/:idResto/staff/tables. Get in contact with any of the colaborators to get a valid value for :idResto.
Before doing the request to the routes listed below in Staff or Admin side, you have to set the header "authorization" with the proper json web token pass as response in the route /login. So, you have to write in the authorization header "Bearer ${token}" its very important to let a space between Bearer and the token string.
If u want to skip the login process, you can use in the header authorization, a special token called "AdminSupremeTest".
Example: Bearer AdminSupremeTest
.
When doing anything that requires posting or putting an Image/Logo (example: POST /resto/:idResto/admin/menu), the Image now requires to be uploaded in the base64 format.
βββ Update: You can also pass the URL of an Image from the Internet.
For example:
// Example 1 (base64)
{
...
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K...",
...
}
// Example 2 (URL)
{
...
"image": "https://fake.image.url/123456.jpeg",
...
}
- GET /dev/users
- DELETE /dev/clear
- GET /resto/idResto/user
- GET /discounts
- GET /labels
- GET /categories
- POST /register
- GET /confirmation/:token
- POST /login
- POST /recover
- POST /logout
- GET /resto/:idResto/table/:idTable/order
- GET /resto/:userid/table/:idtable/menu
- GET /resto/:userid/table/:idtable/mp/:idStaff (Backend route only not Frontend)
- POST /resto/:idResto/table/:idTable/order
- PUT /resto/:idResto/table/:idTable/order
- POST /resto/:idResto/table/:idTable/payment
- POST /resto/:idResto/table/:idTable/feedback
- *POST /resto/:idResto/table/:idTable/filledTable
- GET /resto/:idResto/staff/menu
- PUT /resto/:idResto/staff/menu
- GET /resto/:idResto/staff/tables
- PUT /resto/:idResto/staff/tables
- DELETE /resto/:idResto/staff/tables
- GET /resto/:idResto/staff/orders
- GET /resto/:idResto/admin/account
- PUT /resto/:idResto/admin/account
- GET /resto/:idResto/admin/revenue
- GET /resto/:idResto/admin/menu
- POST /resto/:idResto/admin/menu
- PUT /resto/:idResto/admin/menu
- DELETE /resto/:idResto/admin/menu
- GET /resto/:idResto/admin/feedback
Request: Body
{
property: 'value',
otherProperty: 'otherValue',
}
Response: JSON
{
"property": "value",
"otherProperty": "otherValue"
}
Response: JSON
[
{
"id": "cc7fb1eb-4ca7-48a2-b6b8-d08b2bfca99b",
"title": "La Trufa Dorada"
},
{
"id": "2a7ab818-eeb9-4406-8dd6-81ff2547bc33",
"title": "Betos"
}
]
Request: Body
{
idResto: "d7u8974jk398e09812j3hjks82",
idTable: 1
}
Response: JSON
[
{
"id": "52b8f3ad-5ff6-4627-ace0-522c1a0f0d76",
"title": "La Trufa Dorada",
"logo": "https://i2.bssl.es/guiamaximin/2020/01/la-chistera-880x587.jpg"
}
]
Response: JSON
[
{
"id": 1,
"name": "ice cream"
},
{
"id": 2,
"name": "dinner"
},
{
"id": 3,
"name": "drink with alcohol"
},
{
"id": 4,
"name": "soft drink"
},
{
"id": 5,
"name": "pasta,
},
{
"id": 6,
"name": "fish and shellfish"
},
{
"id": 7,
"name": " woks"
},
{
"id": 8,
"name": "empanadas"
},
{
"id": 9,
"name": "lomitos"
},
{
"id": 10,
"name": "chicken"
},
{
"id": 11,
"name": "meat"
},
{
"id": 12,
"name": "fried"
}
]
Response: JSON
[
{
"id": 1,
"name": "starter"
},
{
"id": 2,
"name": "main course"
},
{
"id": 3,
"name": "dessert"
},
{
"id": 4,
"name": "drink"
}
]
Response: JSON
[
{
"id": 1,
"percentage": 50,
"factor": 2,
"max_discounts": 3
},
{
"id": 2,
"percentage": 50,
"factor": 3,
"max_discounts": 4
},
{
"id": 3,
"percentage": 75,
"factor": 1,
"max_discounts": 4
}
]
Request: Body
{
"email": "[email protected]",
"passAdmin": "abc123",
"passStaff": "xyz321",
"title": "Titulo de tu Restoran",
"tables": 8,
"logo": "https//:fakeimage.url.com/asdasdasd",
"paymentInfo": "78fgd89f79345uyhew908r"
}
Response: JSON
{
"msg": "Your account has been confirmed successfully."
}
Request: Body
{
"email": "elΓ±eroΓ±[email protected]",
"password" : "abc123"
}
Response: JSON
{
msg: `Welcome back, ${user.title}! You logged in as ${role}.`,
token: "fweofoiwneoifwef",
logoutCode: "[email protected]"
}
Request: Body
{
"email": '[email protected]'
}
Request: Body
{
"logoutCode": '[email protected]'
}
Response: JSON
{
tableId: 1,
state: 'waiting', // free, eating, waiting, pay_cash, pay_online
ordered: [
{ productName: 'Papas Fritas', productId: 23, quantity: 2, price: 200},
{ productName: 'Henieken', productId: 12, quantity: 2, price: 300},
... mas productos
],
totalPrice: 500.0,
tip: 50.0,
currentOrder: {
time: '2022-01-07T23:45:05.467Z',
products: [
{ productName: 'Brownie', quantity: 2, price: 300},
... mas productos
],
},
comments: 'las papas sin sal porfa'
}
Request: Body
{
products [
{ productName: 'Papas Fritas', productId: 23, quantity: 2, price: 200},
{ productName: 'Henieken', productId: 12, quantity: 2, price: 300},
],
comments: "Sin sal por favor."
}
Response: JSON
{ status: 200, msg: 'Te order has been taken.' }
Response: JSON
{
"msg": "The table 1 is calling the staff."
}
Response: Body
{
"msg": "the post was made correctly"
}
//ejemplo
{
{
"comment":"buenardo",
"rating": 5
}
}
Request: Body
{
"state" : "pay_cash",
"tip" : 0
}
Response: JSON
[
{
"id": 1,
"name": "Poke",
"price": "23.00",
"detail": "Sushi rice, cherry tomato, avocado, edamame, red onion, mango, salmon and tataki sauce",
"image": "",
"available": true,
"DiscountId": null,
"CategoryId": 2,
"UserId": "698b2498-0b10-46ce-9524-005449b5f966",
"Labels": [
2,
6,
7
]
},
{
"id": 2,
"name": "Cesar Salad",
"price": "10.00",
"detail": "Parmesan cheese, lemon juice, coddled egg, olive oil, romaine and croutons",
"image": "",
"available": true,
"DiscountId": 1,
"CategoryId": 2,
"UserId": "698b2498-0b10-46ce-9524-005449b5f966",
"Labels": [
2,
5
]
},
{
"id": 3,
"name": "Spaguetti with Meatballs",
"price": "13.00",
"detail": "Spaguetty with large and spicy meatballs",
"image": "",
"available": true,
"DiscountId": 2,
"CategoryId": 1,
"UserId": "698b2498-0b10-46ce-9524-005449b5f966",
"Labels": [
2,
11
]
}
]
Response: JSON
{
msg: "Payment Confirmed.", status: 200
}
Request: Body
{
"state" : "filled",
}
Response: JSON
[
{
"id": 3,
"name": "Chori",
"price": "23.00",
"detail": "Un chorizo entre dos panes",
"image": "http://www.elchacalparrilla.com/images/carta/CHORIPAN.jpg",
"available": true,
"DiscountId": null,
"CategoryId": 2,
"UserId": "cc4eb956-6c15-4d1f-871e-da0f6883718a",
"Labels": [
2,
5
]
},
{
"id": 4,
"name": "Fernet",
"price": "23.00",
"detail": "El fernesito de la ranchada",
"image": "https://pbs.twimg.com/media/B4iFFySIEAA8sf5.jpg",
"available": true,
"DiscountId": null,
"CategoryId": 2,
"UserId": "cc4eb956-6c15-4d1f-871e-da0f6883718a",
"Labels": [
2,
5
]
},
{
"id": 2,
"name": "Poke",
"price": "23.00",
"detail": "Sushi rice, cherry tomato, avocado, edamame, red onion, mango, salmon and tataki sauce",
"image": "",
"available": true,
"DiscountId": null,
"CategoryId": 2,
"UserId": "cc4eb956-6c15-4d1f-871e-da0f6883718a",
"Labels": [
2,
5
]
}
]
Request: Body
{
product_Id: 1
}
Response: JSON
{
"tables": [
{
"tableId": 1,
"state": "free",
"ordered": [],
"totalPrice": 0,
"tip": 0,
"currentOrder": {
"time": "",
"products": [],
"comments": ""
}
},
{
"tableId": 2,
"state": "waiting",
"ordered": [],
"totalPrice": 0,
"tip": 0,
"currentOrder": {
"time": "2021-12-15T15:32:28.557Z",
"products": [
{
"productName": "Papas Fritas",
"productId": 23,
"quantity": 2,
"price": 200
},
{
"productName": "Henieken",
"productId": 12,
"quantity": 2,
"price": 300
}
],
"comments": "Sin sal por favor."
}
},
{
"tableId": 3,
"state": "free",
"ordered": [],
"totalPrice": 0,
"tip": 0,
"currentOrder": {
"time": "",
"products": [],
"comments": ""
}
},
{
"tableId": 4,
"state": "free",
"ordered": [],
"totalPrice": 0,
"tip": 0,
"currentOrder": {
"time": "",
"products": [],
"comments": ""
}
},
{
"tableId": 5,
"state": "free",
"ordered": [],
"totalPrice": 0,
"tip": 0,
"currentOrder": {
"time": "",
"products": [],
"comments": ""
}
}
]
}
Request: Body
{
idTable: 1,
state: 'eating',
idStaff: '39672174'
}
Body: JSON
{
tableId:2,
productId:12
quantity:3
}
Response: JSON
[
{
"idTable": 2,
"currentOrder": {
"time": "16/12/2021 21:17:17",
"products": [
{
"productName": "Papas Fritas",
"productId": 23,
"quantity": 2,
"price": 200,
"time": "16/12/2021 21:17:36",
},
{
"productName": "Henieken",
"productId": 12,
"quantity": 2,
"price": 300,
"time": "16/12/2021 21:17:36",
}
],
"comments": "Sin sal por favor."
}
},
{
"idTable": 1,
"currentOrder": {
"time": "16/12/2021 21:17:36",
"products": [
{
"productName": "Papas Fritas",
"productId": 23,
"quantity": 2,
"price": 200,
"time": "16/12/2021 21:17:36",
},
{
"productName": "Henieken",
"productId": 12,
"quantity": 2,
"price": 300,
"time": "16/12/2021 21:17:36",
}
],
"comments": "Sin sal por favor."
}
}
]
Response: JSON
{
"id": "ANzbx5Pa3dPizabR",
"email": "[email protected]",
"passAdmin": "abc123",
"passStaff": "321cba",
"tables": 5,
"title": "La Trufa Dorada",
"logo": "https://fake.image.url/123455",
"theme": 1,
"payment_mp": null
}
Request: Body
{
"title" : "El Holandes frito"
"logo" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K", // Image in base64 format
}
Request: Query Params
//example 1:
localhost:3000/resto/saddferferv/admin/revenue?filterTime=Day // 'Day', 'Month', 'Last7days'
//example 2:
localhost:3000/resto/saddferferv/admin/revenue?filterTime=Day&orderPrice=Ascendent //orderPrice --> 'Ascendent', 'Descendent'
Response: JSON
[
{
"id": 1,
"idStaff": 39672174,
"totalPrice": "500.00",
"tip": "123.00",
"date": "16/12/2021, 8:59:35 p. m.",
"idTable": 2,
"paymentMethod": "pay_cash",
"UserId": "00880663-5552-4f00-b2eb-992de871e4ee",
"SoldProducts": [
{
"productId": 23,
"name": "Papas Fritas",
"price": "200.00",
"quantity": 2
},
{
"productId": 12,
"name": "Henieken",
"price": "300.00",
"quantity": 2
}
]
}
]
Response: JSON
[
{
"id": 1,
"name": "Poke",
"price": "23.00",
"detail": "Sushi rice, cherry tomato, avocado, edamame, red onion, mango, salmon and tataki sauce",
"image": "",
"available": true,
"DiscountId": null,
"CategoryId": 2,
"UserId": "698b2498-0b10-46ce-9524-005449b5f966",
"Labels": [
2,
6,
7
]
},
{
"id": 2,
"name": "Cesar Salad",
"price": "10.00",
"detail": "Parmesan cheese, lemon juice, coddled egg, olive oil, romaine and croutons",
"image": "",
"available": true,
"DiscountId": 1,
"CategoryId": 2,
"UserId": "698b2498-0b10-46ce-9524-005449b5f966",
"Labels": [
2,
5
]
},
{
"id": 3,
"name": "Spaguetti",
"price": "28.00",
"detail": "Spaguetty with large and spicy meatballs and house sauce",
"image": "imagen",
"available": true,
"DiscountId": 2,
"CategoryId": 1,
"UserId": "698b2498-0b10-46ce-9524-005449b5f966",
"Labels": [
2,
11
]
}
]
Request: Body
//example 1
{
"name":"Poke",
"price":23,
"detail":"Sushi rice, cherry tomato, avocado, edamame, red onion, mango, salmon and tataki sauce",
"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K", // Image in base64 format
"id_label":[2,5],
"CategoryId":2
}
//example 2
{
"name":"Cesar Salad",
"price":10,
"detail":"Parmesan cheese, lemon juice, coddled egg, olive oil, romaine and croutons",
"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K", // Image in base64 format
"id_label":[2,5],
"CategoryId":2,
"DiscountId":1
}
//example 3
{
"name":"Spaguetti with Meatballs",
"price":13,
"detail":"Spaguetty with large and spicy meatballs",
"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K", // Image in base64 format
"id_label":[2,11],
"CategoryId":1,
"DiscountId":2
}
*Params: idproduct* Request: Body
//example 1
{
"name":"",
"price":28
}
//example 2
{
"name":"",
"price":18,
"detail":"",
"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K", // Image in base64 format
"id_label":"",
"CategoryId":"",
"DiscountId":"",
"available": ""
}
//example 3
{
"name":"Spaguetti",
"price":15,
"detail":"Spaguetty with large and spicy meatballs and house sauce",
"image":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+K", // Image in base64 format
"id_label":[2,11],
"CategoryId":"",
"DiscountId":"",
"available": true
}
*Params: idproduct* Response: JSON
{
"msg": "Product Deleted"
}
Response: JSON
[
{
comment: 'Excelente servicio',
rating: 5,
},
{
comment: 'Excelente servicio',
rating: 5,
},
{
comment: 'Excelente servicio',
rating: 5,
}
]
The following developers have either helped to start this project, have contributed code, are actively maintaining it (including documentation). We'd like to take a moment to recognize them.
Name | GitHub | |
---|---|---|
![]() |
Elias Borda | @Eliasdbr |
![]() |
Nicolas Morel | @NicolasMarianoMorel |
![]() |
Sebastian Mesa | @Smesaz |
![]() |
Brian Bacarezza | @brianbacca |