Sup3r-Us3r / gympass-api

GymPass API using Node.js + TypeScript + SOLID + Tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App

GymPass API in Node.js + TypeScript that applies SOLID concepts and has unit and E2E tests.

Functional Requirements

  • It must be possible to register;
  • It must be possible to authenticate;
  • It must be possible to get the profile of a logged in user;
  • It must be possible to obtain the number of check-ins performed by the logged in user;
  • It must be possible for the user to obtain their check-in history.
  • It should be possible for the user to search for nearby gyms up to 10km away;
  • It should be possible for the user to search for gyms by name;
  • User must be able to check into a gym.
  • It must be possible to validate a user's check-in;
  • It must be possible to register a gym;

Business Rules

  • The user must not be able to register with a duplicate email;
  • The user cannot make 2 check-ins on the same day;
  • User cannot check-in if they are not near (100m) the gym;
  • Check-in can only be validated up to 20 minutes after creation;
  • The check-in can only be validated by administrators;
  • The academy can only be registered by administrators;

Non-functional Requirements

  • User password must be encrypted;
  • The application data must be persisted in a PostgresSQL database;
  • All data lists need to be paginated with 20 items per page;
  • The user must be identified by a JWT (Json Web Token);

Setup

Run the PostgreSQL container:

$ docker-compose up -d

Create an .env file:

$ cp .env.example .env

Edit this file and set the values for the requested environment variables, example:

# Node
NODE_ENV="development"

#Auth
JWT_SECRET="your-secret"

# Database
DATABASE_URL="postgresql://docker:docker@localhost:5432/solidapi?schema=public"

Run app

$ npm run dev

Build app

$ npm run build

Run tests

Run unit tests

$ npm run test

Run E2E tests

$ npm run test:e2e

Generate coverage

$ npm run test:coverage

About

GymPass API using Node.js + TypeScript + SOLID + Tests

License:MIT License


Languages

Language:TypeScript 99.9%Language:Shell 0.1%