Skip to content
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

[#200] integracao rotinas notificacao #16

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 71 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dependencies": {
"@grpc/grpc-js": "1.7.3",
"@grpc/proto-loader": "0.7.3",
"@nestjs/axios": "0.1.0",
"@nestjs/axios": "^0.1.0",
"@nestjs/common": "9.1.2",
"@nestjs/config": "2.2.0",
"@nestjs/core": "9.1.2",
Expand All @@ -43,9 +43,11 @@
"@nestjs/microservices": "9.1.2",
"@nestjs/passport": "9.0.3",
"@nestjs/platform-express": "9.1.2",
"@nestjs/schedule": "^4.0.0",
"@nestjs/typeorm": "9.0.1",
"amqp-connection-manager": "4.1.3",
"amqplib": "0.10.0",
"axios": "^1.6.2",
"bcrypt": "5.0.1",
"cache-manager": "3.4.3",
"cache-manager-redis-store": "2.0.0",
Expand Down
149 changes: 149 additions & 0 deletions reports/sonar-report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<testExecutions version="1">
<file path="src/rotina/rotina.service.spec.ts">
<testCase name="RotinaService should be defined" duration="91" />
<testCase name="RotinaService should create Rotina" duration="40" />
<testCase name="RotinaService should find Rotina" duration="35" />
<testCase name="RotinaService should remove Rotina" duration="31" />
<testCase name="RotinaService should update Rotina" duration="47" />
<testCase name="RotinaService findAll should findAll Rotina" duration="48" />
<testCase name="RotinaService findAll should findAllToCron Rotina" duration="45" />
</file>
<file path="src/cron/cron.service.spec.ts">
<testCase name="CronService should be defined" duration="781" />
<testCase name="CronService should call rotina service" duration="334" />
</file>
<file path="src/rotina/rotina.controller.spec.ts">
<testCase name="RotinaController should be defined" duration="79" />
<testCase name="RotinaController should create Idoso" duration="39" />
<testCase name="RotinaController should find Idoso" duration="27" />
<testCase name="RotinaController should remove Idoso" duration="20" />
<testCase name="RotinaController should update Idoso" duration="24" />
<testCase name="RotinaController findAll should findAll Rotina" duration="22" />
</file>
<file path="src/idoso/idoso.controller.spec.ts">
<testCase name="IdosoController should be defined" duration="74" />
<testCase name="IdosoController should create Idoso" duration="35" />
<testCase name="IdosoController should find Idoso" duration="27" />
<testCase name="IdosoController should remove Idoso" duration="28" />
<testCase name="IdosoController should update Idoso" duration="40" />
<testCase name="IdosoController findAll should findAll Idoso" duration="47" />
</file>
<file path="src/idoso/idoso.service.spec.ts">
<testCase name="IdosoService should be defined" duration="83" />
<testCase name="IdosoService should create Idoso" duration="188" />
<testCase name="IdosoService should find Idoso" duration="61" />
<testCase name="IdosoService should remove Idoso" duration="28" />
<testCase name="IdosoService should update Idoso" duration="28" />
<testCase name="IdosoService should update Idoso with photo" duration="27" />
<testCase name="IdosoService findAll should findAll Idoso" duration="56" />
</file>
<file path="src/config/db/db.service.spec.ts">
<testCase name="DbService should be defined" duration="74" />
<testCase name="DbService should return db config development" duration="49" />
<testCase name="DbService should return db config production" duration="38" />
</file>
<file path="src/autenticacao.guard.spec.ts">
<testCase name="AutenticacaoGuard should be defined" duration="86" />
<testCase name="AutenticacaoGuard should pass if route is public" duration="33" />
<testCase name="AutenticacaoGuard should pass if authentication is successful" duration="40" />
<testCase name="AutenticacaoGuard should not pass if authentication is unsuccessful" duration="34" />
</file>
<file path="src/shared/validators/id.validator.spec.ts">
<testCase name="HttpResponse should be defined" duration="10" />
</file>
<file path="src/shared/decorators/paginate.decorator.spec.ts">
<testCase name="Pagination should be defined" duration="10" />
<testCase name="Pagination should be Paginate" duration="10" />
<testCase name="Pagination should be Paginate not limit" duration="2" />
<testCase name="Pagination should be Paginate not offset" duration="3" />
</file>
<file path="src/shared/decorators/ordenate.decorator.spec.ts">
<testCase name="Pagination should be defined" duration="10" />
<testCase name="Pagination should be Paginate" duration="8" />
<testCase name="Pagination should be Paginate not limit" duration="6" />
<testCase name="Pagination should be Paginate not offset" duration="3" />
<testCase name="Ordenate should return default object if there is no JSON" duration="4" />
<testCase name="Ordenate should return OrderParams object with values for order" duration="3" />
<testCase name="Ordenate should return default values when obj has empty props" duration="2" />
<testCase name="Ordenate should be Ordenate using factory" duration="2" />
</file>
<file path="src/shared/decorators/public-route.spec.ts">
<testCase name="Pagination should be defined" duration="10" />
</file>
<file path="src/shared/decorators/filtrate-string.spec.ts">
<testCase name="Pagination should be defined" duration="14" />
<testCase name="Pagination should be Paginate" duration="9" />
<testCase name="Pagination should be Paginate not limit" duration="6" />
<testCase name="Pagination should be Paginate not offset" duration="3" />
<testCase name="FiltrateString should return empty object for filter" duration="5" />
<testCase name="FiltrateString should return TestFilterProps object with values for filter" duration="2" />
<testCase name="FiltrateString should be FiltrateString using factory" duration="3" />
</file>
<file path="src/shared/interceptors/data-transform.interceptor.spec.ts">
<testCase name="DataTransformInterceptor should be defined" duration="10" />
<testCase name="DataTransformInterceptor should be intercept t1" duration="16" />
<testCase name="DataTransformInterceptor should be intercept should formatData with message" duration="2" />
<testCase name="DataTransformInterceptor should be intercept should formatData with no message" duration="2" />
<testCase name="DataTransformInterceptor should be intercept should formatData with Paginate" duration="3" />
</file>
<file path="src/shared/decorators/filtrate.decorator.spec.ts">
<testCase name="Pagination should be defined" duration="11" />
<testCase name="Pagination should be Paginate" duration="7" />
<testCase name="Pagination should be Paginate not limit" duration="5" />
<testCase name="Pagination should be Paginate not offset" duration="2" />
<testCase name="Filtrate should return empty object for filter" duration="4" />
<testCase name="Filtrate should return TestFilterProps object with values for filter" duration="2" />
<testCase name="Filtrate should be Filtrate using factory" duration="2" />
</file>
<file path="src/shared/filters/all-exceptions.filter.spec.ts">
<testCase name="AllExceptionsFilter should be defined" duration="10" />
<testCase name="AllExceptionsFilter should be catch" duration="8" />
<testCase name="AllExceptionsFilter should be not exception to class-validator" duration="3" />
<testCase name="AllExceptionsFilter should be not exception only message" duration="3" />
</file>
<file path="src/shared/filters/model-not-found.exception-filter.spec.ts">
<testCase name="ModelNotFoundExceptionFilter should be defined" duration="10" />
<testCase name="ModelNotFoundExceptionFilter should be catch" duration="8" />
</file>
<file path="src/shared/classes/http-response.spec.ts">
<testCase name="HttpResponse should be defined" duration="8" />
<testCase name="HttpResponse should create message with payload text" duration="6" />
<testCase name="HttpResponse should create message with success text" duration="2" />
<testCase name="HttpResponse should create message with updated text" duration="2" />
<testCase name="HttpResponse should create message with deleted text" duration="2" />
</file>
<file path="src/shared/helpers/string-helpers.spec.ts">
<testCase name="String Helpers should be regex" duration="9" />
</file>
<file path="src/shared/helpers/sql-query-helper.spec.ts">
<testCase name="Where Clause STRING should return empty string if value is undefined" duration="9" />
<testCase name="Where Clause STRING should return empty string if value has no length" duration="2" />
<testCase name="Where Clause STRING should return where string based on given value and tableColumn" duration="1" />
<testCase name="Where Clause NUMBER should return empty string if value is undefined" duration="1" />
<testCase name="Where Clause NUMBER should return where string based on given value and tableColumn" duration="3" />
<testCase name="Where Clause BOOLEAN should return empty string if value is undefined" duration="1" />
<testCase name="Where Clause BOOLEAN should return empty string if value is higher than 1" duration="1" />
<testCase name="Where Clause BOOLEAN should return where string based on given value and tableColumn" duration="1" />
<testCase name="Where Clause ARRAY NUMBER should return empty string if value is undefined" duration="3" />
<testCase name="Where Clause ARRAY NUMBER should return where string if value is number" duration="3" />
<testCase name="Where Clause ARRAY NUMBER should return where string if value is number array" duration="3" />
</file>
<file path="src/shared/helpers/buffer-to-image.spec.ts">
<testCase name="Buffer to image bufferToBase64 should be bufferToBase64 a image" duration="14" />
<testCase name="Buffer to image bufferToBase64 should getImageUri" duration="3" />
<testCase name="Buffer to image bufferToBase64 should be bufferToBase64 a empty if null" duration="3" />
<testCase name="Buffer to image bufferToBase64 should be bufferToBase64 a empty if not image" duration="3" />
<testCase name="Buffer to image isBase64 should be false" duration="3" />
<testCase name="Buffer to image isBase64 should be true" duration="4" />
<testCase name="Buffer to image isBase64Image should be false" duration="2" />
<testCase name="Buffer to image isBase64Image should be true" duration="3" />
</file>
<file path="src/shared/helpers/commons.spec.ts">
<testCase name="Helper deve criar um hash com tamanho default" duration="13" />
<testCase name="Helper should be return if its nill for undefined" duration="4" />
<testCase name="Helper should be return if its nill for null" duration="1" />
<testCase name="Helper should be isJsonObject to be true" duration="3" />
<testCase name="Helper should be isJsonObject to be false" duration="2" />
<testCase name="Helper should be isJsonObject to be false in not parse" duration="1" />
</file>
</testExecutions>
4 changes: 4 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { APP_GUARD } from '@nestjs/core';
import { ClientsModule, Transport } from '@nestjs/microservices';
import { ScheduleModule } from '@nestjs/schedule';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AutenticacaoGuard } from './autenticacao.guard';
import { DbModule } from './config/db/db.module';
import { DbService } from './config/db/db.service';
import { CronModule } from './cron/cron.module';
import { IdosoModule } from './idoso/idoso.module';
import { RotinaModule } from './rotina/rotina.module';

const ENV = process.env.NODE_ENV;

@Module({
imports: [
ScheduleModule.forRoot(),
ConfigModule.forRoot({
isGlobal: true,
envFilePath: !ENV ? '.env' : `.env.${ENV}`,
Expand All @@ -38,6 +41,7 @@ const ENV = process.env.NODE_ENV;
DbModule,
IdosoModule,
RotinaModule,
CronModule,
],
controllers: [],
providers: [
Expand Down
13 changes: 13 additions & 0 deletions src/cron/cron.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { HttpModule } from '@nestjs/axios';
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Rotina } from '../rotina/entities/rotina.entity';
import { RotinaService } from '../rotina/rotina.service';
import { CronService } from './cron.service';

@Module({
imports: [TypeOrmModule.forFeature([Rotina]), HttpModule],
providers: [CronService, RotinaService, Repository],
})
export class CronModule {}
Loading
Loading