Skip to content

Latest commit

 

History

History
690 lines (520 loc) · 12.4 KB

README.md

File metadata and controls

690 lines (520 loc) · 12.4 KB

GoBarber

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

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

Run in Insomnia

Go Barber API is a project developed on the Rocketseat Bootcamp GoStack 11. This project was developed using TypeScript with NodeJS and Express.


ℹ️ Content


Session

Create Session

Create a session.

  • URL

    /sessions

  • Method:

    POST

  • URL Params

    Required:

    None

  • Data Params

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

    • Code: 200
      Content:

      {
        "user": {
          "id": "f11a9a79-4458-4701-b9af-1f01ce047a02",
          "name": "John Doe",
          "email": "[email protected]",
          "avatar": "68a1dcb377ff3f9642de-E58C073E-A75D-4A58-B96E-D6495C5AB1D8.jpg",
          "created_at": "2020-05-09T22:47:42.775Z",
          "updated_at": "2020-05-24T07:10:13.168Z",
          "avatar_url": "http://localhost:3333/files/68a1dcb377ff3f9642de-E58C073E-A75D-4A58-B96E-D6495C5AB1D8.jpg"
        },
        "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1OTIwNjY0NTcsImV4cCI6MTU5MjE1Mjg1Nywic3ViIjoiZjExYTlhNzktNDQ1OC00NzAxLWI5YWYtMWYwMWNlMDQ3YTAyIn0.eMRC_cB-qGyRXOHYnidABU4S7ZgY-itMOfveiHlQcSE"
      }

Users

Create User

Create a user.

  • URL

    /users

  • Method:

    POST

  • URL Params

    Required:

    None

  • Data Params

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

    • Code: 200
      Content:

      {
        "name": "John Doe",
        "email": "[email protected]",
        "id": "b3107cf3-1d7a-4cdc-8b23-19a3756a63b0",
        "created_at": "2020-05-14T12:38:24.811Z",
        "updated_at": "2020-05-14T12:38:24.811Z",
        "avatar_url": null
      }

Avatar

Update Avatar

Update avatar user.

  • URL

    /users/avatar

  • Method:

    PATCH

  • URL Params

    Required:

    None

  • Data Params

    Multipart Form

    avatar - image

  • Success Response:

    • Code: 200
      Content:

      {
        "id": "f11a9a79-4458-4701-b9af-1f01ce047a02",
        "name": "John Doe",
        "email": "[email protected]",
        "avatar": "3b9c5a02a8061d6e7c99-profile-pic.jpg",
        "created_at": "2020-05-09T22:47:42.775Z",
        "updated_at": "2020-06-14T19:23:44.570Z",
        "avatar_url": "http://localhost:3333/files/3b9c5a02a8061d6e7c99-profile-pic.jpg"
      }

Profile

Show Profile

Show user profile

  • URL

    /profile

  • Method:

    GET

  • URL Params

    Required:

    None

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:

      {
        "id": "f11a9a79-4458-4701-b9af-1f01ce047a02",
        "name": "John Doe",
        "email": "[email protected]",
        "avatar": "3b9c5a02a8061d6e7c99-profile-pic.jpg",
        "created_at": "2020-05-09T22:47:42.775Z",
        "updated_at": "2020-06-14T19:23:44.570Z",
        "avatar_url": "http://localhost:3333/files/3b9c5a02a8061d6e7c99-profile-pic.jpg"
      }

Update Profile

Update profile user.

  • URL

    /profile

  • Method:

    PUT

  • URL Params

    Required:

    None

  • Data Params

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

    • Code: 200
      Content:

      {
        "id": "f11a9a79-4458-4701-b9af-1f01ce047a02",
        "name": "Henrique Tavares",
        "email": "[email protected]",
        "avatar": "0937bcd4ec3684cb1ba1-IMG_7226.jpg",
        "created_at": "2020-05-09T22:47:42.775Z",
        "updated_at": "2020-05-23T22:31:29.201Z",
        "avatar_url": "http://localhost:3333/files/0937bcd4ec3684cb1ba1-IMG_7226.jpg"
      }

Password

Forgot Password

