From c795289b13121d983ccea7feb0b18b486e7f8db0 Mon Sep 17 00:00:00 2001 From: Venus Date: Tue, 7 Sep 2021 18:04:05 -0300 Subject: [PATCH] revisao trabalho labenusystem --- index.js | 137 ------------- index.js.map | 1 - index.ts | 291 ---------------------------- package-lock.json | 24 +-- package.json | 9 +- src/connection.ts | 8 +- src/data/createClass.ts | 16 -- src/data/createStudent.ts | 17 -- src/data/createTeacher.ts | 17 -- src/data/criarDocente.ts | 7 + src/data/criarEstudante.ts | 22 +++ src/data/criarTurma.ts | 24 +++ src/data/docenteTurma.ts | 7 + src/data/estudanteTurma.ts | 7 + src/data/pegaIdade.ts | 10 + src/endpoints/addClass.ts | 22 --- src/endpoints/addStudent.ts | 24 --- src/endpoints/addTeachers.ts | 22 --- src/endpoints/adicionarDocente.ts | 21 ++ src/endpoints/adicionarEstudante.ts | 18 ++ src/endpoints/adicionarTurma.ts | 36 ++++ src/endpoints/atualizaDocente.ts | 18 ++ src/endpoints/atualizaEstudante.ts | 17 ++ src/endpoints/idadeEstudante.ts | 18 ++ src/index.ts | 18 +- src/resquest.rest | 53 +++++ src/types.ts | 50 +++++ tsconfig.json | 81 ++------ 28 files changed, 353 insertions(+), 642 deletions(-) delete mode 100644 index.js delete mode 100644 index.js.map delete mode 100644 index.ts delete mode 100644 src/data/createClass.ts delete mode 100644 src/data/createStudent.ts delete mode 100644 src/data/createTeacher.ts create mode 100644 src/data/criarDocente.ts create mode 100644 src/data/criarEstudante.ts create mode 100644 src/data/criarTurma.ts create mode 100644 src/data/docenteTurma.ts create mode 100644 src/data/estudanteTurma.ts create mode 100644 src/data/pegaIdade.ts delete mode 100644 src/endpoints/addClass.ts delete mode 100644 src/endpoints/addStudent.ts delete mode 100644 src/endpoints/addTeachers.ts create mode 100644 src/endpoints/adicionarDocente.ts create mode 100644 src/endpoints/adicionarEstudante.ts create mode 100644 src/endpoints/adicionarTurma.ts create mode 100644 src/endpoints/atualizaDocente.ts create mode 100644 src/endpoints/atualizaEstudante.ts create mode 100644 src/endpoints/idadeEstudante.ts create mode 100644 src/types.ts diff --git a/index.js b/index.js deleted file mode 100644 index 74c583e..0000000 --- a/index.js +++ /dev/null @@ -1,137 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.connection = void 0; -const cors_1 = __importDefault(require("cors")); -const knex_1 = __importDefault(require("knex")); -const dotenv_1 = __importDefault(require("dotenv")); -const express_1 = __importDefault(require("express")); -dotenv_1.default.config(); -exports.connection = knex_1.default({ - client: "mysql", - connection: { - host: process.env.DB_HOST, - port: 3306, - user: process.env.DB_USER, - password: process.env.DB_PASS, - database: process.env.DB_NAME - } -}); -const app = express_1.default(); -app.use(express_1.default.json()); -app.use(cors_1.default()); -var TIPO_TURMA; -(function (TIPO_TURMA) { - TIPO_TURMA["INTEGRAL"] = "integral"; - TIPO_TURMA["NOTURNO"] = "noturno"; -})(TIPO_TURMA || (TIPO_TURMA = {})); -app.post("/turma", (req, res) => __awaiter(void 0, void 0, void 0, function* () { - let errorCode = 400; - try { - const input = { - id: req.body.id, - nome: req.body.nome, - data_inicio: req.body.data_inicio, - data_fim: req.body.data_fim, - modulo: 0, - tipo: req.body.tipo - }; - if (!input.id || !input.nome || !input.data_inicio || !input.data_fim || !input.tipo) { - errorCode = 422; - throw new Error("Preencha os campos corretamente."); - } - ; - if (input.tipo !== TIPO_TURMA.INTEGRAL && input.tipo !== TIPO_TURMA.NOTURNO) { - errorCode = 422; - throw new Error("os valores possiveis são integral ou noturno"); - } - ; - if (input.tipo === TIPO_TURMA.NOTURNO) { - input.nome = input.nome += "-na-night"; - } - ; - yield exports.connection.raw(` - INSERT INTO TURMA (id, nome, data_inicio, data_fim, modulo) - VALUES( - ${input.id}, - "${input.nome}", - "${input.data_inicio}", - "${input.data_fim}", - ${input.modulo} - ) - `); - res.status(201).send({ message: "Turma criada com sucesso." }); - } - catch (error) { - res.status(errorCode).send({ message: error.message }); - } -})); -app.post("/estudante", (req, res) => __awaiter(void 0, void 0, void 0, function* () { - let errorCode = 400; - try { - const input = { - id: req.body.id, - nome: req.body.nome, - email: req.body.email, - data_nasc: req.body.data_nasc, - hobbies: req.body.hobbies, - turma_id: req.body.turma_id - }; - if (!input.id || !input.nome || !input.email || !input.data_nasc || !input.hobbies.length) { - errorCode = 422; - throw new Error("Preencha os campos corretamente."); - } - yield exports.connection.raw(` - INSERT INTO ESTUDANTE(id, nome, email, data_nasc, turma_id) - VALUES ( - ${input.id}, - "${input.nome}", - "${input.email}", - "${input.data_nasc}", - ${input.turma_id} - ); - `); - for (let hobby of input.hobbies) { - const idPassatempo = Math.floor(Math.random() * 1000000); - yield exports.connection.raw(` - INSERT INTO PASSATEMPO(id, nome) - VALUES( - ${idPassatempo}, - "${hobby}" - ) - `); - yield exports.connection.raw(` - - INSERT INTO ESTUDANTE_PASSATEMPO(estudante_id, passatempo_id) - VALUES( - ${input.id}, - ${idPassatempo} - )`); - } - res.status(201).send({ message: "Criado com sucesso." }); - } - catch (error) { - res.status(errorCode).send({ message: error.message }); - } -})); -const server = app.listen(process.env.PORT || 3003, () => { - if (server) { - const address = server.address(); - console.log(`Server is running at 3003`); - } - else { - console.error(`Failure upon starting server.`); - } -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/index.js.map b/index.js.map deleted file mode 100644 index e0e2112..0000000 --- a/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.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,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;KACzD;AACL,CAAC,CAAA,CAAC,CAAA;AAEF,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE,GAAG,EAAE;IACrD,IAAI,MAAM,EAAE;QACR,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAiB,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;KAC5C;SAAM;QACH,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA;KACjD;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/index.ts b/index.ts deleted file mode 100644 index b411a06..0000000 --- a/index.ts +++ /dev/null @@ -1,291 +0,0 @@ -import cors from "cors" -import knex from "knex" -import dotenv from "dotenv" -import { AddressInfo } from "net" -import express from "express" -import { Request, Response } from "express" - -dotenv.config(); - -export const connection = knex({ - client: "mysql", - connection: { - host: process.env.DB_HOST, - port: 3306, - user: process.env.DB_USER, - password: process.env.DB_PASS, - database: process.env.DB_NAME - } -}); - -const app = express(); -app.use(express.json()); -app.use(cors()); - -enum TIPO_TURMA { - INTEGRAL = "integral", - NOTURNO = "noturno" -} - -enum ESPECIALIDADE { - "REACT" = 1, - "REDUC" = 2, - "CSS" = 3, - "TESTES" = 4, - "TYPESCRIPT" = 5, - "POO" = 6, - "BACKEND" = 7, -} - -type criaTurmaInput = { - id: number, - nome: string, - data_inicio: string, - data_fim: string, - modulo: number, - tipo: TIPO_TURMA -} - -type criaEstudanteInput = { - id: number, - nome: string, - email: string, - data_nasc: string, - hobbies: string[], - turma_id: number -} - -type criaDocenteInput = { - id: number, - nome: string, - email: string, - data_nasc: string, - especialidades: ESPECIALIDADE[], - turma_id: number -} - -type atualizaEstudanteInput = { - estudante_id: number, - turma_id: number -} - -type atualizaDocenteInput = { - docente_id: number, - turma_id: number, -} - -app.post("/turma", async (req: Request, res: Response) => { - let errorCode = 400; - try { - - const input: criaTurmaInput = { - id: req.body.id, - nome: req.body.nome, - data_inicio: req.body.data_inicio, - data_fim: req.body.data_fim, - modulo: 0, - tipo: req.body.tipo - }; - - if (!input.id || !input.nome || !input.data_inicio || !input.data_fim || !input.tipo) { - errorCode = 422; - throw new Error("Preencha os campos corretamente.") - }; - - if (input.tipo !== TIPO_TURMA.INTEGRAL && input.tipo !== TIPO_TURMA.NOTURNO) { - errorCode = 422; - throw new Error("os valores possiveis são integral ou noturno") - }; - - if (input.tipo === TIPO_TURMA.NOTURNO) { - input.nome = input.nome += "-na-night"; - }; - - await connection.raw(` - INSERT INTO TURMA (id, nome, data_inicio, data_fim, modulo) - VALUES( - ${input.id}, - "${input.nome}", - "${input.data_inicio}", - "${input.data_fim}", - ${input.modulo} - ) - `); - res.status(201).send({ message: "Turma criada com sucesso." }) - - } catch (error) { - res.status(errorCode).send({ message: error.message }); - } -}); - -app.post("/estudante", async (req: Request, res: Response) => { - let errorCode = 400; - try { - const input: criaEstudanteInput = { - id: req.body.id, - nome: req.body.nome, - email: req.body.email, - data_nasc: req.body.data_nasc, - hobbies: req.body.hobbies, - turma_id: req.body.turma_id - } - - if(!input.id || !input.nome || !input.email || !input.data_nasc || !input.hobbies.length){ - errorCode = 422; - throw new Error("Preencha os campos corretamente.") - } - - await connection.raw(` - INSERT INTO ESTUDANTE(id, nome, email, data_nasc, turma_id) - VALUES ( - ${input.id}, - "${input.nome}", - "${input.email}", - "${input.data_nasc}", - ${input.turma_id} - ); - `) - - for (let hobby of input.hobbies){ - const idPassatempo = Math.floor(Math.random() * 1000000); - await connection.raw(` - INSERT INTO PASSATEMPO(id, nome) - VALUES( - ${idPassatempo}, - "${hobby}" - ) - `); - - await connection.raw(` - - INSERT INTO ESTUDANTE_PASSATEMPO(estudante_id, passatempo_id) - VALUES( - ${input.id}, - ${idPassatempo} - )`) - } - - res.status(201).send({message: "Criado com sucesso."}) - } catch (error) { - res.status(errorCode).send({ message: error.message }) - } -}); - -app.post("/docente", async (req: Request, res: Response) => { - let errorCode = 400; - try { - const input: criaDocenteInput = { - id: req.body.id, - nome: req.body.nome, - email: req.body.email, - data_nasc: req.body.data_nasc, - especialidades: req.body.especialidades, - turma_id: req.body.turma_id - } - - if(!input.id || !input.nome || !input.email || !input.data_nasc || !input.especialidades){ - errorCode = 422; - throw new Error("Preencha os campos corretamente.") - } - - await connection.raw(` - INSERT INTO DOCENTE(id, nome, email, data_nasc, turma_id) - VALUES ( - ${input.id}, - "${input.nome}", - "${input.email}", - "${input.data_nasc}", - ${input.turma_id} - ); - `) - - for (let especialidade of input.especialidades){ - await connection.raw(` - INSERT INTO DOCENTE_ESPECIALIDADE(docente_id, especialidade_id) - VALUES( - ${input.id}, - ${ESPECIALIDADE[especialidade]} - )`) - } - - res.status(201).send({message: "Criado com sucesso."}) - } catch (error) { - res.status(errorCode).send({ message: error.message }) - } -}); - -app.put("/estudante", async( req: Request, res: Response ) => { - let errorCode = 400; - try { - const input: atualizaEstudanteInput = { - estudante_id: req.body.estudante_id, - turma_id: req.body.turma_id - } - - await connection.raw(` - UPDATE ESTUDANTE - SET turma_id = ${input.turma_id} - WHERE id = ${input.estudante_id} - `); - - res.status(200).send({message: "Atualizado com sucesso."}) - } catch (error) { - res.status(errorCode).send({message: error.message}) - } -}); - -app.put("/docente", async( req: Request, res: Response ) => { - let errorCode = 400; - try { - const input: atualizaDocenteInput = { - docente_id: req.body.docente_id, - turma_id: req.body.turma_id - } - - await connection.raw(` - UPDATE DOCENTE - SET turma_id = ${input.turma_id} - WHERE id = ${input.docente_id} - `); - - res.status(200).send({message: "Atualizado com sucesso."}) - } catch (error) { - res.status(errorCode).send({message: error.message}) - } -}); - -app.get("/estudante/:id", async(req: Request, res: Response) => { - let errorCode = 400; - try { - const id = req.params.id; - if(isNaN(Number(id))){ - errorCode = 404; - throw new Error("Apenas valores numéricos.") - } - const result = await connection.raw(` - SELECT ROUND(DATEDIFF("2021-01-01", data_nasc)/365) as idade - FROM ESTUDANTE - WHERE id = ${id}; - `); - if(result[0].length === 0) { - errorCode = 404; - throw new Error("Não encontrado.") - } - res.status(200).send({estudante: result[0][0]}); - - } catch (error) { - res.status(errorCode).send({message: error.message}) - } -}) - - - - -const server = app.listen(process.env.PORT || 3003, () => { - if (server) { - const address = server.address() as AddressInfo; - console.log(`Server is running at 3003`); - } else { - console.error(`Failure upon starting server.`) - } -}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c8f2470..fac1506 100644 --- a/package-lock.json +++ b/package-lock.json @@ -83,9 +83,9 @@ } }, "@types/node": { - "version": "16.4.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.8.tgz", - "integrity": "sha512-VL7RZyCpfYEmbyd3/Eq5RNYhZt7yoL1JThZQ3KzimzhLya2Qa86U1ZZmioNWAAjiz99z1ED1xF9NUV2srvfVrA==" + "version": "16.7.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.7.13.tgz", + "integrity": "sha512-pLUPDn+YG3FYEt/pHI74HmnJOWzeR+tOIQzUx93pi9M7D8OE7PSLr97HboXwk5F+JS+TLtWuzCOW97AHjmOXXA==" }, "@types/qs": { "version": "6.9.7", @@ -271,9 +271,9 @@ "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" }, "cors": { "version": "2.8.5", @@ -571,9 +571,9 @@ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "knex": { - "version": "0.95.8", - "resolved": "https://registry.npmjs.org/knex/-/knex-0.95.8.tgz", - "integrity": "sha512-fEeu8SWyJuW1NHLjnMA2ACEAsVuGuFxtNO5J8bcQdlybnkiNSWPXYX0LhKB17sgWl5UARJrsNpjVeT55ByP8gA==", + "version": "0.95.11", + "resolved": "https://registry.npmjs.org/knex/-/knex-0.95.11.tgz", + "integrity": "sha512-grDetD91O8VoQVCFqeWTgkzdq5406W6rggF/lK1hHuwzmjDs/0m9KxyncGdZbklTi7aUgHvw3+Cfy4x7FvpdaQ==", "requires": { "colorette": "1.2.1", "commander": "^7.1.0", @@ -1023,9 +1023,9 @@ } }, "typescript": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", - "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz", + "integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==", "dev": true }, "unpipe": { diff --git a/package.json b/package.json index b636024..dc7aeb0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "tsc && ./build/index.js", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "dev": "tsnd ./src/index.ts" }, "keywords": [], "author": "Tulio, João e Janaina", @@ -14,17 +15,17 @@ "@types/dotenv": "^8.2.0", "@types/knex": "^0.16.1", "@types/mysql": "^2.15.19", - "@types/node": "^16.4.8", "cors": "^2.8.5", "dotenv": "^10.0.0", "express": "^4.17.1", - "knex": "^0.95.8", + "knex": "^0.95.11", "mysql": "^2.18.1" }, "devDependencies": { "@types/cors": "^2.8.12", "@types/express": "^4.17.13", + "@types/node": "^16.7.13", "ts-node-dev": "^1.1.8", - "typescript": "^4.3.5" + "typescript": "^4.4.2" } } diff --git a/src/connection.ts b/src/connection.ts index 8c3d03a..7ea3987 100644 --- a/src/connection.ts +++ b/src/connection.ts @@ -1,7 +1,7 @@ import knex from "knex"; import dotenv from "dotenv"; -dotenv.config(); +dotenv.config(); export const connection = knex({ client: "mysql", @@ -9,7 +9,7 @@ export const connection = knex({ host: process.env.DB_HOST, port: 3306, user: process.env.DB_USER, - password: process.env.DB_PASSWORD, - database: process.env.DB_SCHEMA, + password: process.env.DB_PASS, + database: process.env.DB_NAME } -}); \ No newline at end of file +}) diff --git a/src/data/createClass.ts b/src/data/createClass.ts deleted file mode 100644 index 8efd007..0000000 --- a/src/data/createClass.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { connection } from "../connection" - -export const createClass = async ( - id: number, - name: string, - start_date: string, - end_date: string - ): Promise => { - await connection.raw(` - INSERT INTO class_labenu - (id, name, start_date, end_date) - VALUES ('${id}', '${name}', '${start_date}', '${end_date}') - ` - - ) - } \ No newline at end of file diff --git a/src/data/createStudent.ts b/src/data/createStudent.ts deleted file mode 100644 index a6c80f4..0000000 --- a/src/data/createStudent.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { connection } from "../connection" - -export const createStudent = async ( - id: number, - name: string, - email: string, - birth_date: string, - hobbies: string - ): Promise => { - await connection.raw(` - INSERT INTO student_labenu - (id, name, email, birth_date, hobbies) - VALUES ('${id}', '${name}', '${email}', '${birth_date}', '${hobbies}') - ` - - ) - } \ No newline at end of file diff --git a/src/data/createTeacher.ts b/src/data/createTeacher.ts deleted file mode 100644 index 8d21249..0000000 --- a/src/data/createTeacher.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { connection } from "../connection" - -export const createTeacher = async ( - id: number, - name: string, - email: string, - birth_date: string, - - ): Promise => { - await connection.raw(` - INSERT INTO teachers_labenu - (id, name, email, birth_date) - VALUES ('${id}', '${name}', '${email}', '${birth_date}') - ` - - ) - } \ No newline at end of file diff --git a/src/data/criarDocente.ts b/src/data/criarDocente.ts new file mode 100644 index 0000000..0a09e92 --- /dev/null +++ b/src/data/criarDocente.ts @@ -0,0 +1,7 @@ +import { connection } from "../connection" +import { docente } from "../types" + +export const criarDocente = async(novoDocente:docente):Promise => { + await connection("docente") + .insert(novoDocente) +} \ No newline at end of file diff --git a/src/data/criarEstudante.ts b/src/data/criarEstudante.ts new file mode 100644 index 0000000..084de26 --- /dev/null +++ b/src/data/criarEstudante.ts @@ -0,0 +1,22 @@ +import { connection } from "../connection" +import { estudante } from "../types" + +export const criarEstudante = async(novoEstudante: estudante): Promise => { + await connection("estudante") + .insert(novoEstudante) +} +// export const createStudent = async ( +// id: number, +// name: string, +// email: string, +// birth_date: string, +// hobbies: string +// ): Promise => { +// await connection.raw(` +// INSERT INTO student_labenu +// (id, name, email, birth_date, hobbies) +// VALUES ('${id}', '${name}', '${email}', '${birth_date}', '${hobbies}') +// ` + +// ) +// } \ No newline at end of file diff --git a/src/data/criarTurma.ts b/src/data/criarTurma.ts new file mode 100644 index 0000000..de7b742 --- /dev/null +++ b/src/data/criarTurma.ts @@ -0,0 +1,24 @@ +import { connection } from "../connection" +import { turma } from "../types" + +export const criarTurma = async( + novaTurma:turma +):Promise =>{ + await connection('turma') + .insert(novaTurma) +} + +// export const createClass = async ( +// id: number, +// name: string, +// start_date: string, +// end_date: string +// ): Promise => { +// await connection.raw(` +// INSERT INTO class_labenu +// (id, name, start_date, end_date) +// VALUES ('${id}', '${name}', '${start_date}', '${end_date}') +// ` + +// ) +// } \ No newline at end of file diff --git a/src/data/docenteTurma.ts b/src/data/docenteTurma.ts new file mode 100644 index 0000000..6c82ac4 --- /dev/null +++ b/src/data/docenteTurma.ts @@ -0,0 +1,7 @@ +import { connection } from "../connection" + +export const atualizaDocente = async(id: string, turma_id: string):Promise => { + await connection("docente") + .update({turma_id}) + .where({id}) +} \ No newline at end of file diff --git a/src/data/estudanteTurma.ts b/src/data/estudanteTurma.ts new file mode 100644 index 0000000..c3f0350 --- /dev/null +++ b/src/data/estudanteTurma.ts @@ -0,0 +1,7 @@ +import { connection } from "../connection" + +export const atualizarEstudante = async(id: string, turma_id: string):Promise => { + await connection("estudante") + .update({turma_id}) + .where({id}) +} \ No newline at end of file diff --git a/src/data/pegaIdade.ts b/src/data/pegaIdade.ts new file mode 100644 index 0000000..0e36a19 --- /dev/null +++ b/src/data/pegaIdade.ts @@ -0,0 +1,10 @@ +import { connection } from "../connection" + +export const pegaIdade = async(id:string):Promise => { + const result = await connection.raw(` + SELECT nome, ROUND (DATEDIFF("2021-09-07", data_nasc) /365) AS idade + FROM estudante + WHERE id = ${id} + `) + return result[0][0] +} \ No newline at end of file diff --git a/src/endpoints/addClass.ts b/src/endpoints/addClass.ts deleted file mode 100644 index 05af72a..0000000 --- a/src/endpoints/addClass.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {Request, Response} from "express"; -import { createClass } from '../data/createClass'; - - - -export const addClass = async (req:Request, res:Response) => { - try { - await createClass( - req.body.id, - req.body.name, - req.body.start_date, - req.body.end_date - - ); - - - res.status(200).send("Classe criada com sucesso!") - } catch (error) { - res.status(400).send(error.sqlMessage || error.message); - - } -} \ No newline at end of file diff --git a/src/endpoints/addStudent.ts b/src/endpoints/addStudent.ts deleted file mode 100644 index 571d444..0000000 --- a/src/endpoints/addStudent.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createStudent } from '../data/createStudent'; -import { app } from './../app'; -import {Request, Response} from "express"; - - - -export const addStudent = async (req:Request, res:Response) => { - try { - await createStudent( - req.body.id, - req.body.name, - req.body.email, - req.body.birth_date, - req.body.hobbies - - ); - - - res.status(200).send("Estudante criado com sucesso!") - } catch (error) { - res.status(400).send(error.sqlMessage || error.message); - - } -} diff --git a/src/endpoints/addTeachers.ts b/src/endpoints/addTeachers.ts deleted file mode 100644 index 43b4d3d..0000000 --- a/src/endpoints/addTeachers.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {Request, Response} from "express"; -import { createTeacher } from './../data/createTeacher'; - - -export const addTeachers = async (req:Request, res:Response) => { - try { - await createTeacher( - req.body.id, - req.body.name, - req.body.email, - req.body.birth_date, - - - ); - - - res.status(200).send("Professor criado com sucesso!") - } catch (error) { - res.status(400).send(error.sqlMessage || error.message); - - } -} \ No newline at end of file diff --git a/src/endpoints/adicionarDocente.ts b/src/endpoints/adicionarDocente.ts new file mode 100644 index 0000000..40d5258 --- /dev/null +++ b/src/endpoints/adicionarDocente.ts @@ -0,0 +1,21 @@ +import {Request, Response} from "express"; +import { criarDocente } from '../data/criarDocente'; + + +export const adicionarDocente = async (req: Request, res: Response):Promise => { + try { + const {id, nome, email, data_nasc, turma_id} = req.body + + if(!id || !nome || !email || !data_nasc || !turma_id){ + return res.status(422).send({error: "Os parametros são obrigatorios"}) + } + + const novoDocente = {id, nome, email, data_nasc, turma_id} + + await criarDocente(novoDocente) + + res.status(201).send({message: "Docente criado!"}) + } catch (error:any) { + res.send({error: error.message || error.sqlMessage}) + } +} \ No newline at end of file diff --git a/src/endpoints/adicionarEstudante.ts b/src/endpoints/adicionarEstudante.ts new file mode 100644 index 0000000..32dfa1a --- /dev/null +++ b/src/endpoints/adicionarEstudante.ts @@ -0,0 +1,18 @@ +import { criarEstudante } from '../data/criarEstudante'; +import { app } from '../app'; +import {Request, Response} from "express"; + +export const adicionarEstudante = async (req: Request, res: Response): Promise => { + try { + const {id, nome, email, data_nasc, turma_id} = req.body + + if(!id || !nome || !email || !data_nasc || !turma_id){ + return res.status(422).send({error: "preencha todos os campos!"}) + } + const novoEstudante = {id, nome, email, data_nasc, turma_id} + await criarEstudante(novoEstudante) + res.status(201).send({message: `Estudante criado id: ${id}`}) + } catch (error: any) { + res.send({error: error.message || error. sqlMessage}) + } +} \ No newline at end of file diff --git a/src/endpoints/adicionarTurma.ts b/src/endpoints/adicionarTurma.ts new file mode 100644 index 0000000..f323c72 --- /dev/null +++ b/src/endpoints/adicionarTurma.ts @@ -0,0 +1,36 @@ +import { Request, Response } from "express"; +import { criarTurma } from '../data/criarTurma'; +import { turma } from "../types"; +import { TIPO_TURMA } from "../types" + +export const adicionarTurma = async ( + req: Request, + res: Response +): Promise => { + try { + let { id, + nome, + data_inicio, + data_final, + modulo, + tipo + } = req.body + if (!id || !nome || !data_inicio || !data_final || !modulo || !tipo) { + return res.status(422).send("Preencha todos os campos") + } + if (Number(modulo) < 0 || Number(modulo) > 7) { + return res.status(422).send("Módulo inválido") + } + if (tipo.toLowerCase() !== TIPO_TURMA.INTEGRAL && tipo.toLowerCase() !== TIPO_TURMA.NOTURNA) { + return res.status(422).send("A turma tem que ser integral ou noturna") + } + if (tipo === TIPO_TURMA.NOTURNA) { + nome = nome += "-na-night" + } + const novaTurma: turma = { id, nome, data_inicio, data_final, modulo, tipo } + await criarTurma(novaTurma) + res.status(201).send({ message: `Turma criada id = ${id}` }) + } catch (error: any) { + res.send({ error: error.message || error.sqlMessage }) + } +} diff --git a/src/endpoints/atualizaDocente.ts b/src/endpoints/atualizaDocente.ts new file mode 100644 index 0000000..9929e73 --- /dev/null +++ b/src/endpoints/atualizaDocente.ts @@ -0,0 +1,18 @@ +import { Request, Response } from "express" +import { atualizaDocente } from "../data/docenteTurma" +import { atualizarEstudante } from "../data/estudanteTurma" + +export const turmaDocente = async (req: Request, res: Response): Promise => { + try { + const { id, turma_id } = req.body + + if (!id || !turma_id) { + return res.status(422).send({ message: "Os parametros sao obrigatorios." }) + } + + await atualizaDocente(id, turma_id) + res.status(201).send({ message: `Docente na turma ${turma_id}` }) + } catch (error: any) { + res.send({ error: error.message || error.sqlMessage }) + } +} \ No newline at end of file diff --git a/src/endpoints/atualizaEstudante.ts b/src/endpoints/atualizaEstudante.ts new file mode 100644 index 0000000..e2ac433 --- /dev/null +++ b/src/endpoints/atualizaEstudante.ts @@ -0,0 +1,17 @@ +import { Request, Response } from "express" +import { atualizarEstudante } from "../data/estudanteTurma" + +export const atualizaEstudante = async (req: Request, res: Response): Promise => { + try { + const { id, turma_id } = req.body + + if (!id || !turma_id) { + return res.status(422).send({ message: "Os parametros sao obrigatorios." }) + } + + await atualizarEstudante(id, turma_id) + res.status(201).send({ message: `Estudante na turma ${turma_id}` }) + } catch (error: any) { + res.send({ error: error.message || error.sqlMessage }) + } +} \ No newline at end of file diff --git a/src/endpoints/idadeEstudante.ts b/src/endpoints/idadeEstudante.ts new file mode 100644 index 0000000..80159a0 --- /dev/null +++ b/src/endpoints/idadeEstudante.ts @@ -0,0 +1,18 @@ +import { Request, Response } from "express" +import { pegaIdade } from "../data/pegaIdade" + +export const idadeEstudante = async(req: Request, res: Response):Promise => { + try { + const id = req.params.id + + const result = await pegaIdade(id) + + if(result.length === 0){ + res.status(404).send("Insira um ID valido") + } + + res.status(200).send(result) + } catch (error: any) { + res.send({error: error.message || error.sqlMessage}) + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 22359af..944101e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,18 @@ import {app} from "./app" -import { addClass } from "./endpoints/addClass"; -import { addStudent } from "./endpoints/addStudent" -import { addTeachers } from "./endpoints/addTeachers"; +import { adicionarDocente } from "./endpoints/adicionarDocente"; +import { adicionarEstudante } from "./endpoints/adicionarEstudante"; +import { adicionarTurma } from "./endpoints/adicionarTurma"; +import { turmaDocente } from "./endpoints/atualizaDocente"; +import { atualizaEstudante } from "./endpoints/atualizaEstudante"; +import { idadeEstudante } from "./endpoints/idadeEstudante"; -app.post("/createStudent", addStudent); +app.post("/criarTurma", adicionarTurma); +app.post("/criarEstudante", adicionarEstudante); +app.post("/criarDocente", adicionarDocente); -app.post("/createTeacher", addTeachers); +app.put("/putEstudante", atualizaEstudante) +app.put("putDocente", turmaDocente) -app.post("/createClass", addClass); \ No newline at end of file +app.get("/estudante/:id", idadeEstudante) \ No newline at end of file diff --git a/src/resquest.rest b/src/resquest.rest index e69de29..57a944e 100644 --- a/src/resquest.rest +++ b/src/resquest.rest @@ -0,0 +1,53 @@ +POST http://localhost:3003/criarTurma +Content-Type: application/json + +{ + "id": "001", + "nome": "Paiva", + "data_inicio": "2021-04-23", + "data_final": "2021-09-29", + "modulo": "5", + "tipo": "noturna" +} + +### +POST http://localhost:3003/criarEstudante +Content-Type: application/json + +{ + "id": "001", + "nome": "Tulio", + "email": "tm@gmail.com", + "data_nasc": "1998-05-20", + "turma_id": "001" +} + +### +POST http://localhost:3003/criarDocente +Content-Type: application/json + +{ + "id": "001", + "nome": "Mateus", + "email": "mat@gmail.com", + "data_nasc": "1990-03-29", + "turma_id": "004" +} + +### +PUT http://localhost:3003/putEstudante +Content-Type: application/json + +{ + "id": "000", + "turma_id": "003" +} + +### +PUT http://localhost:3003/putDocente +Content-Type: application/json + +{ + "id": "000", + "turma_id": "003" +} \ No newline at end of file diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..21f1045 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,50 @@ +export type estudante = { + id: string + nome: string + email: string + data_nasc: string + turma_id: string +} + +export type docente = { + id: string + nome: string + email: string + data_nasc: string + turma_id: string +} + +export type turma = { + id: string + nome: string + data_inicio: string + data_final: string + modulo: string + tipo: TIPO_TURMA +} + +export type especialidade = { + id: string + especialidade: ESPECIALIDADE +} + +export type passatempo = { + id: string + passatempo: string +} + + +export enum TIPO_TURMA { + INTEGRAL = "integral", + NOTURNA = "noturna" +} + +export enum ESPECIALIDADE { + REACT = "React", + REDUX = "Redux", + CSS = "CSS", + TESTES = "Testes", + TYPESCRIPT = "Typescript", + POO = "POO", + BACKEND = "Backend" +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 97d329d..9cfb703 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,72 +1,15 @@ { "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./build", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true, /* Skip type checking of declaration files. */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "target": "es6", + "module": "commonjs", + "outDir": "./build", + "rootDir": "./src", + "removeComments": true, + "strict": true, + "noImplicitAny": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true } -} +} \ No newline at end of file