Last active
June 23, 2021 08:58
-
-
Save blacksheep557/49bd400b944c33c362e4e24fa2a30773 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const teacherAvailableSchedulesCtrl = { | |
| async create(schedule, params) { | |
| const teacherId = params.auth.teacherId | |
| const existingSchedule = (await teacherAvailabilitySchedulesDao.find({query: {teacherId}}))[0]; | |
| if (existingSchedule) { | |
| return teacherAvailabilitySchedulesDao.update(existingSchedule._id, { | |
| ...existingSchedule, | |
| schedule: schedule.schedule | |
| }, {}); | |
| } else { | |
| return await teacherAvailabilitySchedulesDao.create({teacherId, schedule: schedule.schedule}, {}); | |
| } | |
| }, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment