This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.9' | |
services: | |
db: | |
image: postgres:13.1-alpine | |
environment: | |
POSTGRES_USER: $POSTGRES_USER | |
POSTGRES_PASSWORD: $POSTGRES_PASSWORD | |
POSTGRES_DB: $POSTGRES_DB | |
POSTGRES_PORT: $POSTGRES_PORT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as path from 'path'; | |
import { Builder, fixturesIterator, Loader, Parser, Resolver } from 'typeorm-fixtures-cli/dist'; | |
import { Connection, getConnection, getRepository } from 'typeorm'; | |
import { Injectable } from '@nestjs/common'; | |
interface QueryObject { | |
operationName: null | string; | |
query: string; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { ConfigModule, ConfigService } from '@nestjs/config'; | |
import { TypeOrmModule } from '@nestjs/typeorm'; | |
import { getPostgresConfig } from '@configs/postgres.config'; | |
import { GraphQLModule } from '@nestjs/graphql'; | |
import { TravelModule } from '@modules/travel/travel.module'; | |
import { getGraphQLConfig } from '@configs/graphql.config'; | |
@Module({ | |
imports: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ConfigService } from '@nestjs/config'; | |
import { TypeOrmModuleOptions } from '@nestjs/typeorm'; | |
import * as fs from 'fs'; | |
export const getPostgresConfig = (configService: ConfigService): TypeOrmModuleOptions => { | |
const isTestEnv = process.env.NODE_ENV === 'test'; | |
const options: TypeOrmModuleOptions = { | |
type: 'postgres', | |
host: configService.get('POSTGRES_HOST'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Test, TestingModule } from '@nestjs/testing'; | |
import { HttpStatus, INestApplication, ValidationPipe } from '@nestjs/common'; | |
import * as request from 'supertest'; | |
import { AppModule } from '../../src/app.module'; | |
import { TestUtils } from '@test/test-utils'; | |
import { CreateTravelDto } from '@modules/travel/dtos/create-travel.dto'; | |
import { UpdateTravelDto } from '@modules/travel/dtos/update-travel.dto'; | |
import { TravelRepository } from '@modules/travel/repositories/travel.repository'; | |
import { getCustomRepository, In } from 'typeorm'; | |
import { CreateTravelResponseDto } from '@modules/travel/dtos/create-travel-response.dto'; |