Skip to content

Commit 787aac7

Browse files
committed
Fix TypeError for restriction
1 parent a1fa28b commit 787aac7

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

course-matrix/frontend/src/pages/TimetableBuilder/TimetableBuilder.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { useGetRestrictionsQuery } from "@/api/restrictionsApiSlice";
3939
import { useDebounceValue } from "@/utils/useDebounce";
4040
import SearchFilters from "./SearchFilters";
4141
import Calendar from "./Calendar";
42-
import { Event, TimetableEvents, Timetable } from "@/utils/type-utils";
42+
import { Event, TimetableEvents, Timetable, Restriction } from "@/utils/type-utils";
4343
import { useSearchParams } from "react-router-dom";
4444
import OfferingInfo from "./OfferingInfo";
4545
import { Checkbox } from "@/components/ui/checkbox";
@@ -193,7 +193,7 @@ const TimetableBuilder = () => {
193193

194194
// Set the form value for 'restrictions'
195195
if (!loadedRestrictions && restrictionsData) {
196-
const parsedRestrictions = restrictionsData.map((restriction) => ({
196+
const parsedRestrictions = restrictionsData.map((restriction: Restriction) => ({
197197
...restriction,
198198
days: JSON.parse(restriction.days),
199199
}));

course-matrix/frontend/src/utils/type-utils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,17 @@ export type Timetable = {
2525
timetable_title: string;
2626
user_id: string;
2727
};
28+
29+
export type Restriction = {
30+
id: number;
31+
user_id: string;
32+
created_at: Date;
33+
updated_at: Date;
34+
type: string;
35+
days: string;
36+
start_time: string;
37+
end_time: string;
38+
disabled: boolean;
39+
num_days: number;
40+
calendar_id: number;
41+
};

0 commit comments

Comments
 (0)