Skip to content

Commit

Permalink
Merge pull request #33 from lemoncloud-capstone/BE_day
Browse files Browse the repository at this point in the history
chore: fix deleteProject err msg
  • Loading branch information
Yeeun411 authored May 19, 2024
2 parents 29297c1 + f50d2cc commit cf32469
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/server/src/controllers/project.temp.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
3 changes: 3 additions & 0 deletions apps/server/src/repositories/project.temp.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -73,6 +74,7 @@ export const BaseResponseMessages: Record<BaseResponseCode, string> = {
[BaseResponseCode.FAIL_TO_GET_PROJECTS]: '프로젝트 조회에 실패했습니다.',
[BaseResponseCode.FAIL_TO_GET_IMAGES]: '프로젝트 이미지 조회에 실패했습니다.',
[BaseResponseCode.FAIL_TO_UPDATE_STATUS]: '프로젝트 상태 업데이트에 실패했습니다.',
[BaseResponseCode.FAIL_TO_DELETE_PROJECT]: '프로젝트 삭제에 실패했습니다.',

/**
* 5XXX : ProjectImage
Expand Down

0 comments on commit cf32469

Please sign in to comment.