Code Monkey home page Code Monkey logo

seatme's Introduction

SeatMe

SeatMe is a light-weighted, web-based restaurant reservation service. Restaurant owners can register and manage restaurants through our website, and customers can search and reserve for restaurant seats.

Use Case

alt text

Getting Started

  1. Setup backend

⋅⋅⋅Install PostgreSQL with Homebrew.

  1. Setup frontend
  • Install Node.js with version v12.13.0
  1. Clone this repo to your local directory.

Backend:

  • Import the Java Spring Boot project in the backend folder with IDEA.
  • Start PostgreSQL with Homebrew: brew services start postgresql
  • Run the Spring Boot project

Frontend:

  • Open the react project in the frontend folder.
  • Install dependecies: npm install
  • Start the React app: npm start

Demo

Data Model

alt text

Sequence Diagram

alt text

RESTful apis

This project was developed based on the following apis:

Enterprise side:

  • register a new user: POST ../resturants/registration

    from frontend:
    {
    "email": "[email protected]",
    "password": "123456"
    }
  • register/update restaurant info: POST ../resturants/{email}/info

    from frontend:
    {
    "name": "BU resturant",
    "address": "1 commonwealth ave",
    "zipcode": "02134",
    "phone": "123456",
    "cuisineType": "chinese",
    "photo": "url",
    "startTime": "11:00",
      "endTime": "18:00",
      "avgDinningTime": "30"
    }
  • restaurant login: POST ../authenticate

    from frontend:
    {
    "email": "[email protected]",
    "password": 123456
    }
    • successful login -> get a JWT token

      from backend:
      JWT token from the seatMe backend: 
      eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJwcmVzZW50YXRpb25AYnUuZWR1IiwiZXhwIjoxNTg1ODYxNTA1LCJpYXQiOjE1ODUyNTY3MDV9.OTZPiuSXSImhNqDa05WNn7ljARPRetkEavKycNkbxdHmjw0GWXt_pviqK9w6VEawiduULGV4K_nOuwvwiXkRxA
      
      go to website: jwt.io
      you can see the content of this token. for now, the token has user email
      
  • check if user has restaurant GET ../{email}/isRestaurant

from backend:
    { "true" }
  • get all tables GET ../restaurants/{email}/tables
from backend:
    {
        "id": 1,
        "version": 0,
        "createdAt": "2020-03-05T21:23:38.577+0000",
        "updatedAt": "2020-03-05T21:23:38.564+0000",
        "minSize": 2,
        "maxSize": 10,
        "availability": true
    },
    {
        "id": 2,
        "version": 0,
        "createdAt": "2020-03-05T21:23:39.387+0000",
        "updatedAt": "2020-03-05T21:23:39.387+0000",
        "minSize": 2,
        "maxSize": 10,
        "availability": true
    }
  • add a table in restaurant: POST ../restaurants/{email}/table

    from frontend:
    {
      "minSize": "2",
      "maxSize": "4"
    }
  • remove a table in restaurant: DELETE ../restaurants/{email}/table/{id}

  • update a table in restaurant: POST ../restaurants/{email}/table/update/{id}

{
    "minSize": "2",
    "maxSize": "4"
}
  • change the current availability of a table: POST ../restaurants/{email}/table/{id}

  • add a reservation: POST ..restaurants/reservation/add

    from frontend:
    {
      "firstname": "john",
      "lastname": "snow",
      "phone": "123456",
      "partySize": "3",
      "resturantId": "1",
      "date": "mm-dd-yyyy",
      "time": "1:15"
    }
  • get a list of all reservations: GET ../resturants/{email}/reservations

    from frontend:
    {
      "date": "mm-dd-yyyy"
    }
    from backend:
    [
      {
          "id": 124,
          "firstName": "a",
          "lastName": "b",
          "phone": "1234",
          "partySize": "2",
          "date": "2021-02-02T05:00:00.000+0000",
          "time": "1:15"    
    },
      {   "id": 125,
          "firstName": "c",
          "lastName": "b",
          "phone": "1234",
          "partySize": "2",
          "date": "2021-02-02T05:00:00.000+0000",
          "time": "1:15"  
      }
    ]
  • get the waitlist queue: GET ../restaurants/{email}/queue

[
    {
        "id": 119,
        "firstName": "christine",
        "lastName": "sun",
        "phone": "123456",
        "partySize": "10"
    }
]
  • add to waitlist: POST ../waitList/{restaurantId}/add

    from frontend:
    {
      "firstname": "john",
      "lastname": "snow",
      "phone": "123456",
      "partySize": "5",
      "timestamp": "current time stamp"
    }
  • remove customer from the queue: POST ../restaurants/{email}/queue/{id}

Customer Side:

  • get a list of restaurants: GET ..reservation/restaurant/all

    from backend:
    [
      {
        "restaurantId": "1",
    		"name": "BU resturant",
        "address": "1 commonwealth ave",
        "zipcode": "02215",
    		"phone": "12341256",
    		"cuisineType": "chinese"
      },
        {
        "restaurantId": "2",
    		"name": "ABC cafe",
        "address": "2 commonwealth ave",
        "zipcode": "02215",
    		"phone": "23452167",
    		"cuisineType": "american"
      },
        {
        "restaurantId": "3",
    		"name": "XYZ pizza",
        "address": "3 commonwealth ave",
        "zipcode": "02215",
    		"phone": "1324231",
    		"cuisineType": "indian"
      },
    ]
  • get a list available timeslot of a restaurants: GET ../reservation/restaurant/timeslot

    from frontend: 
    {
      "resturantId": "1",
      "date": "mm-dd-yyyy",
      "partySize": "3"
    }
    from backend:
    ["1:15","1:30", "1:45"]
  • add a reservation: POST ../reservation/add

    from frontend:
    {
      "firstname": "john",
      "lastname": "snow",
      "phone": "123456",
      "partySize": "3",
      "resturantId": "1",
      "date": "mm-dd-yyyy",
      "time": "1:15"
    }
  • get estimated time: GET ../reservation/waitlist

    from frontend:
    {
      "resturantId": "1",
      "partySize": "5",
      "timestamp": "current time stamp"
    }

    in minutes

    from backend:
    {
      "estimatedTime": "23" 
    }
  • add to waitlist: POST ../waitList/{restaurantId}/add

    from frontend:
    {
      "firstname": "john",
      "lastname": "snow",
      "phone": "123456",
      "partySize": "5",
      "timestamp": "current time stamp"
    }

seatme's People

Contributors

christinesjx avatar chenyifan-nt avatar ytpan avatar sunnymaqing avatar

Stargazers

Zhaoze Wang avatar

Watchers

James Cloos avatar  avatar  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.