From 04f616187dcb35c9924927d510cb6fc6911839db Mon Sep 17 00:00:00 2001 From: yena <50291995+nyj001012@users.noreply.github.com> Date: Fri, 12 Jul 2024 15:52:16 +0900 Subject: [PATCH] =?UTF-8?q?feat(lending):=20=EC=82=AC=EC=84=9C=EC=9D=98=20?= =?UTF-8?q?=EB=8C=80=EC=B6=9C=20=EC=A0=9C=ED=95=9C=20=EA=B6=8C=EC=88=98=20?= =?UTF-8?q?4=EA=B6=8C=EC=9C=BC=EB=A1=9C=20=EC=A1=B0=EC=A0=95=20(#826)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(lending): 사서의 대출 제한 권수 4권으로 조정 * style(lending): prettier 재적용 --- backend/src/v1/lendings/lendings.service.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/src/v1/lendings/lendings.service.ts b/backend/src/v1/lendings/lendings.service.ts index ba87c44a..4ba75ef6 100644 --- a/backend/src/v1/lendings/lendings.service.ts +++ b/backend/src/v1/lendings/lendings.service.ts @@ -36,7 +36,11 @@ export const create = async ( 0, 0, ); - if (numberOfLendings >= 2) { + // 사서는 4권, 일반 사용자는 2권까지 대출 가능 + if ( + (users[0].role === 2 && numberOfLendings >= 4) || + (users[0].role !== 2 && numberOfLendings >= 2) + ) { throw new Error(errorCode.LENDING_OVERLOAD); } const penaltyEndDate = await lendingRepo.getUsersPenalty(userId);