Skip to content

Commit

Permalink
Merge pull request #10 from WillianAgostini/develop
Browse files Browse the repository at this point in the history
fix: rm trackId
  • Loading branch information
WillianAgostini authored Jul 4, 2024
2 parents c831fc0 + 464ec1d commit 423eb9d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 381 deletions.
19 changes: 2 additions & 17 deletions src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
import { APP_GUARD } from '@nestjs/core';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AuthGuard } from './auth/auth.guard';
import { DataSourceOrmModule } from './data-source-orm.module';
import { TrackingInterceptor } from './interceptor/tracking.interceptor';
import { Investment } from './investment/entities/investment';
import { InvestmentModule } from './investment/investment.module';
import { LoggerMiddleware } from './middleware/logger.middleware';
import { RealTimeModule } from './real-time/real-time.module';
import { RegulationsModule } from './regulations/regulations.module';
import { FinancialRate } from './simulation/entities/financial-rate';
import { SimulationModule } from './simulation/simulation.module';
import { Track } from './track/entities/track';
import { TrackModule } from './track/track.module';

@Module({
imports: [
DataSourceOrmModule,
TypeOrmModule.forFeature([FinancialRate, Investment, Track]),
SimulationModule,
RegulationsModule,
RealTimeModule,
TrackModule,
InvestmentModule,
],
imports: [DataSourceOrmModule, TypeOrmModule.forFeature([FinancialRate, Investment]), SimulationModule, RegulationsModule, RealTimeModule, InvestmentModule],
controllers: [],
providers: [
{
provide: APP_GUARD,
useClass: AuthGuard,
},
{
provide: APP_INTERCEPTOR,
useClass: TrackingInterceptor,
},
],
})
export class AppModule implements NestModule {
Expand Down
8 changes: 5 additions & 3 deletions src/data-source-orm.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import { Global, Logger, Module } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { Investment } from './investment/entities/investment';
import { FinancialRate } from './simulation/entities/financial-rate';
import { Track } from './track/entities/track';
import dotenv from 'dotenv';
dotenv.config();

const appDataSource = new DataSource({
type: 'postgres',
port: 5432,
host: process.env.DATABASE_HOST,
username: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME,
ssl: { rejectUnauthorized: false },
entities: [FinancialRate, Investment, Track],
entities: [FinancialRate, Investment],
});

@Global()
Expand All @@ -29,7 +31,7 @@ const appDataSource = new DataSource({
}
} catch (error) {
Logger.error(error, DataSourceOrmModule.name);
throw error;
// throw error;
}
},
},
Expand Down
102 changes: 0 additions & 102 deletions src/interceptor/tracking.interceptor.ts

This file was deleted.

18 changes: 2 additions & 16 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Logger, ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
import { writeFileSync } from 'fs';
import { addTrackIdToResponses, addTrackIdToHeaders } from './interceptor/tracking.interceptor';
// import { SimulationService } from './simulation/services/simulation.service';
import { AppModule } from './app.module';

async function bootstrap() {
const app = await NestFactory.create(AppModule, {
Expand All @@ -22,24 +20,12 @@ async function bootstrap() {
.addServer(serverUrl)
.build();

let document = { ...SwaggerModule.createDocument(app, config), openapi: '3.1.0' };
document = addTrackIdToResponses(document);
document = addTrackIdToHeaders(document);
const document = { ...SwaggerModule.createDocument(app, config), openapi: '3.1.0' };
writeFileSync('swagger.json', JSON.stringify(document, null, 2));
SwaggerModule.setup('api', app, document, {
jsonDocumentUrl: 'swagger',
});

// const simulationService = app.get<SimulationService>(SimulationService);
// const fees = await simulationService.getFees();
// console.log(fees);
// console.log(await simulationService.simulate({
// amount: 10000,
// months: 12,
// lcx: 110,
// cdb: 100
// }));

await app.listen(port);
Logger.debug('Running');
}
Expand Down
17 changes: 0 additions & 17 deletions src/track/entities/track.ts

This file was deleted.

37 changes: 0 additions & 37 deletions src/track/services/track.service.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/track/track.module.ts

This file was deleted.

Loading

0 comments on commit 423eb9d

Please sign in to comment.