/comarev

Rails API of an open source project to help Comarev, a charity organization.

Primary LanguageRubyMIT LicenseMIT

Comarev-API

rspec workflow rubocop workflow

All Contributors

This application is a partner management system. Basically, the Comarev admins register the interested companies that want to give a discount on their products/services to the Comarev contributors who are also registered in the system. Then, when the contributor buys something at the company (Comarev partner), they just have to scan a QR Code emitted in our dashboard and the system will return if they are ok with the payment (contribution), or not. If so, the contributor can get a discount.

Please check the WHO_WE_ARE section for more information.

Welcome Contributors!

Please feel free to contribute! While we welcome all contributions to this app, pull-requests that address outstanding Issues and have appropriate test coverage for them will be strongly prioritized.

Please check the Contributing section for more information.

Roadmap

Check our board for more details about what we're building.

  • Comarev API MVP

The core of this system is ready and running on production. But there are lot of improvements we can do and we need your help!

Development

Getting started

Clone the project from Github:

git clone git@github.com:comarev/comarev.git && cd comarev

Install dependencies:

bundle install

Create a .env file by copying the existing one:

cp .env.example .env

Go to the .env file and set this:

PG_HOST=<your_database_host>
PG_USERNAME=<your_database_username>
PG_PASSWORD=<your_database_password>

Prepare database.yml:

cp config/database.example.yml config/database.yml

Create the database:

bundle exec rails db:create

Run migrations:

bundle exec rails db:migrate

Run database seeds:

  # to populate with some users

  bundle exec rails db:seed

Run the server:

bundle exec rails s

Run tests:

bundle exec rspec

After running the server, you can also preview the emails at http://localhost:3000/rails/mailers.

Setup with docker

You will need to install docker-compose

Prepare database.yml & .env

cp config/database.example.yml config/database.yml && cp .env.example .env

Build the app image

docker-compose build

Database setup:

docker-compose run --rm api rails db:setup

Start the containers:

docker-compose up

Them you should have the comarev-api running on localhost:3000

There will be this users to login:

admin: admin@example.com regular: regular@example.com

with password: 123456, for both

To stop the containers run:

docker-compose down

Usage

For information concerning API usage and endpoints examples, please check the Usage section.

Application Concepts

Users

A user can be an admin, manager, emplyoee or a customer.

  • Admins are the Comarev employees and can constrol the entire system. They are able to create the other kind of users. To become an admin, the user need the admin attibute true.
  • Managers are the company managers. They can emmit their QR Code and also check if a user is able to get discount. To become a manager, the user needs to be assigned to a company.
  • Employees do the same as managers, but they can't invite other employees or manage the company config.
  • Customers are the Comarev contributors. They are supposed to pay invoices and get discounts. If the user is neither an admin nor a manager, he's a customer.

Companies

A company is a comarev partner. They offer discounts to the Comarev contributors.

Invoices

A invoice is created for a user. When all invoices are paid, the user is able to get a discount. Invoices can only be created and mark as paid by an admin user, but customers can visualize them.

Found this project interesting?

If you found this project useful, then please consider leaving a ⭐ on Github, thanks :D

Contributors ✨


Mauricio Lima

πŸ’» πŸ“–

Gabriel Belgamo

πŸ’» πŸ“–

Bruno Viveiros

πŸ’»

RenanRambul

πŸ’»

Thiago Antonello Vargas

πŸ’»

ivopozzani

πŸ’»

AntΓ΄nio Paulino

πŸ’»

Rafael Perches Pierri

πŸ’»

Mathew Thomas

πŸ’»

Rhian

πŸ’»

Wender Freese

πŸ‘€

Rodrigo Vitiello

πŸ‘€

AndrΓ© Moreira

πŸ’»

Guilherme Monteiro

πŸ’»

Edigleysson Silva

πŸ‘€

Heitor de Melo

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!