1
0
Fork 0
mirror of https://github.com/classchartsapi/classcharts-api-js.git synced 2026-05-14 11:58:13 +00:00

fix: refine existing types (#44)

---------

Co-authored-by: James Cook <james@jaminit.co.uk>
This commit is contained in:
Aria 2024-05-30 13:18:12 +01:00 committed by GitHub
parent bb6707d0ad
commit d619369869
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,15 +112,27 @@ export interface GetActivityOptions {
export interface ActivityPoint { export interface ActivityPoint {
id: number; id: number;
type: string; type:
polarity: "positive" | "blank" | "negative" | (string & {}); | "detention"
| "notice"
| "attendance_event"
| "question"
| "event"
| "behaviour";
polarity: "positive" | "blank" | "negative" | null;
reason: string; reason: string;
score: number; score: number;
timestamp: string; timestamp: string;
timestamp_custom_time: string | null; timestamp_custom_time: string | null;
style: { style: {
border_color: string | null; border_color: string | null;
custom_class: string | null; custom_class:
| "notice-color"
| "colour-orange"
| "colour-blue"
| "colour-purple"
| "colour-green"
| null;
}; };
pupil_name: string; pupil_name: string;
lesson_name: string | null; lesson_name: string | null;
@ -184,7 +196,7 @@ export interface StudentHomeworkAttachment {
file: string; file: string;
validated_file: string; validated_file: string;
teacher_note: string; teacher_note: string;
teacher_homework_attachments: unknown[]; teacher_homework_attachments: TeacherValidatedHomeworkAttachment[];
can_delete: boolean; can_delete: boolean;
} }
export interface Homework { export interface Homework {
@ -204,7 +216,7 @@ export interface Homework {
status: { status: {
id: number; id: number;
state: "not_completed" | "late" | "completed" | null; state: "not_completed" | "late" | "completed" | null;
mark: unknown | null; mark: string | null;
mark_relative: number; mark_relative: number;
ticked: "yes" | "no"; ticked: "yes" | "no";
allow_attachments: boolean; allow_attachments: boolean;
@ -247,6 +259,7 @@ export interface Lesson {
lesson_name: string; lesson_name: string;
subject_name: string; subject_name: string;
is_alternative_lesson: boolean; is_alternative_lesson: boolean;
is_break?: boolean;
period_name: string; period_name: string;
period_number: string; period_number: string;
room_name: string; room_name: string;
@ -350,7 +363,7 @@ export interface Detention {
} | null; } | null;
detention_type: { detention_type: {
name: string; name: string;
}; } | null;
} }
export type DetentionsData = Detention[]; export type DetentionsData = Detention[];
@ -364,6 +377,22 @@ export type DetentionsResponse = ClassChartsResponse<
DetentionsMeta DetentionsMeta
>; >;
export interface AnnouncementConsent {
consent_given: "yes" | "no";
comment: string | null;
parent_name: string;
}
export interface AnnouncementPupilConsent {
pupil: {
id: string;
first_name: string;
last_name: string;
};
can_change_consent: boolean;
consent: AnnouncementConsent | null;
}
export interface Announcement { export interface Announcement {
id: number; id: number;
title: string; title: string;
@ -378,7 +407,7 @@ export interface Announcement {
filename: string; filename: string;
url: string; url: string;
}[]; }[];
for_pupils: unknown[]; for_pupils: string[];
comment_visibility: string; comment_visibility: string;
allow_comments: "yes" | "no"; allow_comments: "yes" | "no";
allow_reactions: "yes" | "no"; allow_reactions: "yes" | "no";
@ -386,8 +415,8 @@ export interface Announcement {
priority_pinned: "yes" | "no"; priority_pinned: "yes" | "no";
requires_consent: "yes" | "no"; requires_consent: "yes" | "no";
can_change_consent: boolean; can_change_consent: boolean;
consent: unknown | null; consent: AnnouncementConsent | null;
pupil_consents: unknown[]; pupil_consents: AnnouncementPupilConsent[];
} }
export type AnnouncementsResponse = ClassChartsResponse<Announcement[], []>; export type AnnouncementsResponse = ClassChartsResponse<Announcement[], []>;
@ -437,7 +466,7 @@ export interface GetAttendanceOptions {
export interface AttendancePeriod { export interface AttendancePeriod {
code: string; code: string;
status: "present" | "ignore" | (string & {}); status: "yes" | "present" | "ignore" | "no" | "absent" | "excused" | "late";
late_minutes: number | string; late_minutes: number | string;
lesson_name?: string; lesson_name?: string;
room_name?: string; room_name?: string;
@ -471,7 +500,7 @@ export type RewardsData = {
unable_to_purchase_reason: string; unable_to_purchase_reason: string;
once_per_pupil: boolean; once_per_pupil: boolean;
purchased: boolean; purchased: boolean;
purchased_count: string | number; purchased_count: string | 0;
price_balance_difference: number; price_balance_difference: number;
}[]; }[];