From a8e16c47f79464f9b3780f8bd04e30b52e31d11d Mon Sep 17 00:00:00 2001 From: suk-6 Date: Tue, 24 Sep 2024 16:57:42 +0900 Subject: [PATCH] fix: check credit balance --- src/modules/product/product.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/product/product.service.ts b/src/modules/product/product.service.ts index e29a054..1a4b3d3 100644 --- a/src/modules/product/product.service.ts +++ b/src/modules/product/product.service.ts @@ -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) => {