Skip to content
Snippets Groups Projects
Commit ec2bcdeb authored by 조대희's avatar 조대희
Browse files

feat: 특정 스케줄 조회 컨트롤러 (#6)

parent 23b71558
No related branches found
No related tags found
2 merge requests!31Develop,!7[#6] Schedule 컨트롤러, 라우터, 로직 개발
...@@ -55,7 +55,7 @@ class scheduleController { ...@@ -55,7 +55,7 @@ class scheduleController {
end_time end_time
}); });
return res.statu(200).json({ return res.status(200).json({
success: true, success: true,
data: schedule data: schedule
}); });
...@@ -130,4 +130,41 @@ class scheduleController { ...@@ -130,4 +130,41 @@ class scheduleController {
}); });
} }
} }
}
\ No newline at end of file /**
* 해당 사용자 특정 스케줄 조회
* GET /api/schedule/:id
*/
async getScheduleById(req, res) {
try {
const { id } = req.params;
const userId = req.user.id;
const schedule = await ScheduleService.getScheduleById(id, userId);
return res.status(200).json({
success: true,
data: schedule
});
} catch (error) {
if (error.message === 'Schedule not found') {
return res.status(404).json({
success: false,
error: {
message: error.message,
code: 'SCHEDULE_NOT_FOUND'
}
});
}
return res.status(500).json({
success: false,
error: {
message: 'Failed to fetch schedule',
code: 'FETCH_ERROR'
}
});
}
}
}
module.exports = new ScheduleController();
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment