/Restaurant-Booking-Backend-System

A public restaurant booking backend system - Such that Users book favourite dishes,favourite tables and also pay for their meals online from their preferred restaurants, can see all their bookings and have the right to cancel any booking they do not want to use again or once they have been served by the restaurant.

Primary LanguageJavaScript

Restaurant Booking Backend System

Table of Contents (Optional)

Usage

Features

Add to Base URL above

  • Use the following Endpoints

    POST /auth/signup Create User Account

    POST /auth/signin Login A User

    POST /dishes Create a trip (Needs admin priviledges)

    GET /dishes Get all trips

    POST /bookings Book a seat on a restaurant

    GET /bookings See all of your bookings

    DELETE /bookings/:bookingId Delete A Booking

    PATCH /dishes/:dishId Cancel A Dish (Needs admin priviledges)

    GET /user/seed Seed users table with users with admin rights

    POST /admin/signup An admin can add new admin (Needs admin priviledges)

    PUT /user/:id/admin An admin can give a registered user admin right (Needs admin priviledges)

    PUT /bookings/:bookingId Update Booking Seat Number

    POST /restaurants Add a bus (Needs admin priviledges)

    GET /restaurants Get all buses (Needs admin priviledges)

    GET /dishes/price?price="price" Filter dishes by price

    GET /dishes/restaurant?restaurant="restaurantName" Filter trips by restaurant_name

  • A successful response will be

     { status: 'success', data: {} }

    or

     { status: 'success', data: [] }

    and an unsuccessful response will be

    { status: 'error', error: '​relevant-error-message' }

Prerequisites

Contributing

I would love to hear from anyone that will like to contribute. Make sure you have latest NodeJs installed locally. If you want set up locally you can follow these steps, you can also use postman(https://www.getpostman.com/downloads/) to test. Fork the repository, open terminal in root and do the following on terminal

$ npm install

After Setting up the database, create database tables running the command below, its advisable to run the command more than once and make sure your database is updated with the tables:

$ npm run create-dev-tables

Start server by running:

$ npm run start

Seed Database tables with users(with admin right) by running the command below, its advisable to run it more than once:

$ npm run seed-user-table

or use

GET /user/seed Endpoint

Test endpoints by running:

$ npm run test

License

None for now.

developed with 💕 by Sammy Mutahi