mirror of
https://github.com/classchartsapi/classcharts-api-js.git
synced 2026-05-14 11:58:13 +00:00
fix: attendance typing && expose full attendance response object
This commit is contained in:
parent
a9afa0e9e5
commit
0adb90390f
2 changed files with 23 additions and 14 deletions
|
|
@ -300,6 +300,6 @@ export class BaseClient {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
).data;
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
src/types.ts
29
src/types.ts
|
|
@ -412,17 +412,26 @@ export interface GetAttendanceOptions {
|
||||||
to: string;
|
to: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AttendanceDate {
|
export interface AttendancePeriod {
|
||||||
AM: {
|
|
||||||
code: string;
|
code: string;
|
||||||
status: "present" | "ignore";
|
status: "present" | "ignore";
|
||||||
late_minutes: number;
|
late_minutes: number;
|
||||||
};
|
lesson_name?: string;
|
||||||
PM: {
|
room_name?: string;
|
||||||
code: string;
|
|
||||||
status: "present" | "ignore";
|
|
||||||
late_minutes: number;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
// TODO: Update typings to include meta response. Currently not possible since I don't have access
|
|
||||||
export type AttendanceResponse = Record<string, AttendanceDate>[];
|
export interface AttendanceMeta {
|
||||||
|
dates: string[];
|
||||||
|
sessions: string[];
|
||||||
|
start_date: string;
|
||||||
|
end_date: string;
|
||||||
|
percentage: string;
|
||||||
|
percentage_since_august: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type AttendanceData = Record<string, Record<string, AttendancePeriod>>;
|
||||||
|
|
||||||
|
export type AttendanceResponse = ClassChartsResponse<
|
||||||
|
AttendanceData,
|
||||||
|
AttendanceMeta
|
||||||
|
>;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue