forge
Explore
Log in

Don't you dare go Hollow

🔌 align three api shapes with the refactored backend

Browse files at this commit

aba07ef0257d574fafc8892161df1145c002acf2Ahmet Kaan GümüşParent: 790b1c0
  • fix
    • 🔌 align three api shapes with the refactored backend
Show full message
fix: 🔌 align three api shapes with the refactored backend
- postParentStudent sent a pre-stringified body that client() encoded
  again, so the backend got a quoted string and 400'd every link; pass
  the plain object
- postRegister declared Promise<User> but the backend's
  anti-enumeration 201 carries only {username, role}; retype to
  RegisterResponse
- drop Limits.course.max_class_bytes: invented by a past alignment
  commit, never published or enforced by the backend in any revision
- update the auth and parents tests, which pinned both wrong shapes
src/api/__tests__/auth/auth.test.tsmodified+4 -4
@@ -33,12 +33,12 @@ describe("auth API", () => {
33 });33 });
34 34
35 it("postRegister calls /auth/register with data", async () => {35 it("postRegister calls /auth/register with data", async () => {
36- const mockUser = { id: "u2", username: "newuser" };36+ const mockResponse = { username: "newuser", role: "student" };
37- mockFetchSuccess(mockUser);37+ mockFetchSuccess(mockResponse);
38 38
39- const data = { school: "demo", username: "newuser", password: "password", email: "test@test.com" };39+ const data = { school: "demo", username: "newuser", password: "password" };
40 const result = await postRegister(data);40 const result = await postRegister(data);
41- expect(result).toEqual(mockUser);41+ expect(result).toEqual(mockResponse);
42 42
43 const [url, init] = lastFetchCall();43 const [url, init] = lastFetchCall();
44 expect(url).toBe("/api/auth/register");44 expect(url).toBe("/api/auth/register");
src/api/__tests__/parents/parents.test.tsmodified+1 -1
@@ -32,7 +32,7 @@ describe("parents API", () => {
32 const [url, init] = lastFetchCall();32 const [url, init] = lastFetchCall();
33 expect(url).toBe("/api/users/u1/students");33 expect(url).toBe("/api/users/u1/students");
34 expect(init?.method).toBe("POST");34 expect(init?.method).toBe("POST");
35- expect(init?.body).toBe(JSON.stringify(JSON.stringify({ user_id: "s1" }))); // client.ts stringifies the string again? wait no, if it expects double stringify, we do it. Let's just use the exact string. Actually, let's just use init?.body35+ expect(init?.body).toBe(JSON.stringify({ user_id: "s1" }));
36 });36 });
37 37
38 it("deleteParentStudent calls /users/:id/students/:studentId", async () => {38 it("deleteParentStudent calls /users/:id/students/:studentId", async () => {
src/api/auth/postRegister.tsmodified+9 -3
@@ -1,5 +1,5 @@
1 import { client } from "../client";1 import { client } from "../client";
2-import type { User } from "../client";2+import type { Role } from "../client";
3 3
4 export type RegisterBody = {4 export type RegisterBody = {
5 school: string;5 school: string;
@@ -7,6 +7,12 @@ export type RegisterBody = {
7 password: string;7 password: string;
8 };8 };
9 9
10-export function postRegister(body: RegisterBody): Promise<User> {10+/** Backend answers 201 {username, role} only — anti-enumeration, no id. */
11- return client<User>("/auth/register", { method: "POST", body });11+export type RegisterResponse = {
12+ username: string;
13+ role: Role;
14+};
15+
16+export function postRegister(body: RegisterBody): Promise<RegisterResponse> {
17+ return client<RegisterResponse>("/auth/register", { method: "POST", body });
12 }18 }
src/api/client/types.tsmodified+620 -621
@@ -13,44 +13,44 @@ export type QuestionKind = "choice" | "text";
13 export type AttemptStatus = "in_progress" | "submitted" | "expired";13 export type AttemptStatus = "in_progress" | "submitted" | "expired";
14 14
15 export type User = {15 export type User = {
16- id: string;16+ id: string;
17- username: string;17+ username: string;
18- role: Role;18+ role: Role;
19- name: string | null;19+ name: string | null;
20- surname: string | null;20+ surname: string | null;
21- email: string | null;21+ email: string | null;
22- phone: string | null;22+ phone: string | null;
23- birth_date: string | null;23+ birth_date: string | null;
24- theme: UserTheme | null;24+ theme: UserTheme | null;
25- language: UserLanguage | null;25+ language: UserLanguage | null;
26- palette_color: string | null;26+ palette_color: string | null;
27 };27 };
28 28
29 // PATCH /users/me and PATCH /users/{id}/profile take the same body: an omitted29 // PATCH /users/me and PATCH /users/{id}/profile take the same body: an omitted
30 // (or null) field is left alone, an empty string clears it.30 // (or null) field is left alone, an empty string clears it.
31 export type ProfileUpdate = {31 export type ProfileUpdate = {
32- name?: string | null;32+ name?: string | null;
33- surname?: string | null;33+ surname?: string | null;
34- email?: string | null;34+ email?: string | null;
35- phone?: string | null;35+ phone?: string | null;
36- birth_date?: string | null;36+ birth_date?: string | null;
37- display_name?: string | null;37+ display_name?: string | null;
38- bio?: string | null;38+ bio?: string | null;
39 };39 };
40 40
41 export type PersonRef = {41 export type PersonRef = {
42- id: string;42+ id: string;
43- username: string;43+ username: string;
44- display_name: string | null;44+ display_name: string | null;
45 };45 };
46 46
47 // The lifetime counter a badge reads. Badges sharing a stat form a ladder.47 // The lifetime counter a badge reads. Badges sharing a stat form a ladder.
48 export type BadgeStat =48 export type BadgeStat =
49- | "homework_submitted"49+ | "homework_submitted"
50- | "homework_on_time"50+ | "homework_on_time"
51- | "exam_sat"51+ | "exam_sat"
52- | "pomodoro_finished"52+ | "pomodoro_finished"
53- | "pomodoro_focus_ms";53+ | "pomodoro_focus_ms";
54 54
55 // One entry of the badge catalogue, served by GET /limits. The label and icon55 // One entry of the badge catalogue, served by GET /limits. The label and icon
56 // behind an id live in the client, exactly as they do for a role.56 // behind an id live in the client, exactly as they do for a role.
@@ -69,254 +69,254 @@ export type ProfileCourseRef = { id: string; title: string; kind: CourseKind };
69 // Lifetime counters behind the badge ladders, plus the two live totals the69 // Lifetime counters behind the badge ladders, plus the two live totals the
70 // capped `classes`/`courses` lists would otherwise hide.70 // capped `classes`/`courses` lists would otherwise hide.
71 export type ProfileStats = {71 export type ProfileStats = {
72- pomodoro_sessions: number;72+ pomodoro_sessions: number;
73- pomodoro_focus_ms: number;73+ pomodoro_focus_ms: number;
74- courses: number;74+ courses: number;
75- classes: number;75+ classes: number;
76- homework_submitted_total: number;76+ homework_submitted_total: number;
77- homework_on_time_total: number;77+ homework_on_time_total: number;
78- exam_sat_total: number;78+ exam_sat_total: number;
79- pomodoro_finished_total: number;79+ pomodoro_finished_total: number;
80- pomodoro_focus_ms_total: number;80+ pomodoro_focus_ms_total: number;
81 };81 };
82 82
83 // A person's public profile. Readable by any authenticated account except a83 // A person's public profile. Readable by any authenticated account except a
84 // parent, who only reaches their own and their linked students'. Never carries84 // parent, who only reaches their own and their linked students'. Never carries
85 // email, phone or birth date at any role — those stay on GET /users/{id}.85 // email, phone or birth date at any role — those stay on GET /users/{id}.
86 export type Profile = {86 export type Profile = {
87- id: string;87+ id: string;
88- username: string;88+ username: string;
89- display_name: string | null;89+ display_name: string | null;
90- role: Role;90+ role: Role;
91- bio: string | null;91+ bio: string | null;
92- avatar: AvatarMeta | null;92+ avatar: AvatarMeta | null;
93- // Capped at limits.user.max_profile_classes; stats.classes holds the true total.93+ // Capped at limits.user.max_profile_classes; stats.classes holds the true total.
94- classes: ProfileClassRef[];94+ classes: ProfileClassRef[];
95- // Capped at limits.user.max_profile_courses, and filtered to what the reader95+ // Capped at limits.user.max_profile_courses, and filtered to what the reader
96- // may see; stats.courses holds the owner's true, unfiltered total.96+ // may see; stats.courses holds the owner's true, unfiltered total.
97- courses: ProfileCourseRef[];97+ courses: ProfileCourseRef[];
98- badges: EarnedBadge[];98+ badges: EarnedBadge[];
99- stats: ProfileStats;99+ stats: ProfileStats;
100 };100 };
101 101
102 export type Note = {102 export type Note = {
103- id: string;103+ id: string;
104- title: string;104+ title: string;
105- content: string;105+ content: string;
106 };106 };
107 107
108 /** A note attached to a course; files reuse the personal note's `NoteFile` shape. */108 /** A note attached to a course; files reuse the personal note's `NoteFile` shape. */
109 export type CourseNote = {109 export type CourseNote = {
110- id: string;110+ id: string;
111- course: string;111+ course: string;
112- title: string;112+ title: string;
113- content: string;113+ content: string;
114 };114 };
115 115
116 /** One AI service output stored against a course note. `payload` is the116 /** One AI service output stored against a course note. `payload` is the
117 * service's own shape — stored and served unread, rendered as JSON. */117 * service's own shape — stored and served unread, rendered as JSON. */
118 export type RagOutput = {118 export type RagOutput = {
119- id: string;119+ id: string;
120- course_note: string;120+ course_note: string;
121- course: string;121+ course: string;
122- /** The note's file attachments the output was built from. */122+ /** The note's file attachments the output was built from. */
123- sources: string[];123+ sources: string[];
124- payload: unknown;124+ payload: unknown;
125- /** When the backend stored it, epoch milliseconds. */125+ /** When the backend stored it, epoch milliseconds. */
126- generated_at: number;126+ generated_at: number;
127 };127 };
128 128
129 export type NoteFile = {129 export type NoteFile = {
130- id: string;130+ id: string;
131- name: string;131+ name: string;
132- content_type: string;132+ content_type: string;
133- size: number;133+ size: number;
134 };134 };
135 135
136 /** The caller's school entitlements: every switched-on module, sorted by name. */136 /** The caller's school entitlements: every switched-on module, sorted by name. */
137 export type EnabledModules = {137 export type EnabledModules = {
138- enabled: string[];138+ enabled: string[];
139 };139 };
140 140
141 export type ModuleCatalogEntry = {141 export type ModuleCatalogEntry = {
142- module: string;142+ module: string;
143- package: string;143+ package: string;
144- /** Modules that must be enabled alongside this one. */144+ /** Modules that must be enabled alongside this one. */
145- requires: string[];145+ requires: string[];
146 };146 };
147 147
148 export type ModuleCatalogPackage = {148 export type ModuleCatalogPackage = {
149- package: string;149+ package: string;
150- modules: string[];150+ modules: string[];
151 };151 };
152 152
153 /** The deployment's whole module catalog — identical for every school. */153 /** The deployment's whole module catalog — identical for every school. */
154 export type ModuleCatalog = {154 export type ModuleCatalog = {
155- modules: ModuleCatalogEntry[];155+ modules: ModuleCatalogEntry[];
156- packages: ModuleCatalogPackage[];156+ packages: ModuleCatalogPackage[];
157 };157 };
158 158
159 export type EventAudience =159 export type EventAudience =
160- | { kind: "school" }160+ | { kind: "school" }
161- | { kind: "role"; role: Role }161+ | { kind: "role"; role: Role }
162- | { kind: "course"; course: string }162+ | { kind: "course"; course: string }
163- | { kind: "registration"; capacity?: number | null };163+ | { kind: "registration"; capacity?: number | null };
164 164
165 export type Event = {165 export type Event = {
166- id: string;166+ id: string;
167- creator: string;167+ creator: string;
168- title: string;168+ title: string;
169- description: string;169+ description: string;
170- audience: EventAudience;170+ audience: EventAudience;
171- starts_at: number | null;171+ starts_at: number | null;
172- ends_at: number | null;172+ ends_at: number | null;
173 };173 };
174 174
175 export type Attendance = {175 export type Attendance = {
176- id: string;176+ id: string;
177- event: string;177+ event: string;
178- user: PersonRef;178+ user: PersonRef;
179- status: AttendanceStatus;179+ status: AttendanceStatus;
180- marked_by: PersonRef;180+ marked_by: PersonRef;
181 };181 };
182 182
183 export type EventRosterEntry = {183 export type EventRosterEntry = {
184- user: PersonRef;184+ user: PersonRef;
185- status: AttendanceStatus | null;185+ status: AttendanceStatus | null;
186- marked_by: PersonRef | null;186+ marked_by: PersonRef | null;
187 };187 };
188 188
189 export type EventRegistration = {189 export type EventRegistration = {
190- event: string;190+ event: string;
191- user: PersonRef;191+ user: PersonRef;
192- registered_by: PersonRef;192+ registered_by: PersonRef;
193 };193 };
194 194
195 export type AppointmentStatus = "pending" | "approved" | "rejected" | "cancelled";195 export type AppointmentStatus = "pending" | "approved" | "rejected" | "cancelled";
196 196
197 export type AppointmentSlot = {197 export type AppointmentSlot = {
198- id: string;198+ id: string;
199- teacher: PersonRef;199+ teacher: PersonRef;
200- starts_at: number; // unix ms UTC200+ starts_at: number; // unix ms UTC
201- ends_at: number; // unix ms UTC, half-open201+ ends_at: number; // unix ms UTC, half-open
202- note: string | null;202+ note: string | null;
203- series: string | null; // null = one-off; shared id across a weekly series203+ series: string | null; // null = one-off; shared id across a weekly series
204- created_at: number;204+ created_at: number;
205 };205 };
206 206
207 export type Appointment = {207 export type Appointment = {
208- id: string;208+ id: string;
209- slot: string;209+ slot: string;
210- teacher: PersonRef | null; // null only if slot vanished210+ teacher: PersonRef | null; // null only if slot vanished
211- requester: PersonRef;211+ requester: PersonRef;
212- status: AppointmentStatus;212+ status: AppointmentStatus;
213- reason: string;213+ reason: string;
214- starts_at: number | null; // effective window: the proposal whenever one is on the214+ starts_at: number | null; // effective window: the proposal whenever one is on the
215- // row (accepted or not), else the slot's own time215+ // row (accepted or not), else the slot's own time
216- ends_at: number | null;216+ ends_at: number | null;
217- proposed_starts_at: number | null;217+ proposed_starts_at: number | null;
218- proposed_ends_at: number | null;218+ proposed_ends_at: number | null;
219- proposed_by: PersonRef | null;219+ proposed_by: PersonRef | null;
220- decided_by: PersonRef | null; // null while pending220+ decided_by: PersonRef | null; // null while pending
221- cancelled_by: PersonRef | null; // set only when status === "cancelled"221+ cancelled_by: PersonRef | null; // set only when status === "cancelled"
222- cancel_reason: string | null; // optional reason, null when none given222+ cancel_reason: string | null; // optional reason, null when none given
223- reject_reason: string | null; // optional reason when status === "rejected" (rejecter is decided_by)223+ reject_reason: string | null; // optional reason when status === "rejected" (rejecter is decided_by)
224- created_at: number;224+ created_at: number;
225 };225 };
226 226
227 export const APPOINTMENT_LIMITS = {227 export const APPOINTMENT_LIMITS = {
228- noteMaxLen: 500, // MAX_APPOINTMENT_NOTE_LEN, empty allowed228+ noteMaxLen: 500, // MAX_APPOINTMENT_NOTE_LEN, empty allowed
229- reasonMaxLen: 1000, // MAX_APPOINTMENT_REASON_LEN, non-blank required229+ reasonMaxLen: 1000, // MAX_APPOINTMENT_REASON_LEN, non-blank required
230- maxSlotOccurrences: 52, // MAX_SLOT_OCCURRENCES for repeat_weekly230+ maxSlotOccurrences: 52, // MAX_SLOT_OCCURRENCES for repeat_weekly
231 } as const;231 } as const;
232 232
233 export const BANK_QUESTION_LIMITS = {233 export const BANK_QUESTION_LIMITS = {
234- textMaxLen: 2000, // MAX_QUESTION_TEXT_LEN234+ textMaxLen: 2000, // MAX_QUESTION_TEXT_LEN
235- choiceTextMaxLen: 500, // MAX_CHOICE_TEXT_LEN235+ choiceTextMaxLen: 500, // MAX_CHOICE_TEXT_LEN
236- minPoints: 1, // MIN_QUESTION_POINTS236+ minPoints: 1, // MIN_QUESTION_POINTS
237- maxPoints: 100, // MAX_QUESTION_POINTS237+ maxPoints: 100, // MAX_QUESTION_POINTS
238- minChoices: 2, // MIN_QUESTION_CHOICES238+ minChoices: 2, // MIN_QUESTION_CHOICES
239- maxChoices: 10, // MAX_QUESTION_CHOICES239+ maxChoices: 10, // MAX_QUESTION_CHOICES
240 } as const;240 } as const;
241 241
242 export type Course = {242 export type Course = {
243- id: string;243+ id: string;
244- creator: PersonRef;244+ creator: PersonRef;
245- teachers?: PersonRef[];245+ teachers?: PersonRef[];
246- title: string;246+ title: string;
247- description: string;247+ description: string;
248- kind: CourseKind;248+ kind: CourseKind;
249- term: string | null;249+ term: string | null;
250- capacity: number | null;250+ capacity: number | null;
251 };251 };
252 252
253 export type Term = {253 export type Term = {
254- id: string;254+ id: string;
255- name: string;255+ name: string;
256- starts_at: number;256+ starts_at: number;
257- ends_at: number;257+ ends_at: number;
258- /** Archived at, UTC unix-millis; null while the term is open. */258+ /** Archived at, UTC unix-millis; null while the term is open. */
259- archived_at: number | null;259+ archived_at: number | null;
260 };260 };
261 261
262 export type Enrollment = {262 export type Enrollment = {
263- id: string;263+ id: string;
264- course: string;264+ course: string;
265- user: PersonRef;265+ user: PersonRef;
266- enrolled_by: PersonRef;266+ enrolled_by: PersonRef;
267- // The class (ClassGroup id) that pumped this enrollment, or null for a267+ // The class (ClassGroup id) that pumped this enrollment, or null for a
268- // hand-placed row. A row with a source is swept when that class drops the268+ // hand-placed row. A row with a source is swept when that class drops the
269- // student or detaches the course; a null row is permanent.269+ // student or detaches the course; a null row is permanent.
270- source: string | null;270+ source: string | null;
271 };271 };
272 272
273 // A class (şube): a named group of students, optionally tied to a term, that273 // A class (şube): a named group of students, optionally tied to a term, that
274 // pumps the Cartesian product of its members × attached courses into real274 // pumps the Cartesian product of its members × attached courses into real
275 // enrollment rows. See src/api/classes.275 // enrollment rows. See src/api/classes.
276 export type ClassGroup = {276 export type ClassGroup = {
277- id: string;277+ id: string;
278- // null for a caller below teacher+ — the office's account names are not278+ // null for a caller below teacher+ — the office's account names are not
279- // theirs to learn (a student's own GET /classes/me, a parent's279+ // theirs to learn (a student's own GET /classes/me, a parent's
280- // GET /classes/user/{user}).280+ // GET /classes/user/{user}).
281- creator: PersonRef | null;281+ creator: PersonRef | null;
282- name: string;282+ name: string;
283- grade: string | null;283+ grade: string | null;
284- term: string | null;284+ term: string | null;
285- // The class's homeroom teacher (sınıf öğretmeni); null when none is assigned.285+ // The class's homeroom teacher (sınıf öğretmeni); null when none is assigned.
286- teacher: PersonRef | null;286+ teacher: PersonRef | null;
287 };287 };
288 288
289 export type ClassMember = {289 export type ClassMember = {
290- id: string;290+ id: string;
291- class: string;291+ class: string;
292- user: PersonRef;292+ user: PersonRef;
293- added_by: PersonRef;293+ added_by: PersonRef;
294 };294 };
295 295
296 export type ClassCourse = {296 export type ClassCourse = {
297- id: string;297+ id: string;
298- class: string;298+ class: string;
299- course: string;299+ course: string;
300- attached_by: PersonRef;300+ attached_by: PersonRef;
301 };301 };
302 302
303 // A grade blueprint: the set of courses every class at one grade takes. The303 // A grade blueprint: the set of courses every class at one grade takes. The
304 // grade label is the record's key, so there is at most one per grade. Creating304 // grade label is the record's key, so there is at most one per grade. Creating
305 // or editing one applies it to every existing class at that grade right away.305 // or editing one applies it to every existing class at that grade right away.
306 export type ClassBlueprint = {306 export type ClassBlueprint = {
307- grade: string;307+ grade: string;
308- courses: string[];308+ courses: string[];
309- creator: PersonRef;309+ creator: PersonRef;
310 };310 };
311 311
312 // One (class, course) pair a blueprint could not attach. Applying is312 // One (class, course) pair a blueprint could not attach. Applying is
313 // best-effort: a pair that cannot land is reported here and the rest still go313 // best-effort: a pair that cannot land is reported here and the rest still go
314 // through. `reason` is backend English — localize it, never render it raw.314 // through. `reason` is backend English — localize it, never render it raw.
315 export type BlueprintSkip = {315 export type BlueprintSkip = {
316- class: string;316+ class: string;
317- class_name: string;317+ class_name: string;
318- course: string;318+ course: string;
319- reason: string;319+ reason: string;
320 };320 };
321 321
322 export type BlueprintResult = { blueprint: ClassBlueprint; skipped: BlueprintSkip[] };322 export type BlueprintResult = { blueprint: ClassBlueprint; skipped: BlueprintSkip[] };
@@ -325,85 +325,85 @@ export type BlueprintApplyResult = { skipped: BlueprintSkip[] };
325 325
326 /** One section measured against its grade's blueprint. */326 /** One section measured against its grade's blueprint. */
327 export type BlueprintSectionStatus = {327 export type BlueprintSectionStatus = {
328- class: string;328+ class: string;
329- class_name: string;329+ class_name: string;
330- /** Template courses the section does not carry; empty when in sync. */330+ /** Template courses the section does not carry; empty when in sync. */
331- missing: string[];331+ missing: string[];
332 };332 };
333 333
334 /** Every section at a grade with the template courses it is missing. */334 /** Every section at a grade with the template courses it is missing. */
335 export type BlueprintStatus = {335 export type BlueprintStatus = {
336- grade: string;336+ grade: string;
337- /** The template every section below is measured against. */337+ /** The template every section below is measured against. */
338- courses: string[];338+ courses: string[];
339- matched: number;339+ matched: number;
340- sections: BlueprintSectionStatus[];340+ sections: BlueprintSectionStatus[];
341 };341 };
342 342
343 export type CourseSession = {343 export type CourseSession = {
344- id: string;344+ id: string;
345- course: string;345+ course: string;
346- teacher: PersonRef;346+ teacher: PersonRef;
347- topic: string;347+ topic: string;
348- starts_at: number;348+ starts_at: number;
349- ends_at: number | null;349+ ends_at: number | null;
350 };350 };
351 351
352 export type SessionAttendance = {352 export type SessionAttendance = {
353- id: string;353+ id: string;
354- session: string;354+ session: string;
355- course: string;355+ course: string;
356- user: PersonRef;356+ user: PersonRef;
357- status: AttendanceStatus;357+ status: AttendanceStatus;
358- marked_by: PersonRef;358+ marked_by: PersonRef;
359 };359 };
360 360
361 export type Exam = {361 export type Exam = {
362- id: string;362+ id: string;
363- creator: string;363+ creator: string;
364- course: string;364+ course: string;
365- title: string;365+ title: string;
366- description: string;366+ description: string;
367- kind: ExamKind | string;367+ kind: ExamKind | string;
368- mode: ExamMode | string | null;368+ mode: ExamMode | string | null;
369- starts_at: number | null;369+ starts_at: number | null;
370- ends_at: number | null;370+ ends_at: number | null;
371- duration_ms: number | null;371+ duration_ms: number | null;
372- max_attempts: number;372+ max_attempts: number;
373- allow_rejoin: boolean;373+ allow_rejoin: boolean;
374- allow_review: boolean;374+ allow_review: boolean;
375- draft: boolean;375+ draft: boolean;
376 };376 };
377 377
378 export type ImageMeta = {378 export type ImageMeta = {
379- content_type: string;379+ content_type: string;
380- size: number;380+ size: number;
381 };381 };
382 382
383 export type ExamResult = {383 export type ExamResult = {
384- id: string;384+ id: string;
385- exam: string;385+ exam: string;
386- user: PersonRef;386+ user: PersonRef;
387- mark: number;387+ mark: number;
388- graded_by: PersonRef;388+ graded_by: PersonRef;
389 };389 };
390 390
391 /** One option of a choice question. `id` is stable across edits, so its image survives. */391 /** One option of a choice question. `id` is stable across edits, so its image survives. */
392 export type Choice = { id: string; text: string };392 export type Choice = { id: string; text: string };
393 393
394 export type ExamQuestion = {394 export type ExamQuestion = {
395- id: string;395+ id: string;
396- exam: string;396+ exam: string;
397- subject: string;397+ subject: string;
398- text: string;398+ text: string;
399- kind: QuestionKind;399+ kind: QuestionKind;
400- points: number;400+ points: number;
401- choices: Choice[] | null;401+ choices: Choice[] | null;
402- correct: string | null;402+ correct: string | null;
403- image?: ImageMeta | null;403+ image?: ImageMeta | null;
404- choice_images?: (ImageMeta | null)[] | null;404+ choice_images?: (ImageMeta | null)[] | null;
405- from_bank?: string | null; // bank template this question was added from, if any405+ from_bank?: string | null; // bank template this question was added from, if any
406- banked_as?: string | null; // bank template last created by saving this question, if any406+ banked_as?: string | null; // bank template last created by saving this question, if any
407 };407 };
408 408
409 /** `private`: owner + admins only. `school`: every teacher can see it and its answer key. */409 /** `private`: owner + admins only. `school`: every teacher can see it and its answer key. */
@@ -411,372 +411,371 @@ export type BankVisibility = "private" | "school";
411 411
412 /** Reusable question stored in the school-wide question bank, outside any exam. */412 /** Reusable question stored in the school-wide question bank, outside any exam. */
413 export type BankQuestion = {413 export type BankQuestion = {
414- id: string;414+ id: string;
415- owner: string; // user id415+ owner: string; // user id
416- owner_name: string;416+ owner_name: string;
417- subject: string | null; // subject id (origin metadata); null once that subject is deleted417+ subject: string | null; // subject id (origin metadata); null once that subject is deleted
418- subject_name: string;418+ subject_name: string;
419- text: string;419+ text: string;
420- kind: QuestionKind;420+ kind: QuestionKind;
421- points: number;421+ points: number;
422- choices: Choice[] | null;422+ choices: Choice[] | null;
423- correct: string | null;423+ correct: string | null;
424- image?: ImageMeta | null;424+ image?: ImageMeta | null;
425- choice_images?: (ImageMeta | null)[] | null;425+ choice_images?: (ImageMeta | null)[] | null;
426- source_exam?: string | null;426+ source_exam?: string | null;
427- visibility: BankVisibility; // new templates start "private"427+ visibility: BankVisibility; // new templates start "private"
428- created_at: number; // UTC unix ms428+ created_at: number; // UTC unix ms
429- /**429+ /**
430- * How many exam questions were copied out of this template. Each copy is430+ * How many exam questions were copied out of this template. Each copy is
431- * detached, so editing the template never reaches them — this is the431+ * detached, so editing the template never reaches them — this is the
432- * divergence surface. List-only, exactly like `subject_name`/`owner_name`:432+ * divergence surface. List-only, exactly like `subject_name`/`owner_name`:
433- * the single-template endpoints return 0.433+ * the single-template endpoints return 0.
434- */434+ */
435- used_count: number;435+ used_count: number;
436 };436 };
437 437
438 export type ExamAttempt = {438 export type ExamAttempt = {
439- id: string;439+ id: string;
440- exam: string;440+ exam: string;
441- user: PersonRef;441+ user: PersonRef;
442- status: AttemptStatus;442+ status: AttemptStatus;
443- attempt: number;443+ attempt: number;
444- attempts_used: number;444+ attempts_used: number;
445- max_attempts: number;445+ max_attempts: number;
446- started_at: number;446+ started_at: number;
447- finished_at: number | null;447+ finished_at: number | null;
448- deadline: number | null;448+ deadline: number | null;
449- remaining_ms: number | null;449+ remaining_ms: number | null;
450- left_at: number | null;450+ left_at: number | null;
451- mark: number | null;451+ mark: number | null;
452- answered: number;452+ answered: number;
453- question_count: number;453+ question_count: number;
454- now: number;454+ now: number;
455 };455 };
456 456
457 export type AttemptAnswer = {457 export type AttemptAnswer = {
458- selected?: string | null;458+ selected?: string | null;
459- text?: string | null;459+ text?: string | null;
460- updated_at?: number;460+ updated_at?: number;
461- answer_image?: ImageMeta | null;461+ answer_image?: ImageMeta | null;
462 };462 };
463 463
464 export type AttemptQuestionResponse = {464 export type AttemptQuestionResponse = {
465- id: string;465+ id: string;
466- subject: string;466+ subject: string;
467- text: string;467+ text: string;
468- kind: QuestionKind;468+ kind: QuestionKind;
469- points: number;469+ points: number;
470- choices: Choice[] | null;470+ choices: Choice[] | null;
471- image?: ImageMeta | null;471+ image?: ImageMeta | null;
472- choice_images?: (ImageMeta | null)[] | null;472+ choice_images?: (ImageMeta | null)[] | null;
473- answer: AttemptAnswer | null;473+ answer: AttemptAnswer | null;
474 };474 };
475 475
476 export type AttemptQuestion = AttemptQuestionResponse & { exam: string };476 export type AttemptQuestion = AttemptQuestionResponse & { exam: string };
477 477
478 export type PomodoroSession = {478 export type PomodoroSession = {
479- id: string;479+ id: string;
480- user: string;480+ user: string;
481- started_at: number;481+ started_at: number;
482- finished_at: number | null;482+ finished_at: number | null;
483- duration_ms: number | null;483+ duration_ms: number | null;
484 };484 };
485 485
486 export type PomodoroLog = {486 export type PomodoroLog = {
487- items: PomodoroSession[];487+ items: PomodoroSession[];
488- total: number;488+ total: number;
489- limit: number | null;489+ limit: number | null;
490- offset: number;490+ offset: number;
491- total_focus_ms: number;491+ total_focus_ms: number;
492 };492 };
493 493
494 export type Subject = {494 export type Subject = {
495- id: string;495+ id: string;
496- course: string;496+ course: string;
497- name: string;497+ name: string;
498- description: string;498+ description: string;
499 };499 };
500 500
501 export type MarkEntry = {501 export type MarkEntry = {
502- exam: string;502+ exam: string;
503- title: string;503+ title: string;
504- kind: string;504+ kind: string;
505- weight: number;505+ weight: number;
506- mark: number;506+ mark: number;
507- grade?: string | null;507+ grade?: string | null;
508- graded_by: string;508+ graded_by: string;
509 };509 };
510 510
511 export type CourseMarks = {511 export type CourseMarks = {
512- course: Course;512+ course: Course;
513- results: MarkEntry[];513+ results: MarkEntry[];
514- average: number | null;514+ average: number | null;
515- average_grade?: string | null;515+ average_grade?: string | null;
516 };516 };
517 517
518 export type AttendanceCounts = {518 export type AttendanceCounts = {
519- present: number;519+ present: number;
520- absent: number;520+ absent: number;
521- late: number;521+ late: number;
522- excused: number;522+ excused: number;
523- custom: Record<string, number>;523+ custom: Record<string, number>;
524- total: number;524+ total: number;
525- rate: number | null;525+ rate: number | null;
526 };526 };
527 527
528 export type CourseAttendance = {528 export type CourseAttendance = {
529- course: Course;529+ course: Course;
530- counts: AttendanceCounts;530+ counts: AttendanceCounts;
531 };531 };
532 532
533 export type AttendanceReport = {533 export type AttendanceReport = {
534- user: string;534+ user: string;
535- events: AttendanceCounts;535+ events: AttendanceCounts;
536- sessions: AttendanceCounts;536+ sessions: AttendanceCounts;
537- courses: CourseAttendance[];537+ courses: CourseAttendance[];
538 };538 };
539 539
540 export type WorkEntry = {540 export type WorkEntry = {
541- id: string;541+ id: string;
542- user: string;542+ user: string;
543- check_in: number;543+ check_in: number;
544- check_out: number | null;544+ check_out: number | null;
545- duration_ms: number | null;545+ duration_ms: number | null;
546 };546 };
547 547
548 export type MarksReport = {548 export type MarksReport = {
549- user: string;549+ user: string;
550- courses: CourseMarks[];550+ courses: CourseMarks[];
551- overall_average: number | null;551+ overall_average: number | null;
552- overall_grade?: string | null;552+ overall_grade?: string | null;
553 };553 };
554 554
555 export type ExamStatistics = {555 export type ExamStatistics = {
556- exam: string;556+ exam: string;
557- graded: number;557+ graded: number;
558- average: number | null;558+ average: number | null;
559- min: number | null;559+ min: number | null;
560- max: number | null;560+ max: number | null;
561 };561 };
562 562
563 export type StudentAnswer = {563 export type StudentAnswer = {
564- question: string;564+ question: string;
565- selected: string | null;565+ selected: string | null;
566- text: string | null;566+ text: string | null;
567- updated_at: number;567+ updated_at: number;
568- is_correct: boolean | null;568+ is_correct: boolean | null;
569- answer_image?: ImageMeta | null;569+ answer_image?: ImageMeta | null;
570 };570 };
571 571
572 export type StudentAnswerSheet = {572 export type StudentAnswerSheet = {
573- exam: string;573+ exam: string;
574- user: PersonRef;574+ user: PersonRef;
575- answers: StudentAnswer[];575+ answers: StudentAnswer[];
576- auto_score: { earned: number; possible: number };576+ auto_score: { earned: number; possible: number };
577 };577 };
578 578
579 export type LiveRosterEntry = {579 export type LiveRosterEntry = {
580- user: PersonRef;580+ user: PersonRef;
581- status: AttemptStatus | "not_started" | "absent";581+ status: AttemptStatus | "not_started" | "absent";
582- attempt: number | null;582+ attempt: number | null;
583- attempts_used: number;583+ attempts_used: number;
584- deadline: number | null;584+ deadline: number | null;
585- remaining_ms: number | null;585+ remaining_ms: number | null;
586- left_at: number | null;586+ left_at: number | null;
587- mark: number | null;587+ mark: number | null;
588- answered: number;588+ answered: number;
589- started_at: number | null;589+ started_at: number | null;
590- finished_at: number | null;590+ finished_at: number | null;
591- last_activity: number | null;591+ last_activity: number | null;
592 };592 };
593 593
594 export type LiveMonitor = {594 export type LiveMonitor = {
595- exam: Exam;595+ exam: Exam;
596- now: number;596+ now: number;
597- question_count: number;597+ question_count: number;
598- students: LiveRosterEntry[];598+ students: LiveRosterEntry[];
599- counts: {599+ counts: {
600- enrolled: number;600+ enrolled: number;
601- not_started: number;601+ not_started: number;
602- absent: number;602+ absent: number;
603- in_progress: number;603+ in_progress: number;
604- submitted: number;604+ submitted: number;
605- expired: number;605+ expired: number;
606- graded: number;606+ graded: number;
607- };607+ };
608 };608 };
609 609
610 export type ExamKindSetting = {610 export type ExamKindSetting = {
611- name: string;611+ name: string;
612- weight: number;612+ weight: number;
613 };613 };
614 614
615 export type GradeBand = {615 export type GradeBand = {
616- min: number;616+ min: number;
617- label: string;617+ label: string;
618 };618 };
619 619
620 export type MealSlot = {620 export type MealSlot = {
621- name: string;621+ name: string;
622- serving_minute: number | null;622+ serving_minute: number | null;
623 };623 };
624 624
625 export type SchoolSettings = {625 export type SchoolSettings = {
626- exam_kinds: ExamKindSetting[];626+ exam_kinds: ExamKindSetting[];
627- attendance_statuses: string[];627+ attendance_statuses: string[];
628- grade_bands: GradeBand[];628+ grade_bands: GradeBand[];
629- max_file_bytes: number;629+ max_file_bytes: number;
630- chatbot_history_turns: number;630+ chatbot_history_turns: number;
631- max_chatbot_threads: number;631+ max_chatbot_threads: number;
632- max_chatbot_message_len: number;632+ max_chatbot_message_len: number;
633- meal_slots: MealSlot[];633+ meal_slots: MealSlot[];
634- dietary_tags: string[];634+ dietary_tags: string[];
635- meal_cancel_cutoff_minutes: number | null;635+ meal_cancel_cutoff_minutes: number | null;
636 };636 };
637 637
638 export type Limits = {638 export type Limits = {
639- user: {639+ user: {
640- min_username_len: number;640+ min_username_len: number;
641- max_username_len: number;641+ max_username_len: number;
642- username_separators: string[];642+ username_separators: string[];
643- reserved_usernames: string[];643+ reserved_usernames: string[];
644- min_password_len: number;644+ min_password_len: number;
645- max_password_len: number;645+ max_password_len: number;
646- max_name_len: number;646+ max_name_len: number;
647- max_display_name_len: number;647+ max_display_name_len: number;
648- max_bio_len: number;648+ max_bio_len: number;
649- // Caps on what a profile read embeds, not on membership: the full lists649+ // Caps on what a profile read embeds, not on membership: the full lists
650- // stay at /courses/me and /classes/me.650+ // stay at /courses/me and /classes/me.
651- max_profile_courses: number;651+ max_profile_courses: number;
652- max_profile_classes: number;652+ max_profile_classes: number;
653- max_email_len: number;653+ max_email_len: number;
654- min_phone_digits: number;654+ min_phone_digits: number;
655- max_phone_digits: number;655+ max_phone_digits: number;
656- roles: Role[];656+ roles: Role[];
657- themes: UserTheme[];657+ themes: UserTheme[];
658- languages: UserLanguage[];658+ languages: UserLanguage[];
659- session_duration_days: number;659+ session_duration_days: number;
660- };660+ };
661- badges: { catalog: BadgeCatalogEntry[] };661+ badges: { catalog: BadgeCatalogEntry[] };
662- note: { max_title_len: number; max_content_len: number; max_files: number };662+ note: { max_title_len: number; max_content_len: number; max_files: number };
663- file: {663+ file: {
664- max_name_len: number;664+ max_name_len: number;
665- max_content_type_len: number;665+ max_content_type_len: number;
666- min_max_file_bytes: number;666+ min_max_file_bytes: number;
667- max_max_file_bytes: number;667+ max_max_file_bytes: number;
668- default_max_file_bytes: number;668+ default_max_file_bytes: number;
669- image_content_types: string[];669+ image_content_types: string[];
670- };670+ };
671- message: { max_subject_len: number; max_body_len: number; max_label_len: number };671+ message: { max_subject_len: number; max_body_len: number; max_label_len: number };
672- event: { max_title_len: number; max_description_len: number };672+ event: { max_title_len: number; max_description_len: number };
673- course: {673+ course: {
674- max_title_len: number;674+ max_title_len: number;
675- max_description_len: number;675+ max_description_len: number;
676- kinds: CourseKind[];676+ kinds: CourseKind[];
677- max_subject_name_len: number;677+ max_subject_name_len: number;
678- max_subject_description_len: number;678+ max_subject_description_len: number;
679- max_session_topic_len: number;679+ max_session_topic_len: number;
680- max_term_name_len: number;680+ max_term_name_len: number;
681- max_class_name_len: number;681+ max_class_name_len: number;
682- max_class_grade_len: number;682+ max_class_grade_len: number;
683- max_class_members: number;683+ max_class_members: number;
684- max_class_courses: number;684+ max_class_courses: number;
685- max_class_bytes: number;685+ };
686- };686+ exam: {
687- exam: {687+ max_title_len: number;
688- max_title_len: number;688+ max_description_len: number;
689- max_description_len: number;689+ modes: ExamMode[];
690- modes: ExamMode[];690+ min_duration_ms: number;
691- min_duration_ms: number;691+ max_duration_ms: number;
692- max_duration_ms: number;692+ max_attempts: number;
693- max_attempts: number;693+ unlimited_attempts: number;
694- unlimited_attempts: number;694+ question_kinds: QuestionKind[];
695- question_kinds: QuestionKind[];695+ max_question_text_len: number;
696- max_question_text_len: number;696+ min_question_points: number;
697- min_question_points: number;697+ max_question_points: number;
698- max_question_points: number;698+ min_question_choices: number;
699- min_question_choices: number;699+ max_question_choices: number;
700- max_question_choices: number;700+ max_choice_text_len: number;
701- max_choice_text_len: number;701+ max_answer_text_len: number;
702- max_answer_text_len: number;702+ min_mark: number;
703- min_mark: number;703+ max_mark: number;
704- max_mark: number;704+ ws_tick_secs: number;
705- ws_tick_secs: number;705+ ws_max_question_id_len: number;
706- ws_max_question_id_len: number;706+ };
707- };707+ homework: {
708- homework: {708+ max_title_len: number;
709- max_title_len: number;709+ max_description_len: number;
710- max_description_len: number;710+ max_text_len: number;
711- max_text_len: number;711+ max_files_per_submission: number;
712- max_files_per_submission: number;712+ max_assigned: number;
713- max_assigned: number;713+ statuses: string[];
714- statuses: string[];714+ };
715- };715+ question_pool: { max_title_len: number; max_body_len: number; max_solution_body_len: number };
716- question_pool: { max_title_len: number; max_body_len: number; max_solution_body_len: number };716+ appointment: { max_note_len: number; max_reason_len: number; max_slot_occurrences: number };
717- appointment: { max_note_len: number; max_reason_len: number; max_slot_occurrences: number };717+ meal: {
718- meal: {718+ max_dish_name_len: number;
719- max_dish_name_len: number;719+ max_dish_description_len: number;
720- max_dish_description_len: number;720+ max_dishes_per_menu: number;
721- max_dishes_per_menu: number;721+ max_dish_tags: number;
722- max_dish_tags: number;722+ max_menu_capacity: number;
723- max_menu_capacity: number;723+ max_dietary_tags: number;
724- max_dietary_tags: number;724+ max_dietary_note_len: number;
725- max_dietary_note_len: number;725+ max_dish_price_minor: number;
726- max_dish_price_minor: number;726+ max_ledger_amount_minor: number;
727- max_ledger_amount_minor: number;727+ max_ledger_method_len: number;
728- max_ledger_method_len: number;728+ max_ledger_note_len: number;
729- max_ledger_note_len: number;729+ max_cancel_cutoff_minutes: number;
730- max_cancel_cutoff_minutes: number;730+ max_serving_minute: number;
731- max_serving_minute: number;731+ booking_statuses: string[];
732- booking_statuses: string[];732+ attendance_statuses: string[];
733- attendance_statuses: string[];733+ ledger_kinds: string[];
734- ledger_kinds: string[];734+ };
735- };735+ payment: {
736- payment: {736+ max_plan_name_len: number;
737- max_plan_name_len: number;737+ max_plan_installments: number;
738- max_plan_installments: number;738+ max_assign_students: number;
739- max_assign_students: number;739+ max_request_key_len: number;
740- max_request_key_len: number;740+ ledger_kinds: string[];
741- ledger_kinds: string[];741+ };
742- };742+ chatbot: {
743- chatbot: {743+ max_message_len: number;
744- max_message_len: number;744+ max_thread_title_len: number;
745- max_thread_title_len: number;745+ min_max_message_len: number;
746- min_max_message_len: number;746+ max_max_message_len: number;
747- max_max_message_len: number;747+ default_max_message_len: number;
748- default_max_message_len: number;748+ min_history_turns: number;
749- min_history_turns: number;749+ max_history_turns: number;
750- max_history_turns: number;750+ default_history_turns: number;
751- default_history_turns: number;751+ min_max_threads: number;
752- min_max_threads: number;752+ max_max_threads: number;
753- max_max_threads: number;753+ default_max_threads: number;
754- default_max_threads: number;754+ };
755- };755+ board: {
756- board: {756+ max_title_len: number;
757- max_title_len: number;757+ // People the creator may name onto one board. Every participant draws, so
758- // People the creator may name onto one board. Every participant draws, so758+ // this also bounds a room's writer count.
759- // this also bounds a room's writer count.759+ max_participants: number;
760- max_participants: number;760+ max_stroke_payload_len: number;
761- max_stroke_payload_len: number;761+ max_epoch_strokes: number;
762- max_epoch_strokes: number;762+ max_board_strokes: number;
763- max_board_strokes: number;763+ max_boards_per_creator: number;
764- max_boards_per_creator: number;764+ stroke_kinds: string[];
765- stroke_kinds: string[];765+ ws_tick_secs: number;
766- ws_tick_secs: number;766+ ws_max_board_id_len: number;
767- ws_max_board_id_len: number;767+ };
768- };768+ settings: {
769- settings: {769+ max_list_len: number;
770- max_list_len: number;770+ max_item_len: number;
771- max_item_len: number;771+ min_exam_kind_weight: number;
772- min_exam_kind_weight: number;772+ max_exam_kind_weight: number;
773- max_exam_kind_weight: number;773+ max_grade_bands: number;
774- max_grade_bands: number;774+ max_grade_label_len: number;
775- max_grade_label_len: number;775+ required_attendance_statuses: string[];
776- required_attendance_statuses: string[];776+ };
777- };777+ request: { max_page_limit: number; schedule_past_grace_ms: number; request_timeout_secs: number };
778- request: { max_page_limit: number; schedule_past_grace_ms: number; request_timeout_secs: number };778+ rate: { window_secs: number; auth_per_minute: number; api_per_minute: number; chatbot_per_minute: number };
779- rate: { window_secs: number; auth_per_minute: number; api_per_minute: number; chatbot_per_minute: number };
780 };779 };
781 780
782 // Fallbacks keep forms usable when the unauthenticated metadata request fails.781 // Fallbacks keep forms usable when the unauthenticated metadata request fails.
@@ -787,141 +786,141 @@ export const QUESTION_KINDS: QuestionKind[] = ["choice", "text"];
787 export type MessageFolder = "inbox" | "sent" | "archive" | "trash";786 export type MessageFolder = "inbox" | "sent" | "archive" | "trash";
788 787
789 export type Message = {788 export type Message = {
790- id: string;789+ id: string;
791- sender: PersonRef;790+ sender: PersonRef;
792- sender_role: Role | null;791+ sender_role: Role | null;
793- recipient: PersonRef;792+ recipient: PersonRef;
794- recipient_role: Role | null;793+ recipient_role: Role | null;
795- subject: string;794+ subject: string;
796- body: string;795+ body: string;
797- sent_at: number;796+ sent_at: number;
798- read: boolean;797+ read: boolean;
799- folder: MessageFolder;798+ folder: MessageFolder;
800- previous_folder?: MessageFolder | string | null;799+ previous_folder?: MessageFolder | string | null;
801- label: string | null;800+ label: string | null;
802 };801 };
803 802
804 export type Homework = {803 export type Homework = {
805- id: string;804+ id: string;
806- course: string;805+ course: string;
807- subject: string;806+ subject: string;
808- title: string;807+ title: string;
809- description: string | null;808+ description: string | null;
810- due_at: number;809+ due_at: number;
811- assigned: string[] | null;810+ assigned: string[] | null;
812- created_by: string;811+ created_by: string;
813- created_at: number;812+ created_at: number;
814 };813 };
815 814
816 export type HomeworkFile = {815 export type HomeworkFile = {
817- id: string;816+ id: string;
818- name: string;817+ name: string;
819- content_type: string;818+ content_type: string;
820- size: number;819+ size: number;
821 };820 };
822 821
823 export type HomeworkResultStatus = "done" | "incomplete" | "missing" | string;822 export type HomeworkResultStatus = "done" | "incomplete" | "missing" | string;
824 823
825 export type HomeworkResult = {824 export type HomeworkResult = {
826- status: HomeworkResultStatus;825+ status: HomeworkResultStatus;
827- mark: number | null;826+ mark: number | null;
828- graded_by: string;827+ graded_by: string;
829- created_at: number;828+ created_at: number;
830 };829 };
831 830
832 export type HomeworkSubmission = {831 export type HomeworkSubmission = {
833- user: string;832+ user: string;
834- homework: string;833+ homework: string;
835- text: string | null;834+ text: string | null;
836- submitted_at: number;835+ submitted_at: number;
837- updated_at: number;836+ updated_at: number;
838- late: boolean;837+ late: boolean;
839- files: HomeworkFile[];838+ files: HomeworkFile[];
840- result: HomeworkResult | null;839+ result: HomeworkResult | null;
841 };840 };
842 841
843 export type HomeworkRosterSubmission = Omit<HomeworkSubmission, "user" | "homework" | "result">;842 export type HomeworkRosterSubmission = Omit<HomeworkSubmission, "user" | "homework" | "result">;
844 843
845 export type HomeworkRosterEntry = {844 export type HomeworkRosterEntry = {
846- user: string;845+ user: string;
847- submission: HomeworkRosterSubmission | null;846+ submission: HomeworkRosterSubmission | null;
848- result: HomeworkResult | null;847+ result: HomeworkResult | null;
849- missing: boolean;848+ missing: boolean;
850- unenrolled: boolean;849+ unenrolled: boolean;
851 };850 };
852 851
853 export type HomeworkReportEntry = {852 export type HomeworkReportEntry = {
854- course: string;853+ course: string;
855- homework: string;854+ homework: string;
856- title: string;855+ title: string;
857- subject: string;856+ subject: string;
858- due_at: number;857+ due_at: number;
859- submitted: boolean;858+ submitted: boolean;
860- late: boolean;859+ late: boolean;
861- missing: boolean;860+ missing: boolean;
862- result: HomeworkResult | null;861+ result: HomeworkResult | null;
863 };862 };
864 863
865 export type MealDish = {864 export type MealDish = {
866- id: string;865+ id: string;
867- name: string;866+ name: string;
868- description: string | null;867+ description: string | null;
869- price_minor: number;868+ price_minor: number;
870- tags: string[];869+ tags: string[];
871- conflicts: string[];870+ conflicts: string[];
872- created_at: number;871+ created_at: number;
873 };872 };
874 873
875 export type MealMenu = {874 export type MealMenu = {
876- id: string;875+ id: string;
877- date: string;876+ date: string;
878- slot: string;877+ slot: string;
879- capacity: number | null;878+ capacity: number | null;
880- dishes: MealDish[];879+ dishes: MealDish[];
881- created_by: PersonRef;880+ created_by: PersonRef;
882- created_at: number;881+ created_at: number;
883 };882 };
884 883
885 export type MealBooking = {884 export type MealBooking = {
886- id: string;885+ id: string;
887- menu_id: string;886+ menu_id: string;
888- student: PersonRef;887+ student: PersonRef;
889- booked_by: PersonRef;888+ booked_by: PersonRef;
890- status: string;889+ status: string;
891- cancelled_at: number | null;890+ cancelled_at: number | null;
892- created_at: number;891+ created_at: number;
893 };892 };
894 893
895 export type MealAttendance = {894 export type MealAttendance = {
896- id: string;895+ id: string;
897- menu_id: string;896+ menu_id: string;
898- student: PersonRef;897+ student: PersonRef;
899- status: string;898+ status: string;
900- marked_by: PersonRef;899+ marked_by: PersonRef;
901- marked_at: number;900+ marked_at: number;
902 };901 };
903 902
904 export type DietaryProfile = {903 export type DietaryProfile = {
905- student: PersonRef;904+ student: PersonRef;
906- tags: string[];905+ tags: string[];
907- note: string | null;906+ note: string | null;
908- updated_by: PersonRef | null;907+ updated_by: PersonRef | null;
909- updated_at: number | null;908+ updated_at: number | null;
910 };909 };
911 910
912 export type MealBalance = {911 export type MealBalance = {
913- student: PersonRef;912+ student: PersonRef;
914- balance_minor: number;913+ balance_minor: number;
915 };914 };
916 915
917 export type MealLedgerEntry = {916 export type MealLedgerEntry = {
918- id: string;917+ id: string;
919- student: PersonRef;918+ student: PersonRef;
920- kind: string;919+ kind: string;
921- amount_minor: number;920+ amount_minor: number;
922- source: string | null;921+ source: string | null;
923- method: string | null;922+ method: string | null;
924- note: string | null;923+ note: string | null;
925- recorded_by: PersonRef;924+ recorded_by: PersonRef;
926- created_at: number;925+ created_at: number;
927 };926 };
src/api/parents/postParentStudent.tsmodified+1 -1
@@ -10,6 +10,6 @@ export interface ParentLinkResponse {
10 export async function postParentStudent(id: string, user_id: string): Promise<ParentLinkResponse> {10 export async function postParentStudent(id: string, user_id: string): Promise<ParentLinkResponse> {
11 return client(`/users/${id}/students`, {11 return client(`/users/${id}/students`, {
12 method: "POST",12 method: "POST",
13- body: JSON.stringify({ user_id }),13+ body: { user_id },
14 });14 });
15 }15 }