diff --git a/package-lock.json b/package-lock.json index 5a02fa5..acf8fe9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2297,11 +2297,6 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, - "async": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", - "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" - }, "async-retry": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", @@ -3234,14 +3229,6 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, - "ejs": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.6.tgz", - "integrity": "sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==", - "requires": { - "jake": "^10.6.1" - } - }, "electron-to-chromium": { "version": "1.4.106", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.106.tgz", @@ -3947,14 +3934,6 @@ "flat-cache": "^3.0.4" } }, - "filelist": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.2.tgz", - "integrity": "sha512-z7O0IS8Plc39rTCq6i6iHxk43duYOn8uFJiWSewIq0Bww1RNybVHSCjahmcC87ZqAm4OTvFzlzeGu3XAzG1ctQ==", - "requires": { - "minimatch": "^3.0.4" - } - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -4775,17 +4754,6 @@ "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==" }, - "jake": { - "version": "10.8.4", - "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.4.tgz", - "integrity": "sha512-MtWeTkl1qGsWUtbl/Jsca/8xSoK3x0UmS82sNbjqxxG/de/M/3b1DntdjHgPMC50enlTNwXOCRqPXLLt5cCfZA==", - "requires": { - "async": "0.9.x", - "chalk": "^4.0.2", - "filelist": "^1.0.1", - "minimatch": "^3.0.4" - } - }, "jest": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz", diff --git a/package.json b/package.json index b8a0b9f..b0ded74 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "@types/nodemailer": "^6.4.4", "amqp-connection-manager": "^3.6.0", "amqplib": "^0.8.0", - "ejs": "^3.1.6", "firebase-admin": "^9.11.1", "jest-sonar-reporter": "^2.0.0", "mongodb": "^3.6.11", diff --git a/public/img/logo.png b/public/img/logo.png deleted file mode 100644 index 20f4ccf..0000000 Binary files a/public/img/logo.png and /dev/null differ diff --git a/public/scripts/index.js b/public/scripts/index.js deleted file mode 100644 index 3e01417..0000000 --- a/public/scripts/index.js +++ /dev/null @@ -1,17 +0,0 @@ -$(function() { - $( ".aceitar, .recusar" ).click(function() { - const buttonClicked = $(this).attr('class') - const endpoint = buttonClicked == 'aceitar' ? 'validateUser' : 'removeUser' - const userEmail = $(this).attr('data-email') - const data = { email: userEmail } - $.ajax({ - type: 'POST', - url: `/${endpoint}`, - data: JSON.stringify(data), - contentType: "application/json", - success: () =>{ - window.location.reload(true); - } - }); - }); -}); \ No newline at end of file diff --git a/public/styles/index.css b/public/styles/index.css deleted file mode 100644 index fea2a18..0000000 --- a/public/styles/index.css +++ /dev/null @@ -1,236 +0,0 @@ -@import url(//fonts.googleapis.com/css?family=Lato:300:400); - -h1 { - font-family: "Lato", sans-serif; - font-weight: 300; - letter-spacing: 2px; - font-size: 48px; -} - -.header { - position: relative; - text-align: center; - background: linear-gradient( - 60deg, - rgb(255, 0, 0) 0%, - rgba(248, 0, 0, 0.603) 100% - ); - color: white; -} - -.logo { - width: 150px; - fill: white; - padding-right: 25px; - display: inline-block; - vertical-align: middle; -} - -.inner-header { - height: 25vh; - width: 100%; - margin: 0; - padding: 0; -} - -.flex { - /*Flexbox for containers*/ - display: flex; - justify-content: center; - align-items: center; - text-align: center; -} - -.waves { - position: relative; - width: 100%; - height: 15vh; - margin-bottom: -7px; /*Fix for safari gap*/ - min-height: 100px; - max-height: 150px; -} - -.content { - position: relative; - height: 20vh; - text-align: center; - background-color: white; -} - -/* Animation */ - -.parallax > use { - animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite; -} -.parallax > use:nth-child(1) { - animation-delay: -2s; - animation-duration: 7s; -} -.parallax > use:nth-child(2) { - animation-delay: -3s; - animation-duration: 10s; -} -.parallax > use:nth-child(3) { - animation-delay: -4s; - animation-duration: 13s; -} -.parallax > use:nth-child(4) { - animation-delay: -5s; - animation-duration: 20s; -} -@keyframes move-forever { - 0% { - transform: translate3d(-90px, 0, 0); - } - 100% { - transform: translate3d(85px, 0, 0); - } -} -/*Shrinking for mobile*/ -@media (max-width: 768px) { - .waves { - height: 40px; - min-height: 40px; - } - .content { - height: 30vh; - } - h1 { - font-size: 24px; - } -} - -h2 { - margin-top: 85px; - font-family: "Lato", sans-serif; - font-weight: bold; - letter-spacing: 2px; - font-size: 35px; - text-align: center; - color: rgb(255, 0, 0); -} - -* { - box-sizing: border-box; - margin: 0; - padding: 0; -} - -body { - color: #333; - font-family: "Open Sans", sans-serif; -} - -main{ - margin: 0px 20px; -} - -table { - border: 1px solid #eee; - border-collapse: collapse; - text-align: left; - width: 100%; - align-items: center; - font-family: "Open Sans", sans-serif; - margin-top: 50px; -} - -table thead th { - padding: 10px; - font-size: 1em; - color: #000; - font-weight: 600; -} - -table tbody tr td { - display: table-cell; - font-weight: 400; - padding: 10px; - text-align: left; - position: relative; -} - -table tbody tr { - border: none; - display: table-row; -} - -table tbody tr:nth-child(odd) { - background: #f2f2f2; -} - -table tbody tr td button { - display: inline-block; - padding: 10px 15px; - position: initial; - transform: translate(0); - width: auto; -} - -button::first-letter { - text-transform:capitalize; -} - -table tbody tr td button { - background: #4caf50; - border: none; - border-radius: 20px; - box-shadow: 0 4px 8px rgba(34, 34, 34, 0.2); - color: #fff; - font-weight: 700; - padding: 10px 10px; - width: 100%; -} - -.recusar { - background: red; -} - -table thead { - display: table-header-group; - font-weight: 500; -} - -table tbody tr td:before { - display: none; -} - -table tbody tr td button:hover, -table tbody tr td button:focus { - background: #a795fe; - cursor: pointer; -} - -@media all and (max-width: 800px) { - table tbody tr td { - display: block; - text-align: right; - } - - table tbody tr td p{ - display: block; - overflow: hidden; - } - - table tbody tr td:before { - content: attr(data-title); - display: block; - font-weight: 600; - font-size: 1em; - float: left; - } - - table { - border: none; - } - - table thead { - display: none; - } - - table tbody tr { - margin-bottom: 10px; - display: block; - border: 1px solid #dad6eb; - } -} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index dc56d8d..b4db39f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,9 +1,7 @@ import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; -import { Transport } from '@nestjs/microservices'; +import { Transport, MicroserviceOptions } from '@nestjs/microservices'; import { ConfigService } from './config/configuration'; -import { join } from 'path'; -import { NestExpressApplication } from '@nestjs/platform-express'; type MicrosserviceConfig = { queueName: string; @@ -15,24 +13,20 @@ async function bootstrap() { 'microsservice', ); - const app = await NestFactory.create(AppModule); - app.connectMicroservice({ - transport: Transport.RMQ, - options: { - urls: [microsserviceOptions.host], - queue: microsserviceOptions.queueName, - queueOptions: { - durable: true, + const app = await NestFactory.createMicroservice( + AppModule, + { + transport: Transport.RMQ, + options: { + urls: [microsserviceOptions.host], + queue: microsserviceOptions.queueName, + queueOptions: { + durable: true, + }, }, }, - }); - - app.useStaticAssets(join(__dirname, '..', 'public')); - app.setBaseViewsDir(join(__dirname, '..', 'src/views')); - app.setViewEngine('ejs'); - - await app.startAllMicroservices(); + ); - await app.listen(9880); + await app.listen(); } bootstrap(); diff --git a/src/users/users.controller.ts b/src/users/users.controller.ts index 523c2aa..a6e0e88 100644 --- a/src/users/users.controller.ts +++ b/src/users/users.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Render, Res } from '@nestjs/common'; +import { Controller, Post } from '@nestjs/common'; import { MessagePattern, Payload } from '@nestjs/microservices'; import { UsersService } from './users.service'; import { CreateUserDto } from './dto/create-user.dto'; @@ -42,25 +42,19 @@ export class UsersController { return response.toJSON(); } - @Get('selecionarUsuarios') - @Render('index') + @MessagePattern('getNonValidatedUsersData') async getNonValidatedUsersData() { const response = await this.usersService.getNonValidatedUsers(); - return { users: response }; - } - - @Get('') - async root(@Res() res) { - return res.redirect('/selecionarUsuarios'); + return response; } - @Post('validateUser') + @MessagePattern('validateUser') async validateUser(@Payload() data) { const response = await this.usersService.validateUser(data.email); return response; } - @Post('removeUser') + @MessagePattern('removeUser') async removeUser(@Payload() data) { const response = await this.usersService.removeUser(data.email); return response; diff --git a/src/users/users.service.ts b/src/users/users.service.ts index 020935c..db1e08a 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -139,7 +139,7 @@ export class UsersService { async removeUser(email: string) { try { - await this.userModel.deleteOne({ email: email }); + return await this.userModel.deleteOne({ email: email }); } catch (error) { throw new MicrosserviceException(error.message, HttpStatus.BAD_REQUEST); } diff --git a/src/views/index.ejs b/src/views/index.ejs deleted file mode 100644 index d36f5cc..0000000 --- a/src/views/index.ejs +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - Nova Cartografia Social - - - - -
-
- - -
- - - -

Nova Cartografia Social

-
- - -
- - - - - - - - - - - -
- - -
- - -
- -
-
-

Análise de Solicitação de Cadastros

-
- - - - - - - - - - - - - - <% users.forEach((user)=> { %> - - - - - <%if (user.type=='RESEARCHER' ) { %> - - - - - - <% } else if (user.type=='COMMUNITY_MEMBER' ) { %> - - - - <% } %> - - <% ['aceitar', 'recusar' ].forEach((text)=> { %> - - <% }) %> - - <% }) %> - -
NomeEmailCelularPerfilAfiliação/ComunidadeAção
- <%= user.name %> - - <%= user.email %> - - <%= user.cellPhone %> - - Pesquisador - - <%= user.affiliation %> - - Membro de comunidade - -

- <%= user.community %> Função: <%= user.role %> -

-
- -
-
- - - - - \ No newline at end of file