파크로그
  • Cannot determine a GraphQL output type for the "...". Make sure your class is decorated with an appropriate decorator.
    • GraphQL 에서 Return Type을 통일시켜주기 위해 Output Dto 를 만들었으나, 해당 Output 을 적용하려고 하니 생긴 오류
    • Output 에도 데코레이터를 적용시켜줘야함.
      • GraphQL 에게 타입을 알려주는 Field 도 깜빡하지 말고 넣자.
    import { ObjectType } from '@nestjs/graphql';
    import { CommonOutput } from 'src/common/dtos/output.dto';
    import { Podcast } from '../entities/podcast.entity';
    
    export class PodcastsOutput extends CommonOutput {
      podcasts?: Podcast[];
    }
    export class PodcastOutput extends CommonOutput {
      podcast?: Podcast;
    }
    
    ->
    
    @ObjectType()
    export class PodcastsOutput extends CommonOutput {
      @Field((type) => [Podcast], { nullable: true })
      podcasts?: Podcast[];
    }
    @ObjectType()
    export class PodcastOutput extends CommonOutput {
      @Field((type) => Podcast, { nullable: true })
      podcast?: Podcast;
    }

profile

파크로그

@파크park

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!