Skip to content

Commit

Permalink
fix: check credit balance
Browse files Browse the repository at this point in the history
  • Loading branch information
suk-6 committed Sep 24, 2024
1 parent b99b5f9 commit a8e16c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/product/product.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export class ProductService {
if (product.type !== ProductType.SELLING)
throw new BadRequestException('마켓 상품이 아닙니다.');

if (product.currentAmount * dto.amount > (user.userAccount.credit ?? 0))
if (product.currentAmount * dto.amount > user.userAccount.credit)
throw new BadRequestException('잔액이 부족합니다.');

return this.prisma.$transaction(async (tx) => {
Expand Down

0 comments on commit a8e16c4

Please sign in to comment.