Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raulpe7eira/wabanex
nlw#6 - trilha elixir from rocketseat by Rafael Camarda
https://github.com/raulpe7eira/wabanex
absinthe crudry ecto elixir graphql nlw nlw-6-elixir phoenix postgresql rocketseat
Last synced: about 2 months ago
JSON representation
nlw#6 - trilha elixir from rocketseat by Rafael Camarda
- Host: GitHub
- URL: https://github.com/raulpe7eira/wabanex
- Owner: raulpe7eira
- Created: 2021-12-18T14:55:43.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-18T23:49:44.000Z (12 months ago)
- Last Synced: 2024-02-19T00:57:29.041Z (12 months ago)
- Topics: absinthe, crudry, ecto, elixir, graphql, nlw, nlw-6-elixir, phoenix, postgresql, rocketseat
- Language: Elixir
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wabanex API
This repository is the code corresponding to the [nlw#6 - trilha elixir](https://nextlevelweek.com/) lab by Rafael Camarda.
> The project simulates a Gym Training management API that allows to register trainings and exercises with GraphQL.
## Previous installations
**Database**, we recommends install [PostgreSQL](https://www.postgresql.org/) with [Docker](https://hub.docker.com/_/postgres). After that, sets connection configuration at:
- `config/dev.exs`
- `config/test.exs`## Gets dependencies, setups database, tests, coverages, reports and starts application
```bash
cd wabanex
mix deps.get
mix ecto.setup
mix test
mix test --cover
mix phx.server
```## How to use?
```bash
# calculate imc (
# replaces curly braces:
# {filename} : file name (e.g.: students.csv)
# )
curl -X GET 'http://localhost:4000/api?filename={filename}'# provides resources graphql
curl -X POST 'http://localhost:4000/api/graphql'# provides resources graphql with web development interface
curl -X POST 'http://localhost:4000/api/graphiql'
```### Resources GraphQL
```bash
# creates user
mutation {
createUser(input: {
name: "beltrano",
email: "[email protected]",
password: "123"
}) {
id
}
}# creates training
mutation {
createTraining(input: {
endDate: "2021-12-12",
startDate: "2021-12-11",
userId: "b4156e52-79d7-4625-a411-b3535f376d49",
exercises: [
{
name: "Triceps",
youtubeVideoUrl: "https://youtuba.com/fulano",
repetitions: "3x15",
protocolDescription: "drop-set"
},
{
name: "Biceps",
youtubeVideoUrl: "https://youtuba.com/fulano",
repetitions: "4x15",
protocolDescription: "drop-set"
}
]
}) {
id
}
}# retrieves user
{
getUser(id: "b4156e52-79d7-4625-a411-b3535f376d49") {
id
name
trainings {
id
startDate
endDate
exercises {
id
name
youtubeVideoUrl
repetitions
protocolDescription
}
}
}
}
```