From 98cdb5bbe3f495dc7d6e4889feb098c7e5a3a545 Mon Sep 17 00:00:00 2001 From: Daniel-Alvarenga Date: Sat, 6 Jul 2024 18:01:55 -0300 Subject: [PATCH] Register Vagas and their view --- client/src/router/routes/funcionario.js | 11 +- client/src/router/routes/shared.js | 6 + .../scss/pages/funcionario/_registerVaga.scss | 0 client/src/scss/pages/shared/_vagas.scss | 158 +++++++++++++ client/src/services/api/funcionario.js | 39 ++++ client/src/services/api/shared.js | 9 + client/src/util/authMixins.js | 4 +- client/src/views/funcionario/Dashboard.vue | 1 + client/src/views/funcionario/RegisterVaga.vue | 219 ++++++++++++++++++ client/src/views/shared/Pesquisa.vue | 6 +- client/src/views/shared/Vagas.vue | 127 ++++++++++ server/.env.example | 3 +- .../migration.sql | 8 + .../migration.sql | 16 ++ server/prisma/schema.prisma | 14 +- .../controllers/funcionarioControllers.ts | 41 +++- .../modules/controllers/sharedControllers.ts | 24 ++ .../src/modules/interfaces/funcionarioDTOs.ts | 15 ++ .../funcionario/RegisterVagasUseCase.ts | 124 ++++++++++ .../services/shared/GetCursosUseCase.ts | 4 +- .../services/shared/GetEmpresasUseCase.ts | 16 ++ .../services/shared/GetVagasUseCase.ts | 23 ++ .../src/router/routes/funcionario.routes.ts | 3 + .../src/router/routes/imports/funcionario.ts | 12 +- server/src/router/routes/imports/shared.ts | 6 +- server/src/router/routes/shared.routes.ts | 1 + 26 files changed, 871 insertions(+), 19 deletions(-) create mode 100644 client/src/scss/pages/funcionario/_registerVaga.scss create mode 100644 client/src/scss/pages/shared/_vagas.scss create mode 100644 client/src/views/funcionario/RegisterVaga.vue create mode 100644 client/src/views/shared/Vagas.vue create mode 100644 server/prisma/migrations/20240706180957_add_title_label_on_vagas_table/migration.sql create mode 100644 server/prisma/migrations/20240706193450_fix_vaga_table_fields/migration.sql create mode 100644 server/src/modules/services/funcionario/RegisterVagasUseCase.ts create mode 100644 server/src/modules/services/shared/GetEmpresasUseCase.ts create mode 100644 server/src/modules/services/shared/GetVagasUseCase.ts diff --git a/client/src/router/routes/funcionario.js b/client/src/router/routes/funcionario.js index 8f21bb3..e1b063c 100644 --- a/client/src/router/routes/funcionario.js +++ b/client/src/router/routes/funcionario.js @@ -10,12 +10,13 @@ import { isInitingFuncionario, isRecoveringFuncionario } from '../guards/guards.js'; +import RegisterVaga from '../../views/funcionario/RegisterVaga.vue'; export const funcionarioRoutes = [ { path: '/funcionario/init', name: 'InitFuncionario', - component: InitFuncionario + component: InitFuncionario, }, { path: '/funcionario/validate', @@ -46,6 +47,14 @@ export const funcionarioRoutes = [ (await isRecoveringFuncionario()) ? next() : next("/funcionario/recovery"); } }, + { + path: '/funcionario/register/vaga', + name: 'RegisterVaga', + component: RegisterVaga, + beforeEnter: async (to, from, next) => { + (await isAuthFuncionario()) ? next() : next("/funcionario/init"); + } + }, { path: "/funcionario", name: "Funcionario", diff --git a/client/src/router/routes/shared.js b/client/src/router/routes/shared.js index a818c55..f91e342 100644 --- a/client/src/router/routes/shared.js +++ b/client/src/router/routes/shared.js @@ -3,6 +3,7 @@ import NotFound from '../../views/shared/NotFound.vue'; import PublicPerfilAluno from '../../views/shared/PerfilAluno.vue'; import PublicPerfilProfessor from '../../views/shared/PerfilProfessor.vue'; import Pesquisa from '../../views/shared/Pesquisa.vue'; +import Vagas from '../../views/shared/Vagas.vue'; import { isAuthSomebody } from '../guards/guards'; export const sharedRoutes = [ @@ -34,6 +35,11 @@ export const sharedRoutes = [ name: 'Pesquisa', component: Pesquisa }, + { + path: '/vagas', + name: 'Vagas', + component: Vagas + }, { path: '/:pathMatch(.*)*', name: 'NotFound', diff --git a/client/src/scss/pages/funcionario/_registerVaga.scss b/client/src/scss/pages/funcionario/_registerVaga.scss new file mode 100644 index 0000000..e69de29 diff --git a/client/src/scss/pages/shared/_vagas.scss b/client/src/scss/pages/shared/_vagas.scss new file mode 100644 index 0000000..7ab8264 --- /dev/null +++ b/client/src/scss/pages/shared/_vagas.scss @@ -0,0 +1,158 @@ +#app{ + height: 100vh; + + main { + @include flex(row, flex-start, start); + width: 100vw; + height: 100vh; + min-height: calc(100vh - 80px); + border-bottom: 1px solid #0000008f; + background-color: $primary-color-dark; + position: relative; + + .content { + @include flex(column, flex-start, start); + width: calc(100% - 300px); + height: 100%; + + @include m-screen(1200px) { + width: 100%; + } + + .search { + @include flex(row, center, start); + height: 50px; + width: 62%; + padding: 20px 30px 20px 80px; + + .box{ + @include flex(row, cen, start); + height: 50px; + border-radius: 25px; + width: calc(100% - 40px); + background-color: $secondary-color-dark; + + input { + color: $font-color-dark-2; + width: 94%; + height: 100%; + padding-inline: 15px; + outline: none; + background: transparent; + border: none; + font-size: medium + } + + button { + @include flex-center; + height: 100%; + background-color: transparent; + border: none; + + img { + height: 55%; + object-fit: cover; + opacity: 0.8; + filter: invert(100%) + } + } + } + } + + >.box { + @include flex(column, flex-start, start); + padding: 50px 0px 0px 100px; + width: 70%; + height: 100%; + + @include m-screen(1400px) { + @include flex(column, center, center); + padding: 50px 0px 0px 0px; + width: 100%; + } + + .resultado { + @include flex(column, center, end); + text-align: right; + width: 80%; + color: $secondary-color-orange; + margin-right: 10px; + margin-bottom: 10px; + height: 100%; + font-size: small; + font-weight: 200; + @include font-inter(600); + } + + + .vaga { + @include flex(column, flex-start, start); + width: 80%; + height: 90px; + margin-bottom: 10px; + + @include m-screen(1400px) { + width: 70%; + } + + @include m-screen(800px) { + width: 90%; + } + + a { + @include flex(row, flex-start, start); + width: 100%; + height: 100%; + background-color: $secondary-color-dark; + padding: 15px; + border-radius: 5px; + text-decoration: none; + color: $font-color-dark; + + img { + height: 60px; + width: 60px; + object-fit: cover; + border-radius: 50%; + margin-right: 20px; + } + + .infoVaga { + @include flex(row, space-between, start); + width: calc(100% - 60px); + height: 100%; + + .who { + color: $primary-color-orange; + margin-right: 10px; + margin-bottom: 10px; + } + + .contentVaga { + @include flex(column, flex-start, start); + } + + .box-button{ + height: 100%; + @include flex(column, center, center); + + button{ + background-color: $primary-color-orange; + padding: 10px 20px; + border-radius: 10px; + color: $secondary-color-dark; + border: solid 1px $primary-color-orange; + } + } + + } + + p { + @include font-inter(600); + } + } + } + } + } + } +} \ No newline at end of file diff --git a/client/src/services/api/funcionario.js b/client/src/services/api/funcionario.js index c1fc145..caff774 100644 --- a/client/src/services/api/funcionario.js +++ b/client/src/services/api/funcionario.js @@ -63,6 +63,19 @@ export const validateRecovery = async(infoFuncionario) => { } } +export const registerVaga = async(infoVaga, token) => { + try { + const response = await api.post('funcionario/register/vaga', infoVaga, { + headers: { + authorization: `${token}` + } + }); + return response; + } catch (error) { + return error.response.data; + } +} + export const refreshTokenFuncionario = async (token) => { try { const response = await api.get('funcionario/token/refresh', { @@ -74,4 +87,30 @@ export const refreshTokenFuncionario = async (token) => { } catch (error) { return error.response.data; } +} + +export const getCursos = async(token) => { + try { + const response = await api.get('funcionario/cursos', { + headers: { + authorization: `${token}` + } + }); + return response; + } catch (error) { + return error.response.data; + } +} + +export const getEmpresas = async(token) => { + try { + const response = await api.get('funcionario/empresas', { + headers: { + authorization: `${token}` + } + }); + return response; + } catch (error) { + return error.response.data; + } } \ No newline at end of file diff --git a/client/src/services/api/shared.js b/client/src/services/api/shared.js index 2f8d9c4..2621fc5 100644 --- a/client/src/services/api/shared.js +++ b/client/src/services/api/shared.js @@ -42,3 +42,12 @@ export const getUsers = async () => { return error.response.data; } } + +export const getVagas = async () => { + try { + const response = await api.get('shared/vagas'); + return response; + } catch (error) { + return error.response.data; + } +} \ No newline at end of file diff --git a/client/src/util/authMixins.js b/client/src/util/authMixins.js index 39ff5b1..5ff1964 100644 --- a/client/src/util/authMixins.js +++ b/client/src/util/authMixins.js @@ -149,9 +149,11 @@ export const mixinFuncionario = { try { const response = await refreshTokenFuncionario(this.funcionario.token); if (response.status >= 200 && response.status < 300) { - Cookies.set('token', `${response.data.token}`); + console.log("Auth funcionário") + Cookies.set('token-funcionario', `${response.data.token}`); } } catch (error) { + console.log("Erro em auth funcionário: " + error) router.push({ path: '/funcionario/init' }); } }, diff --git a/client/src/views/funcionario/Dashboard.vue b/client/src/views/funcionario/Dashboard.vue index c3a7ec2..25be600 100644 --- a/client/src/views/funcionario/Dashboard.vue +++ b/client/src/views/funcionario/Dashboard.vue @@ -4,6 +4,7 @@

Bem-vindo profissional!