UpdateValuesMissingError
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm/repository/Repository';
import { User } from '../users/entities/user.entity';
import {
Payment,
POINT_TRANSACTION_STATUS_ENUM,
} from './entities/payment.entity';
@Injectable()
export class PaymentService {
constructor(
@InjectRepository(Payment)
private readonly paymentRepository: Repository<Payment>,
@InjectRepository(User)
private readonly userRepository: Repository<User>,
) {}
async create({ impUid, amount, currentUser }) {
const pointTransaction = await this.paymentRepository.create({
impUid,
amount,
user: currentUser,
status: POINT_TRANSACTION_STATUS_ENUM.PAYMENT,
});
await this.paymentRepository.save(pointTransaction);
const user = await this.userRepository.findOne({ id: currentUser.id });
console.log(amount);
await this.userRepository.update(
{ id: user.id }, // where
{ point: user.point + amount },
);
return pointTransaction;
}
}
payment 과제 중 payment.service.ts 코드입니다.
결제는 문제없이 처리가 되었고, payment 테이블에 거래기록이 저장되어야 하는데 이러한 에러가 발생합니다.
[Nest] 288 - 03/29/2023, 7:34:01 AM ERROR [ExceptionsHandler] Cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated values.
여러 시도를 해봤지만 해결되지 않아 커뮤니티에 글 남깁니다!
답변 1
0
안녕하세요! songin cheon 님!
위의 에러는 보통 일반적으로 update 구문에 무엇을 업데이트 할 것인지 적어주지 않았을 때 발생합니다!
위의 코드에서 업데이트와 관련된 부분은 가장 아래쪽 부분인 것 같아요!
저장이 안 되어있거나, 해당 부분이 빠져있는 경우 발생 가능한 예제 상황을 첨부드립니다!
위의 스크린샷 만으론 전체 파일을 볼 수 없는 상황이기에, 파일 저장 상태를 확인해 보아야 할 것 같습니다!

윈도우에서 Node js를 설치하고 싶어요
0
34
0
그래프 ql 문서 사용할때 느낌표 남는거 어떻게 없애나요?
0
103
2
강의 전체 소스 코드를 받고싶습니다.
0
95
2
fontawesome 사용 문의
0
97
2
소스 코드 부탁드립니다~
0
100
2
깃 레포지터리 소스
0
97
2
커리큘럼12.css 정렬 에 나오는 과제 정답알고싶어요
0
85
2
10-01 Entity TypeOrmModule.forRoot 에 entities
0
103
3
강의 버전관련 문의입니다
0
114
2
Ubuntu 설치 관련
0
74
1
schema.gql 질문 드립니다.
0
64
1
서버 재실행시 Many to Many
0
121
3
input 관련 문의
0
98
2
Rest API 보다는 graphql이 주된 내용인데
0
145
2
강의 전체 소스코드 받을수있을까요?
0
170
1
도커볼륨 마운트 관련
0
141
2
findOne 타입스크립트오류
0
118
1
http => htrtps 호출 인증서 신뢰 오류
0
379
1
self-signed certificate in certificate chain 에러 발생
0
441
1
mongoose 설치 오류
0
151
1
특정 API, 특정 IP 허용 (단일경로에 CORS 활성화)
0
300
2
08-06
0
189
3
구조랑 패턴 관련해서 질문
0
134
2
mydocker
0
135
2





