Projeto 20° da Driven Education - RepoProvas (Back)

Overview
JavaScriptLogo

RepoProvas

20th Project of Driven Education
An API to manage and storage yout tests

Built With

Project Guide

Features

  • Auth (sign-in/sign-up)
  • Create test
  • Get tests by disciplines
  • Get tests by teachers

API Reference

TL;DR
POST /sign-up

Body:

{
    "email": string,
    "password": string
}
POST /sign-in

Body:

{
    "email": string,
    "password": string
}

Response:

{
   "token": string
}
POST /tests

Headers:

{
  "Authorization": "Bearer {token}"
}

Body:

{
    "name": string,
    "pdfUrl": string,
    "categoryId": number,
    "teacherDisciplineId": number
}
GET /tests/discipline

Headers:

{
  "Authorization": "Bearer {token}"
}

Response:

[
  {
     "id": number,
     "number": number,
     "disciplines": [
        {
           "id": number,
           "name": string,
           "categories": [
              {
                 "id": number,
                 "name": string,
                 "tests": [
                    {
                      "id": number,
                      "name": string,
                      "pdfUrl": string,
                      "categoryId": number,
                      "teacherDiscipline": {
                        "discipline": {
                          "id": number
                        },
                        "teacher": {
                          "name": string
                        }
                      }
                    },
                    ...
                 ]
              },
              ...
           ]
        },
        ...
     ]
  },
  ...
]
GET /tests/teacher

Headers:

{
  "Authorization": "Bearer {token}"
}

Response:

[
  {
     "id": number,
     "number": number,
           "categories": [
              {
                 "id": number,
                 "name": string,
                 "tests": [
                    {
                      "id": number,
                      "name": string,
                      "pdfUrl": string,
                      "categoryId": number,
                      "teacherDiscipline": {
                        "discipline": {
                          "name": string
                        },
                        "teacher": {
                          "id": number
                        }
                      }
                    },
                    ...
                 ]
              },
              ...
           ]
    },
    ...
]

Sign-up

POST /sign-up

Request:

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

Password min length 6


Sign-in

POST /sign-in

Request:

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

Password min length 6


Response:

{
   "token": string
}

Create test

POST /tests

Request:

Headers Type Description
Authorization string Required. give token
Body Type Description
name string Required. test name
pdfUrl string Required. test pdfUrl
categoryId number Required. categoryId of test belong
teacherDisciplineId number Required. teacherDisciplineId of test belong

Get tests by discipline

GET /tests/discipline

Request:

Headers Type Description
Authorization string Required. give token

Response:

[
  {
     "id": number,
     "number": number,
     "disciplines": [
        {
           "id": number,
           "name": string,
           "categories": [
              {
                 "id": number,
                 "name": string,
                 "tests": [
                    {
                      "id": number,
                      "name": string,
                      "pdfUrl": string,
                      "categoryId": number,
                      "teacherDiscipline": {
                        "discipline": {
                          "id": number
                        },
                        "teacher": {
                          "name": string
                        }
                      }
                    },
                    ...
                 ]
              },
              ...
           ]
        },
        ...
     ]
  },
  ...
]

Get tests by teacher

GET /tests/teacher

Request:

Headers Type Description
Authorization string Required. give token

Response:

[
  {
     "id": number,
     "number": number,
           "categories": [
              {
                 "id": number,
                 "name": string,
                 "tests": [
                    {
                      "id": number,
                      "name": string,
                      "pdfUrl": string,
                      "categoryId": number,
                      "teacherDiscipline": {
                        "discipline": {
                          "name": string
                        },
                        "teacher": {
                          "id": number
                        }
                      }
                    },
                    ...
                 ]
              },
              ...
           ]
    },
    ...
]

Environment Variables

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

DATABASE_URL = postgres://YOUR-USER-NAME:YOUR-PASSWORD@Hostname:5432/DatabaseName

PORT = number

SECRET_KEY = any string

Run Locally

Clone the project

  git clone https://github.com/DanielL29/projeto20-repoprovas

Go to the project directory

  cd projeto20-repoprovas/

Install dependencies

  npm install

Create database

  npx prisma migrate dev
  npx prisma db seed

Start the server

  npm run dev

Lessons Learned

  • API Architecture
  • TypeScript interfaces
  • TypeScript types
  • Classes
  • Constructor
  • Object Literals
  • Manual tests
  • Integration tests

Acknowledgements

Authors

  • Daniel Lucas Ederli
You might also like...

Proyecto de encriptasion, echo para el curso de Oracle Next Education 2022

Encriptador Proyecto de Encriptador, echo para el curso de Oracle Next Education 2022. Link directo al proyecto desplegado Link al Encriptador Instruc

Dec 28, 2022

Microverse Module 02 Project: This is education project that allow user to add desire books to the list and also delete books. It makes use of local storage to preserve the data on the web browser.Built with HTML, CSS, JavaScript

Project Demo Live Demo AWESOME BOOK PROJECT Project allow user to add desire books to the list and also delete books. It makes use of local storage to

