Skip to content

API Specifications

Subhrodip Mohanta edited this page Dec 25, 2022 · 33 revisions

Lunch Booking Backend

Path Table

Method Path Description
🟧 POST /login/register New User Creation
🟧 POST /login Login
🟧 POST /login/check/username/[email protected] Login Check Username
🟧 POST /login/check/phone/9830098300 Login Check Phone
🟦 PUT /login/otp/validate OTP Validate HEADER CHANGE
🟧 POST /login/otp/resend OTP Resend
🟧 POST /login/forget Forget Password Initiate
🟧 POST /login/forget/new Forget Password Update New Password
🟧 POST /login/passwd Change New Password
🟧 POST /meal/create Create Meal
🟩 GET /booking Fetch Previous User Bookings
🟩 GET /meal/true Fetch All Upcoming Meals
🟩 GET /meal Show Upcoming Meal Options
🟧 POST /booking/create/22 Create Booking
🟦 PUT /booking/avail/37 Avail Booking
🟥 DELETE /booking/35 Cancel Booking
🟩 GET /booking/2022-12-23 ALL Bookings for Date
🟦 PUT /booking/pickup/18 Avail Extra Meal
🟩 GET /meal/false Fetch All Previous Meals
🟦 PUT /meal/activate/11 Activate Meal
🟥 DELETE /meal/activate/11 Deactivate Meal
🟦 PUT /meal/lock/11 Lock Meal
🟥 DELETE /meal/lock/11 Unlock Meal
🟦 PUT /meal/ready/11 Ready Meal
🟥 DELETE /meal/ready/11 UnReady Meal
🟩 GET /meal/available Fetch All Available Meals
🟩 GET /meal/count/1 Fetch Meal Count By Date

Reference Table

Name Path Description
noauthAuth #/components/securitySchemes/noauthAuth 🔓 No Authentication
bearerAuth #/components/securitySchemes/bearerAuth 🔒 Bearer Token Authentication

Path Details


[POST]/login/register

  • Summary
    New User Creation

  • Security 🔓 No Auth

Request Body

  • application/json
{
    "emailId": "[email protected]",
    "password": "12345678",
    "firstName": "Subhrodip",
    "lastName": "Mohanta",
    "mobile": "9830098300"
}
JSON Field Name Field Type Necessity Description Validation Default Value
emailId string required Email ID of the user, this will be used for login Not Blank and Unique and Domain specific
password string required password of the user Not Blank
firstName string required First Name of the User Not Blank
lastName string required Last Name of the User Not Blank
mobile string optional Mobile Number of the User Unique null

Response Body

  • application/json
{
    "salt": 3
}
JSON Field Name Field Type Necessity Description Validation
salt number required This Salt is required when you are verifying the OTP Must be Greater then Zero 0

Responses

  • 200 Successful response

application/json


[POST]/login

  • Summary
    Login

  • Security 🔓 No Auth

Request Body

  • application/json
{
    "username": "[email protected]",
    "password": "12345678"
}

Response Body

  • application/json
{
    "salt": 3
}

Responses

  • 200 Successful response

application/json


[POST]/login/check/username/[email protected]

  • Summary
    Login Check Username

  • Security 🔓 No Auth

Responses

  • 200 Successful response

application/json


[POST]/login/check/phone/9830098300

  • Summary
    Login Check Phone

  • Security 🔓 No Auth

Responses

  • 200 Successful response

application/json


[PUT]/login/otp/validate

  • Summary
    OTP Validate HEADER CHANGE

  • Security 🔓 No Auth

Headers

x-otp-validate-forget?: boolean

Request Body

  • application/json
{
    "salt": 1,
    "otp": 123456
}

Response Body

  • application/json
{
    "jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
    "user": {
        "id": 23,
        "firstName": "John",
        "lastName": "Doe",
        "emailId": "[email protected]",
        "mobile": "9830098300",
        "lastLogin": 1668698320470
    }
}
JSON Field Name Field Type Necessity Description Validation
jwtToken string required JSON Web Token containing the login information Not Blank
user object required Password of the user Not Blank
id number required Internal User ID for the logged in user Not Blank
firstName string required First Name of the User Not Blank
lastName string required Last Name of the User Not Blank
emailId string required Email ID or Login ID of the User Not Blank
mobile string optional Mobile Number of the User
lastLogin number required Epoch Milliseconds of the last Login Time Not Blank

Responses

  • 200 Successful response

application/json


[POST]/login/otp/resend

  • Summary
    OTP Resend

  • Security 🔓 No Auth

