diff --git a/apps/server/src/controllers/project.temp.controller.ts b/apps/server/src/controllers/project.temp.controller.ts index 87ec632..501af11 100644 --- a/apps/server/src/controllers/project.temp.controller.ts +++ b/apps/server/src/controllers/project.temp.controller.ts @@ -22,13 +22,13 @@ export class ProjectTempController { } const title = bodyValidationResult.data.title; + console.log(title); try { await ProjectTempService.deleteProject(title); sendResponse(res, BaseResponseCode.SUCCESS, BaseResponseMessages[BaseResponseCode.SUCCESS]); } catch (error) { - console.error(error); - sendResponse(res, BaseResponseCode.BAD_REQUEST); + sendResponse(res, BaseResponseCode.FAIL_TO_DELETE_PROJECT, error.message); } } } diff --git a/apps/server/src/repositories/project.temp.repository.ts b/apps/server/src/repositories/project.temp.repository.ts index 81220e3..ee828b5 100644 --- a/apps/server/src/repositories/project.temp.repository.ts +++ b/apps/server/src/repositories/project.temp.repository.ts @@ -23,6 +23,9 @@ export class ProjectTempRepository { const response = await ddbDocumentClient.send(command); const project = response.Item; + if (!project) { + throw new Error('제목이 ' + title + '인 프로젝트가 존재하지 않습니다.'); + } // 유저 projectsInvolved에서 에서 프로젝트 삭제 for (const worker of project.workers) { diff --git a/apps/server/src/utils/errors.ts b/apps/server/src/utils/errors.ts index cca15cb..4594f68 100644 --- a/apps/server/src/utils/errors.ts +++ b/apps/server/src/utils/errors.ts @@ -33,6 +33,7 @@ export enum BaseResponseCode { FAIL_TO_GET_PROJECTS = 4001, FAIL_TO_GET_IMAGES = 4002, FAIL_TO_UPDATE_STATUS = 4003, + FAIL_TO_DELETE_PROJECT = 4004, /** * 5XXX : ProjectImage @@ -73,6 +74,7 @@ export const BaseResponseMessages: Record = { [BaseResponseCode.FAIL_TO_GET_PROJECTS]: '프로젝트 조회에 실패했습니다.', [BaseResponseCode.FAIL_TO_GET_IMAGES]: '프로젝트 이미지 조회에 실패했습니다.', [BaseResponseCode.FAIL_TO_UPDATE_STATUS]: '프로젝트 상태 업데이트에 실패했습니다.', + [BaseResponseCode.FAIL_TO_DELETE_PROJECT]: '프로젝트 삭제에 실패했습니다.', /** * 5XXX : ProjectImage