ℹ️ Content   |   🚀 Technologies   |   💻 Author   |   📝 License
FastFeet is an application for a fictional shipping company, FastFeet. This application is for Rocketseat Bootcamp certification and this API was developed using NodeJS.
Create a single user.
-
URL
/users
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
{ "name": "FastFeet", "email": "[email protected]", "password": "123456" }
-
Success Response:
-
Code: 200
Content:{ "name": "FastFeet", "email": "[email protected]", }
-
Update a user.
-
URL
/users
-
Method:
PUT
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "name": "Henrique Tavares", "email": "[email protected]", }
- If you inform that you want to change the password, you must confirm the password and inform the old password, like this:
{ "name": "Henrique Tavares", "email": "[email protected]", "oldPassword": "123456", "password": "654321", "confirmPassword": "654321" }
-
Success Response:
-
Code: 200
Content:{ "id": 1, "name": "Henrique Tavares", "email": "[email protected]" }
-
Start a session.
-
URL
/sessions
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
{ "email": "[email protected]", "password": "123456" }
-
Success Response:
-
Code: 200
Content:{ "user": { "id": 1, "name": "FastFeet", "email": "[email protected]" }, "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJpZCI6MSwiaWF0IjoxNTgyODA2OTYyLCJleHAiOjE1ODM0MTE3NjJ9.nfadyR3In1javb1nqjjzIcK3k9ffFDQTcTkat3l8_D0" }
-
ListAll Deliverymen.
-
URL
/deliverymen
-
Method:
GET
-
URL Params
Required:
None
Optional:
name=[string] id=[number]
-
Data Params
None
-
Success Response:
-
Code: 200
Content:[ { "id": 1, "name": "Henrique Tavares", "email": "[email protected]", "avatar_id": null, "avatar": null } ]
-
List orders assigned to the delivery person that are not delivered or canceled. Also list orders already delivered by the deliveryman.
-
URL
/deliverymen/:id/deliveries
-
Method:
GET
-
URL Params
Required:
None
Optional
-
For list orders already delivered by the deliveryman
delivered=[boolean] page=[number][default = 1]
Ex:
/deliverymen/:id/deliveries?delivered=true
-
-
Data Params
None
-
Success Response:
-
Code: 200
Content:[ { "id": 1, "product": "Any Product", "start_date": "2020-02-27T17:20:00.000Z", "recipient": { "name": "JosĂ© da Silva", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "629", "complement": "Vinhais", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }, "signature": { "url": "http://localhost:3333/signatures/b54719a89ab55cde8e1a9b61b85c88c3.png", "name": "2018-06-09-saida-marca-simbolozaal.png", "path": "b54719a89ab55cde8e1a9b61b85c88c3.png" } } ]
-
Store Deliveryman.
-
URL
/deliverymen
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "name": "Henrique Tavares", "email": "[email protected]", }
-
Success Response:
-
Code: 200
Content:{ "name": "Henrique Tavares", "email": "[email protected]", }
-
Update Deliveryman.
-
URL
/deliverymen/:id
-
Method:
PUT
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "name": "Henrique Tavares", "email": "[email protected]", "avatar_id": 1 }
-
Success Response:
-
Code: 200
Content:{ "id": "1", "name": "Henrique Tavares", "email": "[email protected]", "avatar": { "url": "http://localhost:3333/files/0d28a7b2bd2696d65dc9f1fa86e7b501.jpg", "id": 1, "path": "0d28a7b2bd2696d65dc9f1fa86e7b501.jpg" } }
-
Delete Deliveryman.
-
URL
/deliverymen/:id
-
Method:
DELETE
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
None
-
Success Response:
- Code: 200
Content: No body returned for response
- Code: 200
List All Delivery Problems.
-
URL
/delivery/problems
-
Method:
GET
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
None
-
Success Response:
-
Code: 200
Content:[ { "id": 1, "description": "The recipient was not at home.", "delivery": { "id": 1, "product": "Any Product", "start_date": "2020-02-27T17:20:00.000Z", "end_date": "2020-02-27T22:20:00.000Z", "canceled_at": null } } ]
-
List Delivery Problems by Order Id.
-
URL
/delivery/:id/problems
-
Method:
GET
-
URL Params
Required:
None
-
Data Params
None
-
Success Response:
-
Code: 200
Content:[ { "id": 1, "description": "The recipient was not at home.", "delivery": { "id": 1, "product": "Any Product", "start_date": "2020-02-27T17:20:00.000Z", "end_date": "2020-02-27T22:20:00.000Z", "canceled_at": null } } ]
-
Store Delivery Problem.
-
URL
/delivery/:id/problems
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "description": "The recipient was not at home." }
-
Success Response:
-
Code: 200
Content:{ "id": "1", "description": "The recipient was not at home." }
-
Delete Delivery Problem for Cancel Delivery.
-
URL
/delivery/:id/cancel-delivery
-
Method:
DELETE
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
None
-
Success Response:
- Code: 200
Content: No body returned for response
- Code: 200
List All Recipients.
-
URL
/recipients
-
Method:
GET
-
URL Params
Required:
None
Required: name=[string] id=[number]
-
Data Params
* Need Authorization - Bearer Token
-
Success Response:
-
Code: 200
Content:[ { "id": 2, "name": "Bobbs", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "629", "complement": "Vinhais", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970", "createdAt": "2020-02-21T00:25:36.844Z", "updatedAt": "2020-02-21T00:25:36.844Z" } ]
-
Store Recipient.
-
URL
/recipients
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "name": "JosĂ© da Silva", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "629", "complement": "Vinhais", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }
-
Success Response:
-
Code: 200
Content:{ "id": 1, "name": "JosĂ© da Silva", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "629", "complement": "Vinhais", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }
-
Update Recipient.
-
URL
/recipients/:id
-
Method:
PUT
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "name": "JosĂ© da Silva Jr.", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "640", "complement": "NĂŁo Tem", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }
-
Success Response:
-
Code: 200
Content:{ "id": 1, "name": "JosĂ© da Silva Jr.", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "640", "complement": "NĂŁo Tem", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }
-
Delete Recipient.
-
URL
/recipients/:id
-
Method:
DELETE
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
None
-
Success Response:
- Code: 200
Content: No body returned for response
- Code: 200
List All Orders.
-
URL
/orders
-
Method:
GET
-
URL Params
Required:
None
Optional:
product=[string]
-
Data Params
* Need Authorization - Bearer Token
-
Success Response:
-
Code: 200
Content:[ { "id": 1, "product": "Any Product", "canceled_at": null, "start_date": "2020-02-27T17:20:00.000Z", "end_date": "2020-02-27T22:20:00.000Z", "recipient": { "name": "JosĂ© da Silva Jr.", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "640", "complement": "NĂŁo Tem", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }, "deliveryman": { "name": "Henrique Tavares", "email": "[email protected]" }, "signature": { "url": "http://localhost:3333/signatures/b54719a89ab55cde8e1a9b61b85c88c3.png", "name": "2018-06-09-saida-marca-simbolozaal.png", "path": "b54719a89ab55cde8e1a9b61b85c88c3.png" } } ]
-
Store Order.
-
URL
/orders
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "product": "New Any Product", "recipient_id": 1, "deliveryman_id": 1 }
-
Success Response:
-
Code: 200
Content:{ "recipient_id": 1, "deliveryman_id": 1, "product": "New Any Product" }
-
Update Order.
-
URL
/orders
-
Method:
PUT
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "product": "Any Product 2", "recipient_id": 1, "deliveryman_id": 1 }
-
Success Response:
-
Code: 200
Content:{ "recipient_id": 1, "deliveryman_id": 1, "signature_id": 1, "product": "Any Product 2", "canceled_at": null, "end_date": null }
-
Delete Order.
-
URL
/order/:id
-
Method:
DELETE
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
None
-
Success Response:
- Code: 200
Content: No body returned for response
- Code: 200
Update Order Status.
-
URL
/deliverymen/:idDeliverymen/orders/:idOrders/status
-
Method:
PUT
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
{ "start_date": "2020-02-27T14:20:00-03:00", "end_date": "2020-02-27T19:20:00-03:00", "signature_id": 1 }
-
Success Response:
-
Code: 200
Content:{ "id": 1, "product": "Any Product", "start_date": "2020-02-27T17:20:00.000Z", "end_date": "2020-02-27T22:20:00.000Z", "recipient": { "name": "JosĂ© da Silva", "street": "Rua Doze 11 Quadra 8 Conjunto Vinhais", "number": "629", "complement": "Vinhais", "state": "MA", "city": "SĂŁo LuĂs", "zipcode": "65071970" }, "deliveryman": { "name": "Henrique Tavares", "email": "[email protected]" }, "signature": { "url": "http://localhost:3333/signatures/b54719a89ab55cde8e1a9b61b85c88c3.png", "name": "2018-06-09-saida-marca-simbolozaal.png", "path": "b54719a89ab55cde8e1a9b61b85c88c3.png" } }
-
Store File.
-
URL
/files
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
Select:
Multipart Form
file - YOUR FILE
-
Success Response:
-
Code: 200
Content:{ "url": "http://localhost:3333/files/0d28a7b2bd2696d65dc9f1fa86e7b501.jpg", "id": 1, "name": "E58C073E-A75D-4A58-B96E-D6495C5AB1D8.jpg", "path": "0d28a7b2bd2696d65dc9f1fa86e7b501.jpg", "updatedAt": "2020-02-27T13:12:19.125Z", "createdAt": "2020-02-27T13:12:19.125Z" }
-
Signature File.
-
URL
/signatures
-
Method:
POST
-
URL Params
Required:
None
-
Data Params
* Need Authorization - Bearer Token
Select:
Multipart Form
signature - YOUR SIGNATURE IMAGE
-
Success Response:
-
Code: 200
Content:{ "url": "http://localhost:3333/signatures/b54719a89ab55cde8e1a9b61b85c88c3.png", "id": 1, "name": "2018-06-09-some-name.png", "path": "b54719a89ab55cde8e1a9b61b85c88c3.png", "updatedAt": "2020-02-27T12:58:10.459Z", "createdAt": "2020-02-27T12:58:10.459Z" }
-
- Express
- Nodemon
- Sucrase
- Sentry
- bcryptjs
- bee-queue
- cors
- date-fns
- dotenv
- express-async-errors
- express-handlebars
- JWT Auth
- multer
- nodemailer
- nodemailer-express-handlebars
- youch
- yup
- sequelize
- pg
- pg-hstore
- Postgres
- Redis
- SQLite
- ESLint
- Prettier
- JEST
- supertest
- factory-girl
- Faker
Henrique Tavares @tavareshenrique đź’» |
This project is licensed under the MIT license - see the archive LICENSE.md for details.