Skip to content

Commit

Permalink
[FEAT] 배너 controller 구현 #49
Browse files Browse the repository at this point in the history
  • Loading branch information
hujumee committed Jul 21, 2022
1 parent a3eaf45 commit cd4f63c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/controllers/MumentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,26 @@ const getTodayMument = async (req: Request, res: Response) => {
}
};

/**
* @ROUTE GET mument/banner
* @DESC get banner music and tag title list
*/
const getBanner = async (req: Request, res: Response) => {
try {
const data = await MumentService.getBanner();

// 조회는 성공했으나, 결과값이 없는 경우
if (!data) {
res.status(statusCode.NO_CONTENT).send();
}

res.status(statusCode.OK).send(util.success(statusCode.OK, message.GET_BANNER_SUCCESS, data));
} catch (error) {
console.log(error);
res.status(statusCode.INTERNAL_SERVER_ERROR).send(util.fail(statusCode.INTERNAL_SERVER_ERROR, message.INTERNAL_SERVER_ERROR));
}
};

export default {
createMument,
updateMument,
Expand All @@ -272,4 +292,5 @@ export default {
deleteLike,
getRandomMument,
getTodayMument,
getBanner,
};
1 change: 1 addition & 0 deletions src/modules/responseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const message = {
GET_RANDOM_MUMENT_SUCCESS: '랜덤 뮤멘트 리스트 조회 성공',
RANDOM_TAG_FAIL: '랜덤 태그 생성 실패',
GET_TODAY_MUMENT_SUCCESS: '오늘의 뮤멘트 리스트 조회 성공',
GET_BANNER_SUCCESS: '배너 조회 성공',

// music
NO_MUSIC_ID: '해당 아이디의 음악이 존재하지 않습니다',
Expand Down

0 comments on commit cd4f63c

Please sign in to comment.