A buffet system application project using Ruby on Rails.
Table of Contents
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.
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
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.
- Devise - Authentication
- cpf_cnpj - Brazilian ID validation
- rspec-rails - testing
- Capybara - system testing
- simplecov - test analytics
- Install Ruby 3.2.3.
- Clone this repository
- Once inside the project folder run
bundle install
- Run
rails db:migrate
- Run
rails db:seed
to create vital models for application. - Run
rails s
to start server. - Go to
localhost:3000
to access Cadê Buffet Application
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
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:
- Email: [email protected]
- Password: safestpasswordever
here are the credentials to log as Client User:
- Email: [email protected]
- Password: safestpasswordever
There are two roles in the system: Company and Client.
Company can:
- Create, Edit Buffet
- Create, Edit, Delete Events
- Create, Edit, Delete Event Pricings
- Accept orders issued by clients countering with a budget offer
- Cancel orders
- Activate/Deactivate Buffet and it's events
Clients can:
- Search Buffets by name, city or event
- Check Buffet details
- Check events details
- Create event orders
- Accept budget offer for order
- Cancel order on pending and awaiting status
- Rate buffets
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.
Cadê Buffet is a completely open API. No authentication is required to query and get data.
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}
- this resource accepts a Search Field
/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 numberzip_code
string -- Code from the buffet location areaadress
string -- Buffet adressneighborhood
string -- Neighborhood from where the buffet is locatedcity
string -- City from where the buffet is locatedstate_code
string -- 2 letter code representing the State which the buffet is locatedstate_code
string -- 2 letter code representing the State which the buffet is locateddescription
string -- Buffet descriptionemail
string -- Buffet email for contacting itbuffet_name
string -- Name of the buffetpayment_methods
array -- An array of payment methods accepted by the buffet
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}
- those are mandatory params for this resource:
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 eventestimated_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