Skip to content

Commit

Permalink
fix : admin 세션 조회 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
OH-GITAEK committed Aug 19, 2024
1 parent 933f136 commit ca658ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions api/controllers/sessionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ exports.getAllSessions = async (req, res) => {
};

// 하나의 세션 조회 + 해당 세션의 모든 출석도 조회
exports.getSessionById = async (req, res, next) => {
exports.getSessionById = async (req, res) => {
try {
const { id } = req.params;

Expand All @@ -94,9 +94,7 @@ exports.getSessionById = async (req, res, next) => {
}

const attends = await Attend.find({ session: session._id });
req.sessionData = { session, attends, dbState : 1 }; // req 객체에 sessionData 속성 추가
next();
// res.status(200).send({ session, attends });
res.status(200).send({ session, attends });
} catch (error) {
res.status(500).send({ message: "세션을 가져오는 중 오류가 발생했습니다", error });
}
Expand Down
2 changes: 1 addition & 1 deletion api/routers/sessionRouters.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ router.get('/sessions', authenticateToken, sessionController.getAllSessions);
*/

// 특정 세션 조회 (모든 유저의 출석 포함, 어드민 인증 필요)
router.get('/sessions/:id', authenticateToken, adminMiddleware, sessionController.getSessionById,sessionDepositMiddleware);
router.get('/sessions/:id', authenticateToken, adminMiddleware, sessionController.getSessionById);
/**
* @swagger
* /api/session/sessions/{id}:
Expand Down

0 comments on commit ca658ba

Please sign in to comment.