반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- URL(string:)
- graphql
- init?
- RxSwift
- RxCocoa
- ios14
- SWIFT
- Xcode
- nonisolated
- Operators
- @Binding
- NavigationLink
- NullObject
- @EnvironmentObject
- typeorm
- @Environment
- Creating Operators
- @State
- Bug
- vim
- Operater
- nestjs
- IOS
- dismiss
- operator
- subject
- SwiftUI
- RFC1738/1808
- swift6
- init
Archives
- Today
- Total
Tunko Development Diary
[NestJS, GraphQL, typeORM]GraphQL Enum Column 생성 본문
import {
Field,
InputType,
ObjectType,
registerEnumType,
} from '@nestjs/graphql';
import { Column, Entity } from 'typeorm';
export enum EXType {
TYPE1 = 'type1',
TYPE2 = 'type2'
}
registerEnumType(EXType, { name: 'EXType' });
@ObjectType()
@Entity()
export class EXEntity {
...
@Column({type : 'enum', enum : EXType})
@Field((type) => EXType)
type : EXType
...
}
registerEnumType 을 사용하면 GrqphQL 에서 해당 Enum 타입을 인식할 수 있도록 할 수 있다.
Documentation | NestJS - A progressive Node.js framework
반응형
'Development > Nest.js' 카테고리의 다른 글
[NestJS]Middleware 생성 및 사용 (0) | 2021.05.03 |
---|---|
[NestJS][GraphQL] mapped-types 정리 (2) | 2021.04.14 |
[NestJS] [TypeOrm] Active Record 패턴vs Data Mapper 패턴 (0) | 2021.04.13 |
[NestJS] Configuration 환경변수 설정 [@nestjs/config, cross-env, joi] (0) | 2021.04.10 |
[Nest.js][GraphQL] 기반 postgres DB 설치 (0) | 2021.04.10 |
Comments