projeto20-RepoProvas

A Typescript designed project to manage previous testes between students

RepoProvas

Built With


Description

Valex simulates an API that manages a benefit card, generally made available by companies to their employees.


Features

  • Register
  • Login
  • Create cards
  • Activate / Block / Unlock a card
  • Recharge a card
  • Make card payments with online payment option

API Reference

Sign-Up

POST /user/register

Request:

Params Type Description
email string Required. User email
password string Required. User password
confirmPassword string Required. Confirm password

Sign-In User

POST /user/login

Request:

Body Type Description
email string Required. User email
password string Required. User password

Valid types: [groceries, restaurant, transport, education, health]


Response:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjIsImlhdCI6MTY2MzQ3ODM4MH0.tGgIaowvK0Ha4S9cSTkkiWH3Zr-9P_GeUsnkE3_oTqw

The token as string

Create an exam file

POST /exams/add

Request:

Headers Type Description
Authorization string Required. Token

Body Type Description
name string Required. Title of the file
pdfUrl string Required. Link of the pdf
categorie string Required. Name of the categorie
discipline string Required. Name of the discipline
teacher string Required. Name of the teacher

pdfUrl: A link.

categorie: Only the ones created previously in the DB(Projeto / Prática / Recuperação).

discipline: Only the ones created previously in the DB (HTML e CSS / JavaScript / React / Humildade / Planejamento / Autoconfiança).

teacher: Only the ones created previously in the DB and they have to teach the discipline (Diego Pinho / Bruna Hamori).

Get exams by each term

GET /examsByTerms

Request:

Headers Type Description
Authorization string Required. Token

Get exams by each teacher

GET /examsByTeachers

Request:

Headers Type Description
Authorization string Required. Token

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

DATABASE_URL = postgres://UserName:Password@Hostname:5432/DatabaseName

PORT = number #recommended:5000

CRYPTR_SECRET= hashed word

JWT_SECRET= unhashed word


Run Locally

Clone the project

  git clone https://github.com/IgorFontenell/Projeto_20-RepoProvas

Go to the project directory

  cd projeto_20-RepoProvas/

Install dependencies

  npm install

Create database

  cd src/db/dbConfig
  bash ./create-database
  cd ../../..

Start the server

  npm run start

Lessons Learned

In this project I trained the TypeScript way of coding with interfaces and Types, how to work with Prisma as ORM and trained the Layered Structure. I learned as well how to set an file of automatic tests for the API how to make a project following the Layered Architecture.


Acknowledgements


Authors

  • Igor Fontenelle is a student at Driven Education putting a lot of effort into the programing world. He is looking for the transiction of the engineering world to be a Dev.