Skip to content

Commit

Permalink
base response 에 담아서 전달하도록 controller 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyejungg committed Oct 9, 2024
1 parent ab2e402 commit 0077603
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/controllers/versionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ module.exports = {
throw new BadRequest(ErrorMessage.BadRequestMeg);
}
await Version.checkVersion(req).then((result) => {
return res.status(StatusCode.OK).json(result);
return res.status(StatusCode.OK).json({
success: true,
message: SuccessMessage.versionSuccess,
data: result,
});
});
} catch (err) {
next(err);
Expand All @@ -29,7 +33,11 @@ module.exports = {
throw new BadRequest(ErrorMessage.BadRequestMeg);
}
await Version.updateVersion(req).then((result) => {
return res.status(StatusCode.OK).json(result);
return res.status(StatusCode.OK).json({
success: true,
message: SuccessMessage.versionUpdate,
data: result,
});
});
} catch (err) {
next(err);
Expand All @@ -38,7 +46,11 @@ module.exports = {
getVersions: async function (req, res, next) {
try {
await Version.getVersions(req).then((result) => {
return res.status(StatusCode.OK).json(result);
return res.status(StatusCode.OK).json({
success: true,
message: SuccessMessage.versionSuccess,
data: result,
});
});
} catch (err) {
next(err);
Expand Down
4 changes: 4 additions & 0 deletions src/utils/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const SuccessMessage = {

userDeleteSchedulerStart: '탈퇴 유저 삭제 스케줄러 시작',
userDeleteSchedulerExit: '탈퇴 유저 삭제 스케줄러 종료',

/* 버전 */
versionSuccess: '버전 정보 조회 성공',
versionUpdate: '버전 정보 수정 성공',
};

const ErrorMessage = {
Expand Down

0 comments on commit 0077603

Please sign in to comment.