Skip to content

Commit 731672f

Browse files
authored
fix: improve type definitions (#43)
1 parent 04b133d commit 731672f

1 file changed

Lines changed: 32 additions & 9 deletions

File tree

src/types.ts

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export interface GetActivityOptions {
113113
export interface ActivityPoint {
114114
id: number;
115115
type: string;
116-
polarity: string;
116+
polarity: "positive" | "blank" | "negative" | string & {};
117117
reason: string;
118118
score: number;
119119
timestamp: string;
@@ -124,11 +124,11 @@ export interface ActivityPoint {
124124
};
125125
pupil_name: string;
126126
lesson_name: string | null;
127-
teacher_name: string;
127+
teacher_name: string | null;
128128
room_name: string | null;
129129
note: string | null;
130130
_can_delete: boolean;
131-
badges: string | undefined;
131+
badges: string;
132132
detention_date: string | null;
133133
detention_time: string | null;
134134
detention_location: string | null;
@@ -165,12 +165,34 @@ export interface GetHomeworkOptions {
165165
*/
166166
to?: string;
167167
}
168+
/**
169+
* Teacher uploaded attachments
170+
*/
168171
export interface ValidatedHomeworkAttachment {
169172
id: number;
170173
file_name: string;
171174
file: string;
172175
validated_file: string;
173176
}
177+
/**
178+
* Teacher uploaded links
179+
*/
180+
export interface ValidatedLink {
181+
link: string;
182+
validated_link: string;
183+
}
184+
/**
185+
* User uploaded attachments
186+
*/
187+
export interface StudentHomeworkAttachment {
188+
id: number;
189+
file_name: string;
190+
file: string;
191+
validated_file: string;
192+
teacher_note: string;
193+
teacher_homework_attachments: unknown[];
194+
can_delete: boolean;
195+
}
174196
export interface Homework {
175197
lesson: string;
176198
subject: string;
@@ -192,12 +214,13 @@ export interface Homework {
192214
mark_relative: number;
193215
ticked: "yes" | "no";
194216
allow_attachments: boolean;
217+
allow_marking_completed: boolean;
195218
first_seen_date: string | null;
196219
last_seen_date: string | null;
197-
attachments: unknown[];
220+
attachments: HomeworkAttachment[];
198221
has_feedback: boolean;
199222
};
200-
validated_links: unknown[];
223+
validated_links: ValidatedLink[];
201224
validated_attachments: ValidatedHomeworkAttachment[];
202225
}
203226
export type HomeworksResponseData = Homework[];
@@ -226,6 +249,7 @@ export interface GetLessonsOptions {
226249
}
227250
export interface Lesson {
228251
teacher_name: string;
252+
teacher_id: string;
229253
lesson_name: string;
230254
subject_name: string;
231255
is_alternative_lesson: boolean;
@@ -260,7 +284,6 @@ export type LessonsResponse = ClassChartsResponse<
260284
LessonsResponseMeta
261285
>;
262286

263-
// Not sure what to call this
264287
export interface LessonPupilBehaviour {
265288
reason: string;
266289
score: number;
@@ -286,7 +309,7 @@ export interface Badge {
286309
icon: string;
287310
colour: string;
288311
created_date: string;
289-
pupil_badges: PupilEvent[];
312+
pupil_badges: { pupil_event: PupilEvent }[];
290313
icon_url: string;
291314
}
292315
export type BadgesResponseData = Badge[];
@@ -320,7 +343,7 @@ export interface Detention {
320343
subject: {
321344
id: number;
322345
name: string;
323-
};
346+
} | null;
324347
} | null;
325348
lesson_pupil_behaviour: {
326349
reason: string;
@@ -423,7 +446,7 @@ export interface GetAttendanceOptions {
423446

424447
export interface AttendancePeriod {
425448
code: string;
426-
status: "present" | "ignore";
449+
status: "present" | "ignore" | string & {};
427450
late_minutes: number | string;
428451
lesson_name?: string;
429452
room_name?: string;

0 commit comments

Comments
 (0)