- Run
chmod +x entrypoint.sh
to make the entrypoint executable - Run
docker compose build
to build the docker image and run the container then rundocker compose up
. - Run
docker compose run web rake db:create
to create the database - Run
docker compose run web rake db:migrate
to run the migrations - Run
docker compose run web rake db:seed
to seed the database - Run
docker compose run web rake db:seed RAILS_ENV=test
to seed the test database - Run
docker compose run web rspec
to run the tests - Run
docker compose run --service-ports web
to run the server - Run
docker compose down
to stop the server - Run
docker compose run web bash
to run bash in the container -> From here you also can interact with the database usingrails c
orrails dbconsole
Here are we have the API endpoints that you can use to interact with the application:
We have the collection for apis for POSTMAN in This Link: https://api.postman.com/collections/2329385-c37ec82d-f743-4240-ac4d-4deb31c48408?access_key=PMAT-01HGR2EC22KXJ4ZW2NH7CR6BKJ
Here we are attaching an ERD representation of the database schema:
- Entity-Relationship Diagram (ERD)
+----------------+ +------------------+ +---------------+
| businesses | | buy_orders | | users |
+----------------+ +------------------+ +---------------+
| id |<------| id | | id |
| name | | quantity | | email |
| shares_available| | price | | password_digest|
| owner_id |------>| buyer_id |<------| first_name |
| created_at | | business_id | | last_name |
| updated_at | | status | | created_at |
| status | | created_at | | updated_at |
+----------------+ | updated_at | +---------------+
+------------------+
- Added Unit Tests for all the models
- Added Integration Tests for all the controllers
You can check the coverage by running docker compose run web rspec
and then opening the coverage/index.html
file in your browser.
Estimated Coverage: > 95%
There are few variation for this single application available right now on three different branches:
main
-> has the basic implementation of the application, with controller providing the API responses.fast_json_api
-> has the implementation of the application using fast_json_api, with controller -> serializer providing the API responses.jbuilder
-> has the implementation of the application using jbuilder, with controller -> jbuilder views providing the API responses. (This branch does not have the proper test coverage yet. You will have to use the POSTMAN collection to test the endpoints.)