Skip to content

Commit

Permalink
🚀 feat(boiler) : add typeorm , repository test code with transaction …
Browse files Browse the repository at this point in the history
…DI against actual(real) db
  • Loading branch information
ImNM committed Jul 12, 2022
1 parent 9a7a0a3 commit 33921e2
Show file tree
Hide file tree
Showing 15 changed files with 575 additions and 6 deletions.
25 changes: 22 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ services:
restart: always
ports:
- '5432:5432'
environment:
POSTGRES_USER: 'gosrcok'
POSTGRES_PASSWORD: 'gosrock'
env_file:
- .env
networks:
- postgres

pgadmin:
links:
- postgres:postgres
container_name: pgadmin
image: dpage/pgadmin4
ports:
- '8080:80'
# volumes:
# - /data/pgadmin:/root/.pgadmin
env_file:
- .env
networks:
- postgres

networks:
postgres:
driver: bridge
224 changes: 224 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"moment-timezone": "^0.5.34",
"passport": "^0.6.0",
"passport-jwt": "^4.0.0",
"pg": "^8.7.3",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
Expand Down
11 changes: 9 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as Joi from 'joi';
import { BullModule } from '@nestjs/bull';
import { AllExceptionsFilter } from './common/exceptions/http-exception.filter';
import { APP_FILTER } from '@nestjs/core';
import { DatabaseModule } from './database/database.module';

@Module({
imports: [
Expand All @@ -25,7 +26,12 @@ import { APP_FILTER } from '@nestjs/core';
SWAGGER_USER: Joi.string(),
SWAGGER_PASSWORD: Joi.string(),
REDIS_HOST: Joi.string(),
REDIS_PORT: Joi.number()
REDIS_PORT: Joi.number(),
POSTGRES_HOST: Joi.string().default('localhost'),
POSTGRES_PORT: Joi.number().default(5432),
POSTGRES_USER: Joi.string().default('gosrock'),
POSTGRES_PASSWORD: Joi.string().default('gosrock22th'),
POSTGRES_DB: Joi.string().default('ticket')
})
}),
BullModule.forRootAsync({
Expand All @@ -50,7 +56,8 @@ import { APP_FILTER } from '@nestjs/core';
TicketsModule,
OrdersModule,
SlackModule,
SocketModule
SocketModule,
DatabaseModule.forRoot({ isTest: false })
],
controllers: [],
providers: [
Expand Down
18 changes: 18 additions & 0 deletions src/auth/auth.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { AuthController } from './auth.controller';

describe('AuthController', () => {
let controller: AuthController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [AuthController],
}).compile();

controller = module.get<AuthController>(AuthController);
});

it('should be defined', () => {
expect(controller).toBeDefined();
});
});
Loading

0 comments on commit 33921e2

Please sign in to comment.