Implement and API that allow to manage (publish, modify, delete, vote and filter) trainings on a gym. run
$npm i
to install the necessary dependencies, then run the following command to initialize the data base
$npm run db
and last to start the server run
$npm run dev
- Admin role -he/she can do every action in the application
- Trainer role
- he/she can add, delete and modify trainings and also list users.
- Registered role
- Log in
- They can get a list of trainings, see the info of an training and vote them.
- Unregistered role
- Log in
- Register
- They only can log in and register
-
USERS - Can be admin type, trainer type or user type
- id
- name
- password
- role
- createdAt
- modifiedAt
-
TRAININGS - Contains information about the trainings.
- id
- userId
- name
- description
- picture
- typology
- muscle group
- votes
- createdAt
- modifiedAt
-
PLANS - Contains information about the plans.
- id
- name
- description
- typology
- trainingId
- trainerId
- userId
- createdAt
- modifiedAt
-
LIKES - Contains the likes the users give to an training
- id
- userId
- trainingId
-
planTrainings Contains information about the trainings in a plan
- id
- planId
- trainingId
- sets
- reps
- createdAt
- modifiedAt
- DELETE > [/users/:userId] - delete
- DELETE > [/trainings/trainingId:]
- POST > [/trainings/add] - Add training. [ With trainer token ]
- GET > [/trainings/:trainingId] - Add training. [ With trainer token ]
- PUT > [/trainings/:trainingId/modify] - Modify training [ With trainer token ]
- DELETE > [/trainings/:trainingId/delete] - Delete training [ With trainer token ]
- GET > [/trainings/] - Show trainings list. [ With token ]
- GET > [/trainings/:trainingId] - Show a training information. [ With token ]
- GET > [/trainings?category=typology] - Filter trainings by typology. [ With token ]
- POST > [/register] - create a new user.
- POST > [/login/] - Log in
- bcrypt
- dotenv
- express
- express-fileupload
- jsonwebtoken
- mysql2
- sharp
- nanoid