Skip to content

Commit

Permalink
[webclient] 강의 추가 버그 수정 - 레거시 필드 대응
Browse files Browse the repository at this point in the history
  • Loading branch information
ars-ki-00 committed Mar 8, 2025
1 parent 03ab149 commit 9e90e99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type SnuttApi, type SnuttApiSuccessResponseData } from '@sf/snutt-api';

import type { FullTimetable, Timetable } from '@/entities/timetable';
import { type getTimetableService } from '@/usecases/timetableService';
import { convertToMinute } from '@/utils/time';

export const implTimetableSnuttApiRepository = ({
snuttApi,
Expand Down Expand Up @@ -40,7 +41,15 @@ export const implTimetableSnuttApiRepository = ({
},
createLecture: async ({ id, token }, body) => {
const { status, data } = await snuttApi['POST /v1/tables/:timetableId/lecture']({
body: { ...body, is_forced: false },
body: {
...body,
is_forced: false,
class_time_json: body.class_time_json.map((it) => ({
...it,
startMinute: convertToMinute(it.start_time),
endMinute: convertToMinute(it.end_time),
})),
},
token,
params: { timetableId: id },
});
Expand Down
6 changes: 6 additions & 0 deletions apps/snutt-webclient/src/utils/time.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const convertToMinute = (time: string): number => {
const hour = Number(time.split(':')[0]) || 0;
const minute = Number(time.split(':')[1]) || 0;

return hour * 60 + minute;
};

0 comments on commit 9e90e99

Please sign in to comment.