Skip to content

LuizFerK/Wabanex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Wabanex

Author Languages Stars Forks Contributors

Track your workouts!
Created with Elixir, Phoenix and Absinthe.
Made with ❤️


📌 Contents

🚀 Features

  • Create and get users
  • Create training and exercise tracking

🔧 Installation

Required ⚠️

  • Elixir
  • Erlang
  • Phoenix
  • Postgres database

SSH

SSH URLs provide access to a Git repository via SSH, a secure protocol. If you have an SSH key registered in your GitHub account, clone the project using this command:

git clone [email protected]:LuizFerK/Wabanex.git

HTTPS

In case you don't have an SSH key on your GitHub account, you can clone the project using the HTTPS URL, run this command:

git clone https://github.com/LuizFerK/Wabanex.git

Both of these commands will generate a folder called Wabanex, with all the project

💡 Getting started

  1. Run mix deps.get to install the dependencies
  2. Create a postgres database named wabanex
  3. On the config/dev.exs and config/test.exs files, change your postgres user and password
  4. Run mix ecto.migrate to run the migrations to your database
  5. Run mix phx.server to start the server on port 4000

🚩 GraphQL API

http://localhost:4000/api/graphql

http://localhost:4000/api/graphiql (Absinthe GraphiQL interface)

Users

  • 🟢 Create

    • Request

       mutation {
         createUser(input: {
           name: "John Doe", 
           email: "[email protected]",
           password: "123456"
         }) {
           id
           name
         }
       }
    • Response

       {
         "data": {
           "createUser": {
             "id": "4b2c733d-541d-4cdf-bd27-40ea3f03aa48",
             "name": "John Doe"
           }
         }
       }
  • 🟣 Get

    • Request:

       query {
         getUser(id: "4b2c733d-541d-4cdf-bd27-40ea3f03aa48") {
           id
           name
           email
           trainings {
             startDate
             endDate
             exercises {
               name
               repetitions
             }
           }
         }
       }
      
    • Response

       {
         "data": {
           "getUser": {
             "email": "[email protected]",
             "id": "4b2c733d-541d-4cdf-bd27-40ea3f03aa48",
             "name": "John Doe",
             "trainings": [
               {
                 "endDate": "2021-11-21",
                 "exercises": [
                   {
                     "name": "Triceps banco",
                     "repetitions": "4x12"
                   },
                   {
                     "name": "Triceps corda",
                     "repetitions": "5x12"
                   }
                 ],
                 "startDate": "2021-10-21"
               }
             ]
           }
         }
       }

Trainings

  • 🟢 Create

    • Request

       mutation {
         createTraining(input: {
           userId: "4b2c733d-541d-4cdf-bd27-40ea3f03aa48",
           startDate: "2021-10-21",
           endDate: "2021-11-21",
           exercises: [
             {
               name: "Triceps banco",
               youtubeVideoUrl: "youtube.com",
               protocolDescription: "drop-set",
               repetitions: "4x12"
             },
             {
               name: "Triceps corda",
               youtubeVideoUrl: "youtube.com",
               protocolDescription: "drop-set",
               repetitions: "5x12"
             }
           ]
         }) {
           id,
           exercises {
             id,
             name
           }
         }
       }
    • Response

       {
         "data": {
           "createTraining": {
             "exercises": [
               {
                 "id": "348bd17b-92cd-487d-b043-65594680c19c",
                 "name": "Triceps banco"
               },
               {
                 "id": "7b23b24a-95ad-4cb6-a8c2-f30fda4213cb",
                 "name": "Triceps corda"
               }
             ],
             "id": "f5fadab4-49d8-4682-a514-f447eab897f1"
           }
         }
       }

🔥 Techs

Elixir (language)

Phoenix (web framework)

  • Ecto
  • Absinthe (GraphQL)
  • Crudry (Error handling)

🐛 Issues

Find a bug or error on the project? Please, feel free to send me the issue on the Wabanex issues area, with a title and a description of your found!

If you know the origin of the error and know how to resolve it, please, send me a pull request, I will love to review it!

📖 License

Released in 2021.

This project is under the MIT license.

< keep coding /> 🚀 ❤️