상품 등록 API 오류 납니다
ERROR [TypeOrmModule] Unable to connect to the database Retrying (2)...
QueryFailedError: Incorrect datetime value: '0000-00-00 00:00:00' for column 'meetingTime' at row 1라고 오류납니다
product.resolver.ts
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
import { ProductsService } from './product.service';
import { CreateBoardInput } from '../boards/dto/create-board.input';
import { CreateProductInput } from './dto/create-product.input';
import { Product } from './entities/product.entity';
@Resolver()
export class ProductsResolver {
constructor(
private readonly productsService: ProductsService, //
) {}
@Query(() => [Product])
fetchProducts(): Promise<Product[]> {
return this.productsService.findAll();
}
@Query(() => Product)
fetchProduct(
@Args('productId') productId: string, //
): Promise<Product> {
return this.productsService.findOne({ productId });
}
@Mutation(() => Product)
createProduct(
@Args('createProductInput') createProductInput: CreateProductInput,
): Promise<Product> {
// << 브라우저에 결과 보내주는 2가지 방법>>
// 1. 등록된 내용이 담긴 객체를 그대로 브라우저에 보내주기
return this.productsService.create({ createProductInput });
// 이걸 선호. 조회 api 요청을 안해도 된다
// 2.결과에서만 간단히 보내주기
// return '정상적으로 상품이 등록되었습니다'
}
}
product.service.ts
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
import { ProductsService } from './product.service';
import { CreateBoardInput } from '../boards/dto/create-board.input';
import { CreateProductInput } from './dto/create-product.input';
import { Product } from './entities/product.entity';
@Resolver()
export class ProductsResolver {
constructor(
private readonly productsService: ProductsService, //
) {}
@Query(() => [Product])
fetchProducts(): Promise<Product[]> {
return this.productsService.findAll();
}
@Query(() => Product)
fetchProduct(
@Args('productId') productId: string, //
): Promise<Product> {
return this.productsService.findOne({ productId });
}
@Mutation(() => Product)
createProduct(
@Args('createProductInput') createProductInput: CreateProductInput,
): Promise<Product> {
// << 브라우저에 결과 보내주는 2가지 방법>>
// 1. 등록된 내용이 담긴 객체를 그대로 브라우저에 보내주기
return this.productsService.create({ createProductInput });
// 이걸 선호. 조회 api 요청을 안해도 된다
// 2.결과에서만 간단히 보내주기
// return '정상적으로 상품이 등록되었습니다'
}
}
productSaleslocation.entity.ts
import { Field, Float, ObjectType } from '@nestjs/graphql';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
@Entity()
@ObjectType()
export class ProductSaleslocation {
@PrimaryGeneratedColumn('uuid')
@Field(() => String)
id: string;
@Column()
@Field(() => String)
address: string;
@Column()
@Field(() => String)
addressDetail: string;
// // 9자리 중에서 6자리가 소수점
@Column({ type: 'decimal', precision: 9, scale: 6 })
@Field(() => Float)
lat: number;
@Column({ type: 'decimal', precision: 9, scale: 6 })
@Field(() => Float)
lng: number;
@Column()
@Field(() => Date)
meetingTime: Date;
}
meetingTime graphlql 타입을 맞게 해났는데 왜 오류나는지 모르곘습니다
답변 1
그래프 ql 문서 사용할때 느낌표 남는거 어떻게 없애나요?
0
82
2
강의 전체 소스 코드를 받고싶습니다.
0
75
2
fontawesome 사용 문의
0
76
2
소스 코드 부탁드립니다~
0
85
2
깃 레포지터리 소스
0
80
2
커리큘럼12.css 정렬 에 나오는 과제 정답알고싶어요
0
72
2
10-01 Entity TypeOrmModule.forRoot 에 entities
0
84
3
강의 버전관련 문의입니다
0
102
2
Ubuntu 설치 관련
0
60
1
schema.gql 질문 드립니다.
0
50
1
서버 재실행시 Many to Many
0
100
3
input 관련 문의
0
89
2
Rest API 보다는 graphql이 주된 내용인데
0
130
2
강의 전체 소스코드 받을수있을까요?
0
154
1
도커볼륨 마운트 관련
0
126
2
findOne 타입스크립트오류
0
108
1
http => htrtps 호출 인증서 신뢰 오류
0
349
1
self-signed certificate in certificate chain 에러 발생
0
411
1
mongoose 설치 오류
0
141
1
특정 API, 특정 IP 허용 (단일경로에 CORS 활성화)
0
280
2
08-06
0
177
3
구조랑 패턴 관련해서 질문
0
124
2
mydocker
0
128
2
coolsms statuscode 2000 인데 전송안돼는 경우 확인.
0
156
1





