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

feat: 사용자 특정 스케줄 조회 (#5)

parent 49550d19
No related branches found
No related tags found
2 merge requests!31Develop,!6[#5] Schedule 서비스 로직 개발
...@@ -103,6 +103,37 @@ class schedulService { ...@@ -103,6 +103,37 @@ class schedulService {
throw new Error(`Failed to fetch schedules: ${error.message}`); throw new Error(`Failed to fetch schedules: ${error.message}`);
} }
} }
/**
* 해당 사용자의 특정 스케줄 조회
*/
async getScheduleById(id, userId) {
try {
const schedule = await Schedule.findOne({
where: {
id,
user_id: userId,
[Op.or]: [
{ is_fixed: true },
{
is_fixed: false,
expiry_date: {
[Op.gt]: new Date()
}
}
]
}
});
if (!schedule) {
throw new Error('Schedule not found');
}
return schedule;
} catch (error) {
throw new Error(`Failed to fetch schedule: ${error.message}`);
}
}
} }
\ 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