-
Notifications
You must be signed in to change notification settings - Fork 0
PR de Correção #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: correcao
Are you sure you want to change the base?
PR de Correção #10
Changes from all commits
2e4809c
bf1a2c8
08eb747
8ee865e
95380e9
8716246
e972d5a
8c54217
24974ad
09a08db
26ab932
048407c
b9d250d
1deaf92
bda6f85
34e3ae7
4f4f2b0
efa2f14
eefbace
f864d16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,62 @@ | ||
| ## LabenuSystem: | ||
| <h1 align="center"> 💻 LabeSystem 💻</h1> | ||
|
|
||
| Você estuda na Labenu_ há tanto tempo que já parecem anos, não é? Então, hoje, vamos pedir para criar um sistema que represente o básico da nossa organização. | ||
| <h2 align="center"> 📃 Sobre 📃</h2> | ||
| <p align="justify"> Projeto de backend desenvolvido conforme proposta da Labenu para criação de uma API para um sistema de uma escola de programação.</p> | ||
|
|
||
| Ele deve possuir, ao menos, as 3 entidades importantes: | ||
| Esse sistema possui 3 entidades importantes: | ||
|
|
||
| 1. Estudantes | ||
| <h3> Estudantes </h3> | ||
|
|
||
| Representa estudantes da nossa instituição. Eles devem possuir: id, nome, email, data de nascimento e os principais hobbies dele. | ||
| <p> Representa estudantes da instituição. Eles possuem: id, nome, email, data de nascimento e os principais hobbies deles. </p> | ||
|
|
||
| 2. Docente | ||
| <h3> Docente </h3> | ||
|
|
||
| Representa docentes da nossa instituição. Eles devem possuir: id, nome, email, data de nascimento e todas as especialidades dele. Há 7 especialidades: React, Redux, CSS, Testes, Typescript, Programação Orientada a Objetos e Backend | ||
| <p> Representa docentes da instituição. Eles possuem: id, nome, email, data de nascimento e todas as especialidades deles. Há 5 especialidades: React, JS, CSS, Typescript, POO. </p> | ||
|
|
||
| 3. Turma | ||
| <h3> Turma </h3> | ||
|
|
||
| Toda turma é composta das seguintes características: id, nome, data de início, data de término, lista de professores responsáveis, uma lista de alunos e módulo atual em que a turma está. | ||
| <p> Toda turma é composta das seguintes características: id, nome e módulo atual em que a turma está. </p> | ||
| <p> O módulo pode assumir os valores de 1 a 6, ou 0, indicando que as aulas dessa turma ainda não começaram. </p> | ||
|
|
||
| O módulo pode assumir os valores de 1 a 7 ou `undefined`, indicando que as aulas dessa turma ainda não começaram. Para esse exercício, vamos considerar que existam dois tipos de turma: integral ou noturna. Há uma restrição para o nome das turmas noturnas: tem que terminar com `-na-night`. | ||
| <h2 align="center"> 📝 Documentação 📝 </h2> | ||
|
|
||
| As funcionalidades básicas são: | ||
| <p> https://documenter.getpostman.com/view/19721031/UzXKXeSC </p> | ||
|
|
||
| → Criar estudante; | ||
| <h2 align="center"> ✅ O que funciona ✅ </h2> | ||
|
|
||
| → Criar docente; | ||
| * Criar estudante; | ||
| * Criar docente; | ||
| * Criar turma; | ||
| * Mudar aluno de turma; | ||
| * Mudar docente de turma; | ||
| * Mudar módulo da turma; | ||
| * Buscar alunos; | ||
| * Buscar docentes; | ||
| * Buscar todas as turmas; | ||
| * Buscar turmas ativas; | ||
|
|
||
| → Criar turma; | ||
| <h2 align="center"> 🛠 Em desenvolvimento 🛠 </h2> | ||
|
|
||
| → Adicionar estudante na turma; | ||
| * Ao buscar alunos não é exibido a lista de hobbies deles. | ||
| * Ao buscar docentes não é exibido a lista de especialidades deles. | ||
|
|
||
| → Adicionar docente na turma; | ||
| <h2 align="center">👨💻 Desenvolvedores 👩💻</h2> | ||
|
|
||
| → Pegar a idade de algum estudante a partir do id | ||
| <table align="center"> | ||
| <tr> | ||
|
|
||
| <td align="center"><a href="https://github.com/tiagohennig"><img style="border-radius: 50%" src="https://avatars.githubusercontent.com/u/86529848?v=4" width="100px" alt=""/> | ||
| <br /> | ||
| <sub><b>Tiago Hennig</b></sub></a> <a href="https://github.com/tiagohennig"></a></td> | ||
|
|
||
| <td align="center"><a href="https://github.com/raul-rita"><img style="border-radius: 50%" src="https://avatars.githubusercontent.com/u/93088559?v=4" width="100px" alt=""/> | ||
| <br /> | ||
| <sub><b>Raul Rita</b></sub></a> <a href="https://github.com/raul-rita"></a></td> | ||
|
|
||
| <td align="center"><a href="https://github.com/Maria-Karolina"><img style="border-radius: 50%" src="https://avatars.githubusercontent.com/u/88107710?v=4" width="100px" alt=""/> | ||
| <br /> | ||
| <sub><b>Maria Karolina Freitas </b></sub></a> <a href="https://github.com/Maria-Karolina"></a></td> | ||
|
|
||
| </tr> | ||
|
|
||
| </table> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules | ||
| package-lock.json | ||
| build | ||
| .env |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "name": "labenu-system", | ||
| "version": "1.0.0", | ||
| "description": "", | ||
| "main": "index.js", | ||
| "scripts": { | ||
| "dev": "ts-node-dev ./src/index.ts", | ||
| "start": "node ./build/index.js", | ||
| "build": "tsc" | ||
| }, | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC", | ||
| "dependencies": { | ||
| "cors": "^2.8.5", | ||
| "dotenv": "^16.0.1", | ||
| "express": "^4.18.1", | ||
| "knex": "^2.1.0", | ||
| "mysql": "^2.18.1", | ||
| "uuid": "^8.3.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/cors": "^2.8.12", | ||
| "@types/express": "^4.17.13", | ||
| "@types/knex": "^0.16.1", | ||
| "@types/node": "^18.0.6", | ||
| "@types/uuid": "^8.3.4", | ||
| "ts-node-dev": "^2.0.0", | ||
| "typescript": "^4.7.4" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| -- Active: 1658325348046@@35.226.146.116@3306@guimaraes-4211089-raul-rita | ||
| USE `guimaraes-4211089-raul-rita`; | ||
|
|
||
| CREATE TABLE LS_Turma( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| nome VARCHAR(255) NOT NULL, | ||
| modulo ENUM('0','1','2','3','4','5','6') DEFAULT '0' | ||
| ); | ||
|
|
||
| CREATE TABLE LS_Estudante( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| nome VARCHAR(255) NOT NULL, | ||
| email VARCHAR(255) NOT NULL UNIQUE, | ||
| data_nasc VARCHAR(255) NOT NULL, | ||
| turma_id VARCHAR(255), FOREIGN KEY (turma_id) REFERENCES LS_Turma(id) | ||
| ); | ||
|
|
||
| CREATE TABLE LS_Hobby ( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| nome_hobby ENUM("assistir séries de tv", "jogar videogames", "sair com os amigos", "praticar esportes") NOT NULL | ||
| ); | ||
|
|
||
|
|
||
|
|
||
| CREATE TABLE LS_Hobby_Estudante( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| id_estudante VARCHAR(255), FOREIGN KEY(id_estudante) REFERENCES LS_Estudante(id), | ||
| id_hobby VARCHAR(255), FOREIGN KEY(id_hobby) REFERENCES LS_Hobby(id) | ||
| ); | ||
| SELECT * FROM `LS_Hobby_Estudante`; | ||
|
|
||
| CREATE TABLE LS_Docente( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| nome VARCHAR(255) NOT NULL, | ||
| email VARCHAR(255) NOT NULL UNIQUE, | ||
| data_nasc VARCHAR(255) NOT NULL, | ||
| turma_id VARCHAR(255), FOREIGN KEY (turma_id) REFERENCES LS_Turma(id) | ||
| ); | ||
|
|
||
| SELECT * FROM `LS_Docente_Especialidade`; | ||
|
|
||
| CREATE TABLE LS_Especialidade ( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| nome_especialidade ENUM("JS", "CSS", "React", "Typescript", "POO") NOT NULL | ||
| ); | ||
|
|
||
| ALTER TABLE `LS_Especialidade` | ||
| MODIFY COLUMN nome_especialidade VARCHAR(255) NOT NULL; | ||
| SELECT * FROM `LS_Especialidade`; | ||
|
|
||
| CREATE TABLE LS_Docente_Especialidade ( | ||
| id VARCHAR(255) PRIMARY KEY, | ||
| id_docente VARCHAR(255), FOREIGN KEY(id_docente) REFERENCES LS_Docente(id), | ||
| id_especialidade VARCHAR(255), FOREIGN KEY(id_especialidade) REFERENCES LS_Especialidade(id) | ||
| ); | ||
|
|
||
| ALTER TABLE `LS_Turma` | ||
| MODIFY COLUMN modulo VARCHAR(255) NOT NULL DEFAULT 0; | ||
|
|
||
| SELECT * FROM `LS_Turma`; | ||
|
|
||
| SELECT * FROM LS_Turma INNER JOIN `LS_Estudante` ON LS_Turma.id = LS_Estudante.turma_id; | ||
|
|
||
| INSERT INTO `LS_Especialidade`(id,nome_especialidade) VALUES ("1", "react"); | ||
| INSERT INTO `LS_Especialidade`(id,nome_especialidade) VALUES ("2", "js"); | ||
| INSERT INTO `LS_Especialidade`(id,nome_especialidade) VALUES ("3", "css"); | ||
| INSERT INTO `LS_Especialidade`(id,nome_especialidade) VALUES ("4", "typescript"); | ||
| INSERT INTO `LS_Especialidade`(id,nome_especialidade) VALUES ("5", "poo"); | ||
|
|
||
|
|
||
| SELECT nome, nome_hobby | ||
| FROM LS_Hobby_Estudante | ||
| INNER JOIN LS_Estudante | ||
| ON LS_Hobby_Estudante.id_estudante = LS_Estudante.id | ||
| INNER JOIN LS_Hobby | ||
| ON LS_Hobby_Estudante.id_hobby = "8c1fa295-c2b9-4e9f-b62e-7ab486f546af"; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| POST http://localhost:3003/turma/ | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "nome": "abc", | ||
| "modulo": "5" | ||
| } | ||
|
|
||
| ### | ||
|
|
||
| POST http://localhost:3003/estudante/ | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "nome": "Maria Karolina", | ||
| "email": "mariakarolina@email.com", | ||
| "data_nasc": "28/06/1993", | ||
| "turma_id": "b555b321-8c42-4fab-9083-022c83b965d6", | ||
| "hobby": ["Programar", "Nadar", "Dançar"] | ||
| } | ||
|
|
||
| ### | ||
|
|
||
| POST http://localhost:3003/docente/ | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "nome": "Juliana", | ||
| "email": "juliana@email.com", | ||
| "data_nasc": "28/06/1990", | ||
| "turma_id": "b555b321-8c42-4fab-9083-022c83b965d6", | ||
| "especialidade": ["React", "JS", "poo"] | ||
| } | ||
|
|
||
| ### | ||
|
|
||
| GET http://localhost:3003/turma/ativa | ||
|
|
||
| ### | ||
|
|
||
| GET http://localhost:3003/turma/ | ||
|
|
||
| ### | ||
|
|
||
| Get http://localhost:3003/estudante/?nome= | ||
|
|
||
| ### | ||
|
|
||
| GET http://localhost:3003/docente/ | ||
|
|
||
| ### | ||
|
|
||
|
|
||
|
|
||
| PUT http://localhost:3003/turma/guimaraes | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "modulo": "1" | ||
| } | ||
|
|
||
| ### | ||
|
|
||
| PUT http://localhost:3003/estudante/ | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "id": "a28cafd1-88e4-42b5-951a-1c075d08b8dd", | ||
| "turma": "joy" | ||
| } | ||
|
|
||
| ### | ||
|
|
||
| PUT http://localhost:3003/docente/ | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "id": "00800266-93f3-4d5c-b93d-3b6348afd150", | ||
| "turma": "joi" | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import express from "express"; | ||
| import cors from "cors" | ||
| import { AddressInfo } from "net"; | ||
|
|
||
| const app = express(); | ||
|
|
||
| app.use(express.json()); | ||
| app.use(cors()); | ||
|
|
||
| const server = app.listen(process.env.PORT || 3003, () => { | ||
| if (server) { | ||
| const address = server.address() as AddressInfo; | ||
| console.log(`Server is running in http://localhost: ${address.port}`); | ||
| } else { | ||
| console.error(`Failure upon starting server.`); | ||
| } | ||
| }); | ||
|
|
||
| export default app; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { User } from "./User" | ||
|
|
||
|
|
||
| export class Docente extends User { | ||
|
|
||
| public especialidade?: string[] | ||
|
|
||
| constructor( | ||
| id:string, | ||
| nome:string, | ||
| email:string, | ||
| data_nasc:string, | ||
| turma_id:string, | ||
| ) { | ||
| super(id, nome, email, data_nasc, turma_id) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { User } from "./User" | ||
|
|
||
|
|
||
| export class Estudante extends User{ | ||
| public hobby?: string[] | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hobbies |
||
|
|
||
| constructor( | ||
| id:string, | ||
| nome:string, | ||
| email:string, | ||
| data_nasc:string, | ||
| turma_id:string | ||
| ){ | ||
| super(id, nome, email, data_nasc, turma_id) | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| export class User { | ||
| public "id": string | ||
| public "nome": string | ||
| public "email": string | ||
| public "data_nasc": string | ||
| public "turma_id": string | ||
|
|
||
| constructor( | ||
| id:string, | ||
| nome:string, | ||
| email:string, | ||
| data_nasc:string, | ||
| turma_id:string | ||
| ) | ||
| { | ||
| console.log("Chamando o constructor da Classe User") | ||
| this.id = id, | ||
| this.nome = nome, | ||
| this.email = email, | ||
| this.data_nasc = data_nasc | ||
| this.turma_id = turma_id | ||
| } | ||
|
Comment on lines
+2
to
+22
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sobre estilo de código: a declaração dos atributos não precisa de aspas, e pode-se usar a notação |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| export enum MODULO { | ||
| MODULO_0 = "0", | ||
| MODULO_1 = "1", | ||
| MODULO_2 = "2", | ||
| MODULO_3 = "3", | ||
| MODULO_4 = "4", | ||
| MODULO_5 = "5", | ||
| MODULO_6 = "6", | ||
| } | ||
|
|
||
| export class Turma { | ||
| "id": string | ||
| "nome": string | ||
| "modulo": MODULO | ||
|
|
||
| constructor( | ||
| id:string, | ||
| nome:string, | ||
| modulo:MODULO | ||
| ) | ||
| { | ||
| this.id = id; | ||
| this.nome = nome; | ||
| this.modulo = modulo | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
especialidadesseria um nome melhor, no plural.