반응형
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
- Creating Operators
- init
- Bug
- @Environment
- subject
- IOS
- @ObservedObject
- NullObject
- Operators
- SwiftUI
- @State
- RFC1738/1808
- SWIFT
- ios14
- nestjs
- vim
- dismiss
- URL(string:)
- graphql
- @Binding
- operator
- RxCocoa
- typeorm
- NavigationLink
- init?
- Xcode
- SwiftUI 화면 갱신
- @EnvironmentObject
- RxSwift
- Operater
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