Skip to content

Ruby on Rails TDD project - TreinaDev12 selection by Campus Code

Notifications You must be signed in to change notification settings

mbellucio/cade-buffet

Repository files navigation

Cadê Buffet: Catering Web Application

A buffet system application project using Ruby on Rails.

Table of Contents
  1. About this project
  2. Built With
  3. External Gems used
  4. Installation
  5. Dummy data
  6. Testing
  7. System functions and description
  8. Cadê Buffet API

About this project

TreinaDev12 by Campus Code

Treina Dev is a tuition free selection process hosted by Campus Code to find new talents and prepare them for the Ruby on Rails development market.

Project tasks

The life cycle of this project is the incremental type one. Based on Scrum principles, each week a new sprint is generated on their platform with the tasks to implement new functionalities into the project

Test Driven Development

All functionalities of this application were made using TDD principles, therefore all the application is propperly covered by tests. Any atempt to alter or add anything to this project is secure by those tests, guaranteeing a safe application scalability.

Built With

Ruby on Rails html css bootstrap

External Gems used

Installation

Local Setup

  1. Install Ruby 3.2.3.
  2. Clone this repository
  3. Once inside the project folder run bundle install
  4. Run rails db:migrate
  5. Run rails db:seed to create vital models for application.
  6. Run rails s to start server.
  7. Go to localhost:3000 to access Cadê Buffet Application

Testing

To run all the tests use this command on the prompt: rspec
The test files are located at: ./spec
There are 3 types of tests covering this project:

  • System tests - located at ./spec/system
  • Model tests - located at ./spec/model
  • Request tests - located at ./spec/request

Dummy data

For testing and viewing the UI some dummy data was inserted into the db/seeds.rb file. Only the Jaquin Buffet has events, orders and chat messages to visualize. here are the credentials to log into Jaquin Buffet as a Company User:

here are the credentials to log as Client User:

System Description and Functions

There are two roles in the system: Company and Client.

Company can:

  1. Create, Edit Buffet
  2. Create, Edit, Delete Events
  3. Create, Edit, Delete Event Pricings
  4. Accept orders issued by clients countering with a budget offer
  5. Cancel orders
  6. Activate/Deactivate Buffet and it's events

Clients can:

  1. Search Buffets by name, city or event
  2. Check Buffet details
  3. Check events details
  4. Create event orders
  5. Accept budget offer for order
  6. Cancel order on pending and awaiting status
  7. Rate buffets

Cade Buffet API

Introduction

Welcome to the Cadê Buffet API!. This documentation will guide you throught our API and its available resources and how to consume them with HTTP requests.

Authentication

Cadê Buffet is a completely open API. No authentication is required to query and get data.

Resources

BUFFETS

A Buffet is the organization that can cater for many events.

Endpoints

  • /api/v1/buffets/ -- get all the buffets resources
    • this resource accepts a Search Field params: {search: name}
  • /api/v1/buffets/:id/ -- get a specific buffet resource

Example request:

http http://localhost:3000/api/v1/buffets/1/

Example response:

HTTP/1.0 200 OK
Content-Type: application/json
{
  "id": 1,
  "phone_number": "21967276117",
  "zip_code": "21830-390",
  "adress": "Rua Henrique Domingues",
  "neighborhood": "Bangu",
  "city": "Rio de Janeiro",
  "state_code": "RJ",
  "description": "Um buffet feito para você",
  "email": "[email protected]",
  "buffet_name": "Bangu Buffet",
  "payment_methods": [
    {
      "method": "PIX"
    },
    {
      "method": "Cartão de Crédito"
    },
    {
      "method": "Cartão de Débito"
    },
    {
      "method": "Depósito Bancário"
    }
  ]
}

Attributtes:

  • phone_number string -- Comercial phone number
  • zip_code string -- Code from the buffet location area
  • adress string -- Buffet adress
  • neighborhood string -- Neighborhood from where the buffet is located
  • city string -- City from where the buffet is located
  • state_code string -- 2 letter code representing the State which the buffet is located
  • state_code string -- 2 letter code representing the State which the buffet is located
  • description string -- Buffet description
  • email string -- Buffet email for contacting it
  • buffet_name string -- Name of the buffet
  • payment_methods array -- An array of payment methods accepted by the buffet

EVENTS

Events are a specific catering service for a specific type of event.

Endpoints

  • /api/v1/buffets/:buffet_id/events/ -- get all the events resources from a specif buffet
  • /api/v1/events/:id/ -- get a response on weather a certain type of event is available for a certain date and guest number
    • those are mandatory params for this resource: params: {booking_date: date, guest_number: guest_number}

Example request:

http http://localhost:3000/api/v1/events/1?booking_date=2024-05-10&guest_number=20

Example response:

HTTP/1.0 200 OK
Content-Type: application/json
{
  "event_id": 1,
  "event": "Churrasco",
  "estimated_price": 2000
}

Attributtes:

  • event string -- the type of event
  • estimated_price string -- Price prediction on the event based on date and guest number

Project made during the crash course "Ruby on rails with TDD" - TreinaDev12 class by Campus Code

About

Ruby on Rails TDD project - TreinaDev12 selection by Campus Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published