feat: improve attendance scheduling and API validation
This commit is contained in:
@@ -20,6 +20,14 @@ const createService = () => {
|
||||
update: jest.fn().mockResolvedValue({ affected: 1 }),
|
||||
};
|
||||
const attendanceService = {
|
||||
getLessonAttendanceImportDateRange: jest.fn().mockImplementation((targetSchedule, lessonDate: string) => {
|
||||
if (targetSchedule.endTime > targetSchedule.startTime) {
|
||||
return { startDate: lessonDate, endDate: lessonDate };
|
||||
}
|
||||
const next = new Date(`${lessonDate}T00:00:00.000Z`);
|
||||
next.setUTCDate(next.getUTCDate() + 1);
|
||||
return { startDate: lessonDate, endDate: next.toISOString().slice(0, 10) };
|
||||
}),
|
||||
getTeacherClassDingUserIds: jest.fn().mockResolvedValue(['ding-1']),
|
||||
createLessonAttendanceFromDingTalk: jest.fn().mockImplementation(
|
||||
async (_scheduleId: number, lessonDate: string, userId: number, finalize: boolean) => ({
|
||||
|
||||
Reference in New Issue
Block a user