에러메시지 A circular dependency has been detected (property key: "replies"). Please, make sure that each side of a bidirectional relationships are using lazy resolvers ("type: () => ClassType"). 해결 에러메시지 (property key: "replies") 를 참고해 replies를 사용하는 entity 파일을 찾아서 아래와 같이 추가해줬다. // user.entity.ts @ApiProperty({ type: () => Reply // --> 이 부분 추가 }) @IsInt() @OneToMany((type) => Reply, (reply) => reply...

문제 import { PickType } from '@nestjs/mapped-types'; import { ApiProperty } from '@nestjs/swagger'; import { IsNumber } from 'class-validator'; import { Alarm } from 'src/_entity/alarm.entity'; export class CreateAlarmDto extends PickType(Alarm, [ 'type', 'image', 'text', 'link' ] as const) { @ApiProperty({ description: '유저 ID' }) @IsNumber({}, { each: true }) userIds: number[]; } Dto를 만들면서 Alarm..

Swagger 셋업 DocumentBuilder를 이용해 Swagger 관련 옵션들을 설정하면 되는데, 아래와 같이 다양한 옵션들이 있다. 아무 옵션 없이 build()만 하면 이렇게 나온다. (버전은 default 값인 1.0.0 으로 표시된다) 우선 기본적인 설정들을 추가해보았다. // main.ts import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule..

swagger 설치 npm i @nestjs/swagger swagger-ui-express main.ts import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; import { ValidationPipe } from '@nestjs/common'; async function bootstrap() { const app = await NestFactory.create(AppModule); const options = new DocumentBuilder() .setTitle('SNS API') ..