Skip to content

Commit d619369

Browse files
fix: refine existing types (#44)
--------- Co-authored-by: James Cook <[email protected]>
1 parent bb6707d commit d619369

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

src/types.ts

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,27 @@ export interface GetActivityOptions {
112112

113113
export interface ActivityPoint {
114114
id: number;
115-
type: string;
116-
polarity: "positive" | "blank" | "negative" | (string & {});
115+
type:
116+
| "detention"
117+
| "notice"
118+
| "attendance_event"
119+
| "question"
120+
| "event"
121+
| "behaviour";
122+
polarity: "positive" | "blank" | "negative" | null;
117123
reason: string;
118124
score: number;
119125
timestamp: string;
120126
timestamp_custom_time: string | null;
121127
style: {
122128
border_color: string | null;
123-
custom_class: string | null;
129+
custom_class:
130+
| "notice-color"
131+
| "colour-orange"
132+
| "colour-blue"
133+
| "colour-purple"
134+
| "colour-green"
135+
| null;
124136
};
125137
pupil_name: string;
126138
lesson_name: string | null;
@@ -184,7 +196,7 @@ export interface StudentHomeworkAttachment {
184196
file: string;
185197
validated_file: string;
186198
teacher_note: string;
187-
teacher_homework_attachments: unknown[];
199+
teacher_homework_attachments: TeacherValidatedHomeworkAttachment[];
188200
can_delete: boolean;
189201
}
190202
export interface Homework {
@@ -204,7 +216,7 @@ export interface Homework {
204216
status: {
205217
id: number;
206218
state: "not_completed" | "late" | "completed" | null;
207-
mark: unknown | null;
219+
mark: string | null;
208220
mark_relative: number;
209221
ticked: "yes" | "no";
210222
allow_attachments: boolean;
@@ -247,6 +259,7 @@ export interface Lesson {
247259
lesson_name: string;
248260
subject_name: string;
249261
is_alternative_lesson: boolean;
262+
is_break?: boolean;
250263
period_name: string;
251264
period_number: string;
252265
room_name: string;
@@ -350,7 +363,7 @@ export interface Detention {
350363
} | null;
351364
detention_type: {
352365
name: string;
353-
};
366+
} | null;
354367
}
355368

356369
export type DetentionsData = Detention[];
@@ -364,6 +377,22 @@ export type DetentionsResponse = ClassChartsResponse<
364377
DetentionsMeta
365378
>;
366379

380+
export interface AnnouncementConsent {
381+
consent_given: "yes" | "no";
382+
comment: string | null;
383+
parent_name: string;
384+
}
385+
386+
export interface AnnouncementPupilConsent {
387+
pupil: {
388+
id: string;
389+
first_name: string;
390+
last_name: string;
391+
};
392+
can_change_consent: boolean;
393+
consent: AnnouncementConsent | null;
394+
}
395+
367396
export interface Announcement {
368397
id: number;
369398
title: string;
@@ -378,16 +407,16 @@ export interface Announcement {
378407
filename: string;
379408
url: string;
380409
}[];
381-
for_pupils: unknown[];
410+
for_pupils: string[];
382411
comment_visibility: string;
383412
allow_comments: "yes" | "no";
384413
allow_reactions: "yes" | "no";
385414
allow_consent: "yes" | "no";
386415
priority_pinned: "yes" | "no";
387416
requires_consent: "yes" | "no";
388417
can_change_consent: boolean;
389-
consent: unknown | null;
390-
pupil_consents: unknown[];
418+
consent: AnnouncementConsent | null;
419+
pupil_consents: AnnouncementPupilConsent[];
391420
}
392421

393422
export type AnnouncementsResponse = ClassChartsResponse<Announcement[], []>;
@@ -437,7 +466,7 @@ export interface GetAttendanceOptions {
437466

438467
export interface AttendancePeriod {
439468
code: string;
440-
status: "present" | "ignore" | (string & {});
469+
status: "yes" | "present" | "ignore" | "no" | "absent" | "excused" | "late";
441470
late_minutes: number | string;
442471
lesson_name?: string;
443472
room_name?: string;
@@ -471,7 +500,7 @@ export type RewardsData = {
471500
unable_to_purchase_reason: string;
472501
once_per_pupil: boolean;
473502
purchased: boolean;
474-
purchased_count: string | number;
503+
purchased_count: string | 0;
475504
price_balance_difference: number;
476505
}[];
477506

0 commit comments

Comments
 (0)