Skip to content

FastFeet is an application for a fictional shipping company, FastFeet. This application is for Rocketseat Bootcamp certification and this API was developed using NodeJS.

License

Notifications You must be signed in to change notification settings

tavareshenrique/fastfeet-api

Repository files navigation

Fastfeet

Last commit on GitHub Made by Henrique Tavares Project top programing language Repository size GitHub license

ℹ️ Content   |    🚀 Technologies   |    💻 Author   |    📝 License

Run in Insomnia

FastFeet is an application for a fictional shipping company, FastFeet. This application is for Rocketseat Bootcamp certification and this API was developed using NodeJS.

⚠️ This project also has integration testing and unit testing. ⚠️


ℹ️ Content


User

Store User

Create a single user.

  • URL

    /users

  • Method:

    POST

  • URL Params

    Required:

    None

  • Data Params

    {
      "name": "FastFeet",
      "email": "[email protected]",
      "password": "123456"
    }
  • Success Response:


Update User

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]"
      }

Session

Store Session

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"
      }

Deliveryman

List All Deliverymen

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
        }
      ]

Orders by Deliveryman

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

Store Deliveryman.

  • URL

    /deliverymen

  • Method:

    POST

  • URL Params

    Required:

    None

  • Data Params

    * Need Authorization - Bearer Token

    {
      "name": "Henrique Tavares",
      "email": "[email protected]",
    }
  • Success Response:


Update Deliveryman

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

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

Delivery Problems

List All Delivery Problems

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

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

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

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

Recipient

List All Recipients

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

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

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

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

Order

List All Orders

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

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

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

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

Order Status

Update Order Status

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"
        }
      }

File

Store File

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

Store Signature

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"
      }

🚀 Technologies


💻 Author

Henrique Tavares
Henrique Tavares

@tavareshenrique
💻

📝 License

This project is licensed under the MIT license - see the archive LICENSE.md for details.

About

FastFeet is an application for a fictional shipping company, FastFeet. This application is for Rocketseat Bootcamp certification and this API was developed using NodeJS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages