You can read the project requirements here
- PostgreSQL 14.2
- Ruby 3.1.3
docker pull postgres:14.2
docker volume create working_schedule
docker container create --name working_schedule --publish 5432:5432 --env POSTGRES_USER=postgres --env POSTGRES_PASSWORD=password --volume working_schedule:/var/lib/postgresql/data postgres:14.2
docker start working_schedule
cp .env.example .env
bin/rake db:create db:schema:load
bin/rails test
bin/rubocop
bin/rails zeitwerk:check
The project uses gem Grape to build a REST gateway.
app/gateways # Entry point, should contain supported gateways REST, GraphQL and etc
└── rest # The folder for the REST gateway
├── api # API Endpoints
├── api.rb # API Endpoints entry point
├── serialization # Response data serialization
├── services # Operations specific for the REST gateways
└── validation # Endpoints request validations
app/models # Main entities
├── admin.rb # Super user with access to all the operations
├── authentication.rb # Credentials store
├── organization.rb # An entity for grouping workers
├── shift.rb
└── worker.rb
app/policies # Project policies
app/operations # Domain operations that are independent from any gateway
Since the project is based on Grape it can generate "some" Swagger-compatible documentation for no cost. To get all the possible endpoints:
- Start your local server
- Visit
/api/swagger
- Grab the response JSON
- Paste it into the swagger redactor on
NOTE The swagger documentation contains only the endpoints WITHOUT the input parameters and the response type. The input parameters are described by validation contracts in every endpoint. The output parameters are represent by gateway serializers.
Even though, the project has a comprehensive policy layer, the easiest way of
accessing endpoints is using admin credentials.
Just run the following command and put its output to
Authorization
header in your REST API Client.
ADMIN_USERNAME=admin ADMIN_PASSWORD=password bin/rake admin:create