- Auth (sign-in/sign-up)
- Create test
- Get tests by disciplines
- Get tests by teachers
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
}
}
},
...
]
},
...
]
},
...
]
POST /sign-up
Body | Type | Description |
---|---|---|
email |
string |
Required. user email |
password |
string |
Required. user password |
Password min length 6
POST /sign-in
Body | Type | Description |
---|---|---|
email |
string |
Required. user email |
password |
string |
Required. user password |
Password min length 6
{
"token": string
}
POST /tests
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/discipline
Headers | Type | Description |
---|---|---|
Authorization |
string |
Required. give token |
[
{
"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 | Type | Description |
---|---|---|
Authorization |
string |
Required. give token |
[
{
"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
}
}
},
...
]
},
...
]
},
...
]
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
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
- API Architecture
- TypeScript interfaces
- TypeScript types
- Classes
- Constructor
- Object Literals
- Manual tests
- Integration tests
- Daniel Lucas Ederli