48 Commits

Author SHA1 Message Date
Joao P Dubas
e66af1a343 chore: accept push events in CI 2022-04-23 16:47:17 +00:00
b7200555a8 feat: upgrade runtime and system dependencies (#5)
* Upgrade elixir, erlang, and postgres to their latest versions.
* Fix CI configuration, so tests are executed.
* Migrate project configuration from `Mix.Config` to `Config`.

Reviewed-on: #5
2022-04-22 15:21:25 +00:00
410a509faa chore: apply credo suggestions (#3)
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Mainly add module docs and fix some aliases.
2022-04-22 00:49:00 +00:00
49bafee50c chore: upgrade all deps (#2)
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Upgrade dependencies to their latest versions.
2022-04-21 23:29:43 +00:00
Joao P Dubas
087cfbc44a [extra-02] configure drone ci/cd
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2021-07-22 02:05:29 +00:00
Joao P Dubas
7d6a0dedf9 [extra-02] add credo action to review prs 2021-07-07 01:27:46 +00:00
Joao P Dubas
7075efb18b [extra-02] publish coverage report 2021-07-07 01:00:05 +00:00
Joao P Dubas
585ffc122e [extra-02] enable coverage tool
Even though ExCoveralls is the common library for coverage report in
elixir, we will use LcovEx because it generates lcov compatible reports
that can be used with some interesting actions in github.
2021-07-07 00:41:20 +00:00
Joao P Dubas
81628da009 [extra-02] publish test results 2021-07-06 01:23:56 +00:00
Joao P Dubas
cd2f062ef5 [extra-02] install and configure junit formatter
With this change it's possible to generate test report that can be used
alongside continuous integration routine.
2021-07-06 01:12:25 +00:00
Joao P Dubas
0614dfd608 [extra-02] check code quality and test in ci
Configure github actions to execute:
1. Code analysis with format/credo/dialyzer
2. Test with code coverage
2021-07-04 21:20:10 +00:00
Joao P Dubas
9888eebd58 [extra-02] access db using env vars
To make easier to run the app locally with docker and in CI, the
configurations were adjusted to read the database access from
environment variables:

1. POSTGRES_USER
2. POSTGRES_PASS
3. POSTGRES_HOST
2021-06-28 13:55:55 +00:00
Joao P Dubas
e493aead51 [extra-02] add code analysis deps
Add credo and dialyxr to check code analysis/quality.
2021-06-28 13:55:55 +00:00
Joao P Dubas
f07965afa4 [extra-01] use date_range to represent training period
Adjust graphql training object and input to use date_range type as a
representation for period field.
2021-06-28 13:55:55 +00:00
Joao P Dubas
24a2c516c5 [extra-01] add custom date range graphql type
This type allow graphql to work natively with postgres date range and
reduce the amount of work to convert between representations.
2021-06-28 13:55:37 +00:00
Joao P Dubas
1597d34a2d [extra-01] adjust training query to filter by period 2021-06-28 00:31:44 +00:00
Joao P Dubas
a69b771847 [extra-01] training has a period validity
We move from start/end date to a period date range to represent the
interval where a training take place.

Besides that, new constraints are added to ensure a trainings of a user
can't overlap. These constraints reflect in changeset validation.
2021-06-28 00:31:36 +00:00
Joao P Dubas
553eca56df [extra-01] add pg_ranges lib
This allow the system to use postgres range type.
2021-06-28 00:31:28 +00:00
Joao P Dubas
c0510b6760 [day-06] add license 2021-06-26 19:19:15 +00:00
Joao P Dubas
9cf73b708e [day-05] test graphql schema 2021-06-26 19:09:01 +00:00
Joao P Dubas
b1e4310672 [day-05] test imc controller 2021-06-26 19:08:37 +00:00
Joao P Dubas
36ed37bcd0 [day-05] test user changeset validation 2021-06-26 19:08:14 +00:00
Joao P Dubas
7f886a7fd0 [day-05] test imc logic 2021-06-26 19:07:51 +00:00
Joao P Dubas
da77d81200 [day-05] preload training alongside user
Preload training and exercises when fetching an user and expose this
information in graphql.
2021-06-26 18:08:29 +00:00
Joao P Dubas
5c2c588cca [day-04] expose exercise in graphql 2021-06-26 17:32:35 +00:00
Joao P Dubas
eaac531e0b [day-04] expose training in graphql 2021-06-26 17:31:59 +00:00
Joao P Dubas
d5faec5f65 [day-04] move uuid scalar import to root type
With this change, uuid4 is available to all graphql types.
2021-06-26 17:29:41 +00:00
Joao P Dubas
3c97b33d93 [day-04] configure crudry middleware to handle errors 2021-06-26 17:28:17 +00:00
Joao P Dubas
179bd7f85d [day-04] add crudry to handle absinthe errors 2021-06-26 17:26:53 +00:00
Joao P Dubas
58c4601203 [day-04] add exercise schema
So a training is a collection of exercises that have a description and a
protocol to be followed.
2021-06-26 17:26:14 +00:00
Joao P Dubas
ea5616addf [day-04] add training schema
With this we can represent a traning program for a user.
2021-06-26 17:25:53 +00:00
Joao P Dubas
96a3e2e9f0 [day-03] add mutation to create user
1. Add input type to receive user details
2. Add resolver to create user
3. Configure mutation in root type
4. Aggregate mutations in schema
2021-06-24 00:25:47 +00:00
Joao P Dubas
a54d29ee61 [day-03] configure router to expose graphql
Expose graphql schema through absinthe plug. Also expose graphiql
interface to make it easier to test graphql schema.
2021-06-24 00:23:34 +00:00
Joao P Dubas
1380b8b2e4 [day-03] create schema to aggregate root fields
Expose root query in graphql schema.
2021-06-24 00:22:12 +00:00
Joao P Dubas
b7cbcbd51f [day-03] create root type to define queries
Expose the query to get a specific user.
2021-06-24 00:20:13 +00:00
Joao P Dubas
289901b0c9 [day-03] create resolver to fetch user
This resolver is required to create a graphql query to get users.
2021-06-24 00:17:53 +00:00
Joao P Dubas
425c3eafc2 [day-03] expose id in user schema
Use uuid custom scalar to represent the user id.
2021-06-24 00:12:17 +00:00
Joao P Dubas
c5612f9398 [day-03] create custom scalar for uuid
Graphql doesn't support uuid natively. So, we must create a custom
scalar to handle this type.
2021-06-24 00:10:17 +00:00
Joao P Dubas
8787973075 [day-03] create user schema
Add user type to represent entity in graphql.
2021-06-24 00:09:54 +00:00
Joao P Dubas
b543e241b0 [day-03] enable absinthe formatter 2021-06-24 00:04:19 +00:00
Joao P Dubas
424bfa917e [day-03] install absinthe dependency
Yeah, it's time to work with graphql in elixir.
2021-06-24 00:03:34 +00:00
Joao P Dubas
3709cd265a [day-02] add context to create/get a user
Create context module to create and fetch a user.
2021-06-22 23:57:10 +00:00
Joao P Dubas
d578bc6cf3 [day-02] validate user input
Also improve migration to reflect requirements in validation done
through `Ecto.Changeset`.
2021-06-22 23:56:07 +00:00
Joao P Dubas
97af827bc2 [day-02] add user schema and migration
Add elixir struct to represent an user and its corresponding
representation on the database.
2021-06-22 23:55:02 +00:00
Joao P Dubas
cebce7da42 [day-02] configure repo to use uuid type as id 2021-06-22 23:50:52 +00:00
Joao P Dubas
fc73f30dd0 [day-01] setup imc calc and route 2021-06-22 01:56:40 +00:00
Joao P Dubas
8658384030 [day-01] phoenix project setup
Create new phoenix project
2021-06-22 01:55:16 +00:00
Joao P Dubas
f02c0ff310 [day-00] base infra for the project 2021-06-22 01:52:43 +00:00