Dec 3, 2022

Gatsby-starter-minimal-blog - Typography driven, feature-rich blogging theme with minimal aesthetics.

Gatsby-starter-minimal-blog - Typography driven, feature-rich blogging theme with minimal aesthetics. Includes tags/categories support and extensive features for code blocks such as live preview, line numbers, and line highlighting.

Jan 29, 2022

io-ts Typed Event Bus for the runtime of your Node.js application. A core for any event-driven architecture based app.

Typed Event Bus Based on io-ts types, this bus provides a handy interface to publish and consume events in the current runtime of the Node.js process.

May 23, 2022

Dynamic web app 'presentations', driven by user scrolling, inspired by the NYT

Museé A small Typescript-based web app, inspired by the NYT Close Reading of Auden's Museé des Beaux Arts. Introduction I loved the NYT Close Reading

Mar 13, 2022

An event-driven architecture wrapper for Wechaty that applies the CQS principle by using separate Query and Command messages to retrieve and modify the bot state, respectively.

An event-driven architecture wrapper for Wechaty that applies the CQS principle by using separate Query and Command messages to retrieve and modify the bot state, respectively.

CQRS Wechaty An event-driven architecture wrapper for Wechaty that applies the CQS principle by using separate Query and Command messages to retrieve

Mar 23, 2022

Social media platform that hosts community-driven challenges where everyone can play and compete

Social media platform that hosts community-driven challenges where everyone can play and compete

Komo A social media platform that hosts community-driven challenges where everyone can play and compete. How To Install Komo TBA Preview Home Screen A

Jun 13, 2022

AWS Serverless Event-driven Microservices with using AWS Lambda, AWS DynamoDB, AWS API Gateway, AWS EventBridge, AWS SQS, AWS CDK stands for Cloud Development Kit for IaC — Infrastructure as Code tool and AWS CloudWatch for monitoring.

AWS Serverless Event-driven Microservices with using AWS Lambda, AWS DynamoDB, AWS API Gateway, AWS EventBridge, AWS SQS, AWS CDK stands for Cloud Development Kit for IaC — Infrastructure as Code tool and AWS CloudWatch for monitoring.

Serverless Event-driven E-commerce Microservices UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository - https://www.udemy.com/c

Jan 3, 2023

🚦Códigos do livro: Learning test-driven development

TDD Project 🚦 Códigos do livro: Learning test-driven development Pré-requisitos Será necessário a instalação do Go, Node.js, e do Python 3 para execu

Apr 19, 2022
Owner
Daniel Lucas Ederli
Student at Driven Education, Full stack developer in training
Daniel Lucas Ederli
19th project project at Driven Education.

DrivenPass 19th project project at Driven Education. A password manager API. Technologies ?? Running this project Before starting, you will need to ha

Emily Nakano 3 Nov 30, 2022
20th project project at Driven Education.

RepoProvas 20th project project at Driven Education. A system for sharing tests between students. Technologies ????‍?? Working Flow User creates a log

Emily Nakano 6 Sep 19, 2022
RepoProvas API, a system for sharing tests between students, built with Typescript, Node.js, Express, Prisma and Postgres.

Repoprovas Built With ?? Description RepoProvas API, a system for sharing tests between students, built with Typescript, Node.js, Express, Prisma and

Lucas Lima 3 Dec 13, 2022
'event-driven' library aims to simplify building backends in an event driven style

'event-driven' library aims to simplify building backends in an event driven style(event driven architecture). For message broker, light weight Redis Stream is used and for event store, the well known NoSQL database, MongoDB, is used.

Sihoon Kim 11 Jan 4, 2023
Projeto desenvolvido para o curso de desenvolvimento fullstack da escola de programação Driven.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Caio Lemos 3 Nov 11, 2022
Projeto desenvolvido para o curso de desenvolvimento fullstack da escola de programação Driven.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Caio Lemos 4 Nov 11, 2022
Kustomizegoat - Vulnerable Kustomize Kubernetes templates for training and education

KustomizeGoat - Vulnerable by design Kustomize deployment Demonstrating secure a

Bridgecrew 38 Nov 1, 2022
ZxCDDoS for education with LAYER 7, LAYER 4, AMP METHODS

?? ZxCDDoS: Release v1.0 - Free DDoS Panel ?? Terminal only accepts ANSI color. Username: admin Password: admin Language Logs Fixed L7 methods (crash,

zxcr9999 151 Jan 3, 2023
This is for homework submission of Filecoin Chinese Education Series - Coding with Filecoin.

Coding-with-Filecoin-Homework 课程简介 随着互联网和大数据技术的发展,我们正愈发依赖中心化的服务来存储和处理相关数据。但这背后有两个潜在的问题:用户不能完全控制自身数据的使用与传播,且很难验证公开数据的完整性与可靠性。为了解决这两个问题,新一代的协议和点对点网络已经问世

IPFS & Filecoin 15 Jul 14, 2022