Skip to content

Commit

Permalink
Merge pull request osamhack2022#32 from minchan02/main
Browse files Browse the repository at this point in the history
이름추가, /popular send정보 추가
  • Loading branch information
yoopark authored Oct 23, 2022
2 parents 8c51f46 + 8f9f3da commit e109867
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions WEB(BE)/src/controllers/home.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down
3 changes: 3 additions & 0 deletions WEB(BE)/src/controllers/popular.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
Expand Down
12 changes: 9 additions & 3 deletions WEB(BE)/src/controllers/user.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

Expand All @@ -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]);
}
}

Expand All @@ -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,
Expand Down

0 comments on commit e109867

Please sign in to comment.