1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 19:59:37 +00:00

fix: improve type definitions (#43)

This commit is contained in:
Aria 2024-05-28 13:33:56 +01:00 committed by GitHub
parent 04b133da01
commit 731672f23a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,7 +113,7 @@ export interface GetActivityOptions {
export interface ActivityPoint { export interface ActivityPoint {
id: number; id: number;
type: string; type: string;
polarity: string; polarity: "positive" | "blank" | "negative" | string & {};
reason: string; reason: string;
score: number; score: number;
timestamp: string; timestamp: string;
@ -124,11 +124,11 @@ export interface ActivityPoint {
}; };
pupil_name: string; pupil_name: string;
lesson_name: string | null; lesson_name: string | null;
teacher_name: string; teacher_name: string | null;
room_name: string | null; room_name: string | null;
note: string | null; note: string | null;
_can_delete: boolean; _can_delete: boolean;
badges: string | undefined; badges: string;
detention_date: string | null; detention_date: string | null;
detention_time: string | null; detention_time: string | null;
detention_location: string | null; detention_location: string | null;
@ -165,12 +165,34 @@ export interface GetHomeworkOptions {
*/ */
to?: string; to?: string;
} }
/**
* Teacher uploaded attachments
*/
export interface ValidatedHomeworkAttachment { export interface ValidatedHomeworkAttachment {
id: number; id: number;
file_name: string; file_name: string;
file: string; file: string;
validated_file: string; validated_file: string;
} }
/**
* Teacher uploaded links
*/
export interface ValidatedLink {
link: string;
validated_link: string;
}
/**
* User uploaded attachments
*/
export interface StudentHomeworkAttachment {
id: number;
file_name: string;
file: string;
validated_file: string;
teacher_note: string;
teacher_homework_attachments: unknown[];
can_delete: boolean;
}
export interface Homework { export interface Homework {
lesson: string; lesson: string;
subject: string; subject: string;
@ -192,12 +214,13 @@ export interface Homework {
mark_relative: number; mark_relative: number;
ticked: "yes" | "no"; ticked: "yes" | "no";
allow_attachments: boolean; allow_attachments: boolean;
allow_marking_completed: boolean;
first_seen_date: string | null; first_seen_date: string | null;
last_seen_date: string | null; last_seen_date: string | null;
attachments: unknown[]; attachments: HomeworkAttachment[];
has_feedback: boolean; has_feedback: boolean;
}; };
validated_links: unknown[]; validated_links: ValidatedLink[];
validated_attachments: ValidatedHomeworkAttachment[]; validated_attachments: ValidatedHomeworkAttachment[];
} }
export type HomeworksResponseData = Homework[]; export type HomeworksResponseData = Homework[];
@ -226,6 +249,7 @@ export interface GetLessonsOptions {
} }
export interface Lesson { export interface Lesson {
teacher_name: string; teacher_name: string;
teacher_id: string;
lesson_name: string; lesson_name: string;
subject_name: string; subject_name: string;
is_alternative_lesson: boolean; is_alternative_lesson: boolean;
@ -260,7 +284,6 @@ export type LessonsResponse = ClassChartsResponse<
LessonsResponseMeta LessonsResponseMeta
>; >;
// Not sure what to call this
export interface LessonPupilBehaviour { export interface LessonPupilBehaviour {
reason: string; reason: string;
score: number; score: number;
@ -286,7 +309,7 @@ export interface Badge {
icon: string; icon: string;
colour: string; colour: string;
created_date: string; created_date: string;
pupil_badges: PupilEvent[]; pupil_badges: { pupil_event: PupilEvent }[];
icon_url: string; icon_url: string;
} }
export type BadgesResponseData = Badge[]; export type BadgesResponseData = Badge[];
@ -320,7 +343,7 @@ export interface Detention {
subject: { subject: {
id: number; id: number;
name: string; name: string;
}; } | null;
} | null; } | null;
lesson_pupil_behaviour: { lesson_pupil_behaviour: {
reason: string; reason: string;
@ -423,7 +446,7 @@ export interface GetAttendanceOptions {
export interface AttendancePeriod { export interface AttendancePeriod {
code: string; code: string;
status: "present" | "ignore"; status: "present" | "ignore" | string & {};
late_minutes: number | string; late_minutes: number | string;
lesson_name?: string; lesson_name?: string;
room_name?: string; room_name?: string;