diff --git a/WEB(BE)/src/controllers/home.ctrl.js b/WEB(BE)/src/controllers/home.ctrl.js index eeff663..1d5100e 100644 --- a/WEB(BE)/src/controllers/home.ctrl.js +++ b/WEB(BE)/src/controllers/home.ctrl.js @@ -33,6 +33,9 @@ const output = { for(var rank = MINRANK; rank <= MAXRANK; ++rank){ const routine = await data.routine.get('id', JoinedRoutine[rank-1][0]); + routine[0].participants = JoinedRoutine[rank-1][1]; + const userInfo = await data.user.get('no', routine[0].host); + routine[0].hostName = userInfo[0].nickname; rankedRoutine.push(routine[0]); } diff --git a/WEB(BE)/src/controllers/popular.ctrl.js b/WEB(BE)/src/controllers/popular.ctrl.js index 6c7d1c9..04b3525 100644 --- a/WEB(BE)/src/controllers/popular.ctrl.js +++ b/WEB(BE)/src/controllers/popular.ctrl.js @@ -75,6 +75,9 @@ const output = { try{ for(var rank = from; rank <= to; ++rank){ const routine = await data.routine.get('id', JoinedRoutine[rank-1][0]); + routine[0].participants = JoinedRoutine[rank-1][1]; + const userInfo = await data.user.get('no', routine[0].host); + routine[0].hostName = userInfo[0].nickname; rankedRoutine.push(routine[0]); } } diff --git a/WEB(BE)/src/controllers/user.ctrl.js b/WEB(BE)/src/controllers/user.ctrl.js index 5deadf7..b08a9d9 100644 --- a/WEB(BE)/src/controllers/user.ctrl.js +++ b/WEB(BE)/src/controllers/user.ctrl.js @@ -93,7 +93,9 @@ const output = { for(const routine of routines){ if(routine.type == 'join'){ const myRoutine = await data.routine.get('id', routine.routine_id); - JoinedRoutine.push(myRoutine); + const userInfo = await data.user.get('no', myRoutine[0].host); + myRoutine[0].hostName = userInfo[0].nickname; + JoinedRoutine.push(myRoutine[0]); } } @@ -107,11 +109,13 @@ const output = { const decoded = token.decode(req, res) const myRoutine = await data.user_routine.get('user_no',decoded.no); - const likeRoutineId = []; + var likeRoutineId = []; for(const routine of myRoutine){ if(routine.type == 'like'){ - likeRoutineId.push(routine.routine_id); + const userInfo = await data.user.get('no', routine[0].user_no); + routine[0].hostName = userInfo[0].nickname; + likeRoutineId.push(routine[0]); } } @@ -123,6 +127,8 @@ const output = { auth : async (req, res) => { const routine = await data.routine.get('id', req.params.routineId); + const userInfo = await data.user.get('no', routine[0].host); + routine[0].hostName = userInfo[0].nickname; res.json({ success : true,