File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,14 +31,9 @@ export class BudgetsController {
3131 } )
3232 @ApiResponse ( { status : 200 , description : '예산 정보 수정에 성공했습니다' } )
3333 @Put ( 'update' )
34- public async update (
35- @Body ( ) dto : BudgetsRequestDto ,
36- // @Req () req: Request,
37- @Res ( ) res : Response ,
38- ) : Promise < void > {
34+ public async update ( @Body ( ) dto : BudgetsRequestDto , @Res ( ) res : Response ) : Promise < void > {
3935 const update = await this . budgetsService . update ( dto ) ;
4036 res . status ( 200 ) . json ( { data : update , message : '예산 변경에 성공했습니다' } ) ;
4137 }
42-
4338 //TODO: /budgets/{budgetId} (DELETE) 예산 정보 삭제
4439}
Original file line number Diff line number Diff line change 1- import { Injectable } from '@nestjs/common' ;
1+ import { Injectable , BadRequestException } from '@nestjs/common' ;
22import { PrismaService } from '@src/shared/prisma/prisma.service' ;
33import { BudgetsRequestDto , BudgetsResponseDto } from './dto/budgets.dto' ;
44
@@ -46,6 +46,12 @@ export class BudgetsService {
4646 try {
4747 // 특정 예산 레코드 조회
4848 console . log ( 'dto' , dto ) ;
49+
50+ const MAX_AMOUNT = 500_000_000 ;
51+ if ( dto . currentAmount > MAX_AMOUNT || dto . initialAmount > MAX_AMOUNT ) {
52+ throw new BadRequestException ( '금액이 5억을 초과하였습니다.' ) ;
53+ }
54+
4955 const existingBudget = await this . prisma . budget . findUnique ( {
5056 where : {
5157 companyId_year_month : {
@@ -100,7 +106,7 @@ export class BudgetsService {
100106 } ;
101107 } catch ( err ) {
102108 console . error ( '예산 처리 중 에러 발생' , err ) ;
103- throw new Error ( '예산 처리 중 오류 발생' ) ;
109+ throw err ; // 덮어씌우지 않고 원래 에러 그대로 전달
104110 }
105111 }
106112}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export class UsersController {
4848 @Patch ( 'update/info' )
4949 @ApiResponse ( { status : 200 , description : '유저 정보 수정' } )
5050 public async updateData (
51- @Body ( ) body : { password : string ; company ?: string } ,
51+ @Body ( ) body : { password ? : string ; company ?: string } ,
5252 @Req ( ) req : Request ,
5353 @Res ( ) res : Response ,
5454 ) : Promise < void > {
Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ export class UsersService {
190190 }
191191
192192 if ( body . password ) {
193+ this . validatePassword ( body . password ) ;
194+
193195 const hashedPassword = await argon2 . hash ( body . password ) ;
194196
195197 const currentData = await this . prisma . user . findUnique ( {
You can’t perform that action at this time.
0 commit comments