/gympass-api

Primary LanguageTypeScriptMIT LicenseMIT

Gympass API

GitHub language count Repository size GitHub last commit License Stargazers

🚧 Gympass API 💪🏼 Completed 🚀 🚧

OverviewFeaturesRun ProjectRun TestsTechnologiesAuthorLicense


📝 Overview

Functional Requirements

  • It should be possible to register.
  • It should be possible to authenticate.
  • It should be possible to retrieve the profile of a logged-in user.
  • It should be possible to retrieve the number of check-ins performed by the logged-in user.
  • It should be possible for the user to retrieve their check-in history.
  • It should be possible for the user to search for nearby gyms (up to 10km).
  • It should be possible for the user to search for gyms by name.
  • It should be possible for the user to check-in at a gym.
  • It should be possible to validate a user's check-in.
  • It should be possible to register a gym.

Business Rules

  • The user should not be able to register with a duplicate email.
  • The user cannot make 2 check-ins on the same day.
  • The user cannot check-in if they are not near (100m) the gym.
  • The check-in can only be validated up to 20 minutes after it was created.
  • The check-in can only be validated by administrators.
  • The gym can only be registered by administrators.

Non-functional Requirements

  • The user's password needs to be encrypted.
  • The application data needs to be persisted in a PostgreSQL database.
  • All data lists need to be paginated with 20 items per page.
  • The user should be identified by a JSON Web Token (JWT).

🚀 Run Project

1️⃣ Clone o projeto e acesse sua pasta:

$ git clone https://github.com/jtiagosantos/gympass-api.git
$ cd gympass-api

2️⃣ Instale as dependências:

$ npm i

3️⃣ Inicie o banco de dados:

$ docker-compose up -d

4️⃣ Defina as variáveis de ambiente:

NODE_ENV="development"

# Auth
JWT_SECRET=""

# Database
DATABASE_URL=""

5️⃣ Execute as migrations:

$ npx prisma db push

6️⃣ Inicie o servidor:

$ npm run dev

⚡ Run Tests

✅ Testes unitários (execução única):

$ npm run test

✅ Testes unitários (modo watch):

$ npm run test:watch

✅ Testes E2E (execução única):

$ npm run test:e2e

✅ Testes E2E (modo watch):

$ npm run test:e2e:watch

✅ Cobertura:

$ npm run test:coverage

🛠 Technologies

The following tools were used in the construction of project:


👨‍💻 Author

Tiago Santos

Tiago Santos 🚀

Linkedin Badge Gmail Badge


📝 License

This project is under license MIT.