diff --git a/client/src/components/admin/AsideDashboard.vue b/client/src/components/admin/AsideDashboard.vue index a5a0f83..8a82f78 100644 --- a/client/src/components/admin/AsideDashboard.vue +++ b/client/src/components/admin/AsideDashboard.vue @@ -78,6 +78,11 @@

Estágios

+
  • + +

    Empresas

    +
    +
  • diff --git a/client/src/router/routes/admin.js b/client/src/router/routes/admin.js index 8f87477..e268419 100644 --- a/client/src/router/routes/admin.js +++ b/client/src/router/routes/admin.js @@ -11,6 +11,7 @@ import TableFuncionarios from '../../views/admin/TableFuncionario.vue'; import TableProfessores from '../../views/admin/TableProfessor.vue'; import TableTurmas from '../../views/admin/TableTurma.vue'; import TableEstagio from '../../views/admin/TableEstagio.vue'; +import TableEmpresas from '../../views/admin/TableEmpresa.vue'; import { isAuthAdmin @@ -118,4 +119,12 @@ export const adminRoutes = [ (await isAuthAdmin()) ? next() : next({path: "/admin/login"}); } }, + { + path: '/admin/table/empresa', + name: 'TableEmpresa', + component: TableEmpresas, + beforeEnter: async (to, from, next) => { + (await isAuthAdmin()) ? next() : next({path: "/admin/login"}); + } + }, ] \ No newline at end of file diff --git a/client/src/scss/pages/admin/_tableEmpresa.scss b/client/src/scss/pages/admin/_tableEmpresa.scss new file mode 100644 index 0000000..d518d29 --- /dev/null +++ b/client/src/scss/pages/admin/_tableEmpresa.scss @@ -0,0 +1,64 @@ +main { + height: calc(100vh - 80px); + background-color: $primary-color-dark; + @include flex-center; +} + +.path { + width: 100%; + @include flex(row, flex-start, center); + + font-size: 0.9rem; + @include font-inter(300); + margin-bottom: 20px; + > p { + @include flex(column, center, center); + @include font-inter(400); + + &:after { + width: 100%; + height: 3px; + margin-top: 3px; + background-color: $secondary-color-orange; + } + + &:hover::after { + animation: none; + } + } + + img { + @include flex(column, center, center); + width: 15px; + transform: rotate(180deg); + filter: invert(100%); + margin-inline: 20px; + } +} + +.table { + display: flex; + flex-direction: column; + width: 100%; + + .table-header { + border-left: 3px solid $secondary-color-orange; + .table-cell { + @include font-inter(600); + } + } + + .table-row { + display: flex; + flex-direction: row; + } + + .table-cell { + flex: 1; + padding: 8px; + border-right: 1px solid #ddd; + font-size: 1rem; + @include font-inter(300); + color: $font-color-dark; + } +} diff --git a/client/src/services/api/admin.js b/client/src/services/api/admin.js index cb054cb..d1caa7b 100644 --- a/client/src/services/api/admin.js +++ b/client/src/services/api/admin.js @@ -224,3 +224,16 @@ export const getFullProfessores = async(token) => { } } +export const getFullEmpresas = async(token) => { + try { + const response = await api.get('admin/table/empresas', { + headers: { + authorization: `${token}` + } + }); + return response; + } catch (error) { + return error.response.data; + } +} + diff --git a/client/src/views/admin/TableEmpresa.vue b/client/src/views/admin/TableEmpresa.vue new file mode 100644 index 0000000..1d61918 --- /dev/null +++ b/client/src/views/admin/TableEmpresa.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/server/src/modules/controllers/adminControllers.ts b/server/src/modules/controllers/adminControllers.ts index 801373f..36f452b 100644 --- a/server/src/modules/controllers/adminControllers.ts +++ b/server/src/modules/controllers/adminControllers.ts @@ -14,6 +14,7 @@ import { GetFullCursosUseCase } from "../services/admin/Get/Cursos"; import { GetCoordenadorUseCase } from "../services/admin/Get/Coordenadores"; import { GetAllProfessoresNamesUseCase } from "../services/admin/Get/ProfessorNames"; import { GetCoordenadoresNamesUseCase } from "../services/admin/Get/CoordenasdoresNames"; +import { GetEmpresasWithEstagiosUseCase } from "../services/admin/Get/Empresas"; export class GetAllProfessoresController { async handle(req: Request, res: Response) { @@ -183,6 +184,17 @@ export class GetFullCursosController { const result = await getFullCursosUseCase.execute(); + return res.status(201).json(result); + } +} + +export class GetFullEmpresasController { + async handle(req: Request, res: Response) { + + const getEmpresasWithEstagiosUseCase = new GetEmpresasWithEstagiosUseCase(); + + const result = await getEmpresasWithEstagiosUseCase.execute(); + return res.status(201).json(result); } } \ No newline at end of file diff --git a/server/src/modules/services/admin/Get/Empresas.ts b/server/src/modules/services/admin/Get/Empresas.ts new file mode 100644 index 0000000..cbe95d6 --- /dev/null +++ b/server/src/modules/services/admin/Get/Empresas.ts @@ -0,0 +1,24 @@ +import { prisma } from "../../../../prisma/client"; + +interface EmpresaWithEstagios { + id: string; + name: string; + estagios: string[]; +} + +export class GetEmpresasWithEstagiosUseCase { + async execute(): Promise { + const empresas = await prisma.empresa.findMany({ + include: { + vaga: true, + }, + }); + + const empresasWithEstagios: EmpresaWithEstagios[] = empresas.map((empresa) => ({ + ...empresa, + estagios: empresa.vaga.map((vaga) => vaga.titulo), + })); + + return empresasWithEstagios; + } +} diff --git a/server/src/router/routes/admin.routes.ts b/server/src/router/routes/admin.routes.ts index 3b741df..3b8ed8c 100644 --- a/server/src/router/routes/admin.routes.ts +++ b/server/src/router/routes/admin.routes.ts @@ -29,5 +29,6 @@ adminRoutes.get("/table/cursos", controllers.getFullCursosController.handle); adminRoutes.get("/table/estagios", controllers.getFullEstagiosController.handle); adminRoutes.get("/table/funcionarios", controllers.getFullFuncionariosController.handle); adminRoutes.get("/table/turmas", controllers.getFullTurmasController.handle); +adminRoutes.get("/table/empresas", controllers.getFullEmpresasController.handle); export { adminRoutes }; \ No newline at end of file diff --git a/server/src/router/routes/imports/admin.ts b/server/src/router/routes/imports/admin.ts index 836c116..b04dd66 100644 --- a/server/src/router/routes/imports/admin.ts +++ b/server/src/router/routes/imports/admin.ts @@ -16,7 +16,8 @@ import { GetFullCursosController, GetFullEstagiosController, GetFullFuncionariosController, - GetFullTurmasController + GetFullTurmasController, + GetFullEmpresasController } from "../../../modules/controllers/adminControllers"; export const createControllers = () => ({ @@ -35,6 +36,6 @@ export const createControllers = () => ({ getFullCursosController: new GetFullCursosController(), getFullEstagiosController: new GetFullEstagiosController(), getFullFuncionariosController: new GetFullFuncionariosController(), - getFullTurmasController: new GetFullTurmasController() - + getFullTurmasController: new GetFullTurmasController(), + getFullEmpresasController: new GetFullEmpresasController(), }); \ No newline at end of file