Recover User Password.

  • URL

    /password/forgot

  • Method:

    POST

  • URL Params

    Required:

    None

  • Data Params

    {
      "email": "[email protected]"
    }
  • Success Response:

    • Code: 200
      Content:

      No Content


Reset Password

Reset User Password.

  • URL

    /password/reset

  • Method:

    POST

  • URL Params

    Required:

    None

  • Data Params

    {
     "password": "123123",
      "token": "a525c234-5b1f-405a-a43d-f97720625b43"
    }
  • Success Response:

    • Code: 200
      Content:

      No Content


Providers

Days Providers

List days available from provider.

  • URL

    /providers/:user_id/day-availability

  • Method:

    GET

  • URL Params

    Required:

    None

  • Data Params

  • Success Response:

    • Code: 200
      Content:

      [
        {
          "hour": 8,
          "available": false
        },
        {
          "hour": 9,
          "available": false
        },
        {
          "hour": 10,
          "available": false
        },
        {
          "hour": 11,
          "available": false
        },
        {
          "hour": 12,
          "available": false
        },
        {
          "hour": 13,
          "available": false
        },
        {
          "hour": 14,
          "available": false
        },
        {
          "hour": 15,
          "available": false
        },
        {
          "hour": 16,
          "available": false
        },
        {
          "hour": 17,
          "available": false
        }
      ]

Month Providers

List days available in month from provider.

  • URL

    /providers/:user_id/month-availability

  • Method:

    GET

  • URL Params

    Required:

    None

  • Data Params

  • Success Response:

    • Code: 200
      Content:

      [
        {
          "day": 1,
          "available": false
        },
        {
          "day": 2,
          "available": false
        },
        {
          "day": 3,
          "available": false
        },
        {
          "day": 4,
          "available": false
        },
        {
          "day": 5,
          "available": false
        },
        {
          "day": 6,
          "available": false
        },
        {
          "day": 7,
          "available": false
        },
        {
          "day": 8,
          "available": false
        },
        {
          "day": 9,
          "available": false
        },
        {
          "day": 10,
          "available": false
        },
        {
          "day": 11,
          "available": false
        },
        {
          "day": 12,
          "available": false
        },
        {
          "day": 13,
          "available": false
        },
        {
          "day": 14,
          "available": false
        },
        {
          "day": 15,
          "available": false
        },
        {
          "day": 16,
          "available": false
        },
        {
          "day": 17,
          "available": false
        },
        {
          "day": 18,
          "available": false
        },
        {
          "day": 19,
          "available": false
        },
        {
          "day": 20,
          "available": false
        },
        {
          "day": 21,
          "available": false
        },
        {
          "day": 22,
          "available": true
        },
        {
          "day": 23,
          "available": true
        },
        {
          "day": 24,
          "available": true
        },
        {
          "day": 25,
          "available": true
        },
        {
          "day": 26,
          "available": true
        },
        {
          "day": 27,
          "available": true
        },
        {
          "day": 28,
          "available": true
        },
        {
          "day": 29,
          "available": true
        },
        {
          "day": 30,
          "available": true
        },
        {
          "day": 31,
          "available": true
        }
      ]

List All Providers

List all providers

  • URL

    /providers

  • Method:

    GET

  • URL Params

    Required:

    None

  • Data Params

  • Success Response:

    • Code: 200
      Content:

      [
        {
          "id": "76e90736-7667-436b-a8b5-020eeaf5adc7",
          "name": "Barber One",
          "email": "[email protected]",
          "avatar": null,
          "created_at": "2020-05-14T12:35:56.665Z",
          "updated_at": "2020-05-14T12:35:56.665Z",
          "avatar_url": null
        },
        {
          "id": "c0c44550-77c9-432b-b952-aca5a5664698",
          "name": "Barber Two",
          "email": "[email protected]",
          "avatar": "9f276402341753997fc5-2254731.jpeg",
          "created_at": "2020-05-10T03:52:30.114Z",
          "updated_at": "2020-05-24T03:12:28.634Z",
          "avatar_url": "http://localhost:3333/files/9f276402341753997fc5-2254731.jpeg"
        }
      ]

🚀 Technologies


💻 Author

Henrique Tavares
Henrique Tavares

@tavareshenrique
💻

📝 License

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