Request Body

  • application/json
{
    "salt": 1
}

Request Body

  • application/json
{
    "salt": 1
}

Responses

  • 200 Successful response

application/json


[POST]/login/forget

  • Summary
    Forget Password Initiate

  • Security 🔓 No Auth

Request Body

  • application/json
{
    "username": "[email protected]"
}

Response Body

  • application/json
{
    "salt": 1
}

Responses

  • 200 Successful response

application/json


[POST]/login/forget/new

  • Summary
    Forget Password Update New Password

  • Security 🔓 No Auth

Request Body

  • application/json
{
    "newPassword": "12345678"
}

Responses

  • 200 Successful response

application/json


[POST]/login/passwd

Request Body

  • application/json
{
    "currentPassword": "12345678",
    "updatedPassword": "23456789"
}

Responses

  • 200 Successful response

application/json


[POST]/meal/create

Request Body

  • application/json
{
    "name": "Pizza",
    "date": "2022-12-23",
    "mealOptions": [
        {
            "name": "Peri Peri Cheese"
        },
        {
            "name": "Cheese Burst"
        },
        {
            "name": "NonVeg Loaded"
        }
    ]
}

Response Body

  • application/json
{
  "id": 66,
  "name": "Pizza",
  "date": "2022-12-23",
  "mealOptions": [
    {
      "id": 70,
      "name": "Peri Peri Cheese",
      "count": 0
    },
    {
      "id": 71,
      "name": "Cheese Burst",
      "count": 0
    },
    {
      "id": 72,
      "name": "NonVeg Loaded",
      "count": 0
    }
  ]
}

Responses

  • 200 Successful response

application/json


[GET]/booking/fetch

  • Summary
    Fetch Previous User Bookings

  • Security 🔒 Bearer Token

Parameters(Query)

prev?: string

Response Body

  • application/json
[
  {
    "id": 17,
    "firstName": "Subhrodip",
    "lastName": "Mohanta",
    "date": "2022-12-23",
    "mealOption": "NonVeg Loaded",
    "mealOptionId": 6,
    "availedAt": 234245380
  }
]

Responses

  • 200 Successful response

application/json


[GET]/meal/true

  • Summary
    Fetch All Upcoming Meals

  • Security 🔒 Bearer Token

Responses

  • 200 Successful response

application/json


[GET]/meal

  • Summary
    Show Upcoming Meal Options

  • Security 🔒 Bearer Token

Responses

  • 200 Successful response

application/json


[POST]/booking/create/22

Responses

  • 200 Successful response

application/json


[PUT]/booking/avail/37

Responses

  • 200 Successful response

application/json


[DELETE]/booking/35

Responses

  • 200 Successful response

application/json


[GET]/booking/2022-12-23

Responses

  • 200 Successful response

application/json


[PUT]/booking/pickup/18

Responses

  • 200 Successful response

application/json


[GET]/meal/false

  • Summary
    Fetch All Previous Meals

  • Security 🔒 Bearer Token

Responses

  • 200 Successful response

application/json


[PUT]/meal/activate/11

Responses

  • 200 Successful response

application/json


[DELETE]/meal/activate/11

Responses

  • 200 Successful response

application/json


[PUT]/meal/lock/11

Responses

  • 200 Successful response

application/json


[DELETE]/meal/lock/11

Responses

  • 200 Successful response

application/json


[PUT]/meal/ready/11

Responses

  • 200 Successful response

application/json


[DELETE]/meal/ready/11

Responses

  • 200 Successful response

application/json


[GET]/meal/available

  • Summary
    Fetch All Available Meals

  • Security 🔒 Bearer Token

Responses

  • 200 Successful response

application/json


[GET]/meal/count/1

  • Summary
    Fetch Meal Count By Date

  • Security 🔒 Bearer Token

Response Body

  • application/json
{
    "mealOptionCountWithId": {
        "1": {
            "redeemed": 0,
            "available": 0,
            "total": 0
        },
        "2": {
            "redeemed": 0,
            "available": 0,
            "total": 0
        }
    }
}

Responses

  • 200 Successful response

application/json


References

Error Response Body

{
    "message": "Email ID already exists",
    "timestamp": 1668688031617
}
JSON Field Name Field Type Necessity Description
message string required User Friendly Error Message
timestamp number required Epoch Milliseconds timestamp of the error generated

#/components/securitySchemes/noauthAuth

{
  "type": "http",
  "scheme": "noauth"
}

#/components/securitySchemes/bearerAuth

{
  "type": "http",
  "scheme": "bearer"
}