edd-ie / foodBackend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The API to Food ChapChap

Table of Contents

  1. Getting started
  2. Usage
  3. Relationships
  4. Models
  5. Routes
  6. Contributors
  7. Licenses
  8. Resources

The project runs on rails and postgesql

1. Website

You can access the site on pockets-backend

2. Cloning

Clone the project files to your local repository:

  • HTTPS => https://github.com/edd-ie/foodBackend.git
  • SSH => git@github.com:edd-ie/foodBackend.git
  • Git CLI => gh repo clone edd-ie/foodBackend

Open the terminal and install all dependencies using.

bundle install

After installation run this command to start the rails server

rails s

Your default browser will be launched and the homepage will be rendered

Alt text

One-to-Many

Customer has many:

  • foods
  • orders
  • Reviews
  • Favourites

Restaurant has many:

  • foods
  • order_tracking
  • Reviews
  • staffs
  • inventories

Food has many:

  • orders

Staff has many:

  • order_tracking

Many-to-Many

customer has many:

  • order_trackings transactions through orders

Restaurant has many:

  • orders through cards order_trackings

This handles the logic for the data sourcing from the data

  • Customer - Customer logic

  • Restaurant - Restaurant Logic

  • Food - Food Logic

  • Inventory - Inventory logic

  • Staff - Stafflogic

  • order - orders logic

The routes the have full http requests functionality(GET, POST, DELETE, PATCH, PUT)

resources :access_tokens
  resources :callback_urls
  resources :mpesas
  # root routes
  root "fallback#home"

  # main routes
  resources :restaurant_reviews
  resources :food_reviews
  resources :orders
  resources :foods
  resources :order_tracks
  resources :staffs
  resources :inventories
  resources :loyalties
  resources :restaurants
  resources :customers
  resources :fav_foods
  resources :fav_restaurants

Custom routes

For added functionality some custom routes were created to help get specific data from database

  # Auxiliary routes

  #### Customer
  get "/customer/orders/:id", to: "customers#orders"
  get "/customer/activeOrders/:id", to: "customers#activeOrders"
  post "/customer/order", to: "orders#create"

  get "/customer/favRes/:id", to: "customers#favRes"
  post "/customer/newRes/:id", to: "customers#newFavRes"

  get "/customer/favFoods/:id", to: "customers#favFoods"
  post "/customer/newFood/:id", to: "customers#newFavFood"

  # for mpesa
  post '/stkpush', to: 'm_pesas#stkpush'
  post '/callback_url', to: 'm_pesas#callback'

This project was a team effort from the following individuals :

The project is licensed under the BSD 3-Clause "New" or "Revised" License, thus redistribution and use in source and binary forms are permitted provided that the conditions are met

WebPage -> pockets backend

Database hosting-> Postgres

About


Languages

Language:Ruby 85.4%Language:HTML 9.0%Language:Batchfile 4.1%Language:CSS 1.0%Language:Shell 0.4%Language:JavaScript 0.1%