Code Monkey home page Code Monkey logo

smartlock_api's Introduction

Pervasive - Room Booking System - Backend

Architecture

  • NodeJS 16
  • Express 4

How to run

  • clone this repo
  • npm install
  • npm run start

if using docker is preferred

  • docker build . -t ando-hunterz/pervasive-backend
  • docker run -itd --name pervasive-backend -p 80:4500

Dependency required

  • Postgresql
  • MongoDB

API LIST

ADMIN - /api/admin

method: 'GET'

endpoint: /data

required: admin role jwt

response:

[
    {
        "_id": {
            "year": int,
            "week": int
        },
        "start_date": Date,
        "count": int
    }

AUTH - /api/auth

  • login

    endpoint: /login

    method: POST

    body:

    {
        "email": email,
        "password": password
    }

    response:

    {
        "token": string
    }
  • register

    method: POST

    endpoint: /register

    body:

    {
        "nim": int,
        "uid": string,
        "email": email,
        "first_name": string,
        "last_name": string,
        "password": string
    }

    reponse:

    {
        "id": int,
        "nim": string,
        "uid": string,
        "email": string,
        "first_name": string,
        "last_name": string,
        "password": string,
        "updatedAt": string,
        "createdAt": string,
        "role": string
    }

Booking - /api/bookings

  • Get All Booking endpoint: /

    method: GET

    required: user jwt

    response:

    [
        {
            "_id": string,
            "start_date": string,
            "end_date": string,
            "duration": int,
            "room_id": string,
            "status": string,
            "user_booking_nim": string,
            "participant": [string],
            "createdAt": string,
            "updatedAt": string,
            "__v": 0
        }
    ]
  • Specific user booking endpoint: /user/:nim

    method: GET

    params: nim: int

    required: user jwt

    reponse:

      {
          "_id": string,
          "start_date": string,
          "end_date": string,
          "duration": int,
          "room_id": string,
          "status": string,
          "user_booking_nim": string,
          "participant": [string],
          "createdAt": string,
          "updatedAt": string,
          "__v": 0
      }
  • Add new booking endpoint: /

    method: POST

    required: user jwt

    body:

      {
          "user_booking_nim": int,
          "room_id": int,
          "start_date": date,
          "end_date": date,
          "participant": [string]
      }

    response:

      {
          "_id": string,
          "start_date": string,
          "end_date": string,
          "duration": int,
          "room_id": string,
          "status": string,
          "user_booking_nim": string,
          "participant": [string],
          "createdAt": string,
          "updatedAt": string,
          "__v": 0
      }
  • Check room availability endpoint: /checkRoom

    method: GET

    required: user jwt

    query params: ?date=yyyy-mm-dd&start_time=00:00&end_time=00:00

    response:

      {
      "room": [
          {
              "id": int,
              "name": string,
              "capacity": int
          }
      ]
  • Get specific booking endpoint: /:id

    method: GET

    required: user jwt

    response:

      {
          "_id": string,
          "start_date": string,
          "end_date": string,
          "duration": int,
          "room_id": string,
          "status": string,
          "user_booking_nim": string,
          "participant": [string],
          "createdAt": string,
          "updatedAt": string,
          "__v": 0
      }
  • edit specific booking endpoint: /:id

    method: PUT

    required: user jwt

    body:

      {
          "user_booking_nim": int,
          "room_id": int,
          "start_date": date,
          "end_date": date,
          "participant": [string]
      }

    response:

    {
      "message": string,
      "booking": {
          "_id": string,
          "start_date": string,
          "end_date": string,
          "duration": int,
          "room_id": string,
          "status": string,
          "user_booking_nim": string,
          "participant": [string],
          "createdAt": string,
          "updatedAt": string,
          "__v": int
      }
    }

Booking

smartlock_api's People

Contributors

ando-hunterz avatar minorvafalk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.