fix random
All checks were successful
Deploy on Master Change / deploy (push) Successful in 1m17s

This commit is contained in:
2026-07-13 10:29:34 +07:00
parent 0583c7869a
commit 06f2edb195
11 changed files with 476 additions and 71 deletions

View File

@@ -1124,6 +1124,14 @@ export const apiExam = {
if (!res.ok) await parseError(res, 'Chia gói đề thất bại');
return res.json() as Promise<{ assigned: number; packages: number }>;
},
assignPapersBatch: async (id: number, assignments: { studentRkId: number; paperId: number }[]) => {
const res = await staffFetch(`/exam-rooms/${id}/assign-papers-batch`, {
method: 'POST',
body: JSON.stringify({ assignments }),
});
if (!res.ok) await parseError(res, 'Chia gói đề thất bại');
return res.json() as Promise<{ assigned: number }>;
},
sendPapers: async (id: number, payload?: { scheduledAt?: string; studentRkIds?: number[] }) => {
const res = await staffFetch(`/exam-rooms/${id}/send-papers`, { method: 'POST', body: JSON.stringify(payload || {}) });
if (!res.ok) await parseError(res, 'Gửi gói đề thất bại');
@@ -1186,6 +1194,45 @@ export const apiExam = {
},
};
export interface MyClassItem {
rkId: number;
name: string;
classCode: string;
}
export const apiMyClasses = {
list: async (): Promise<MyClassItem[]> => {
const res = await staffFetch('/staff/my-classes');
if (!res.ok) return [];
const json = await res.json() as { data: MyClassItem[] };
return json.data ?? [];
},
add: async (classRkId: number): Promise<void> => {
await staffFetch(`/staff/my-classes/${classRkId}`, { method: 'POST' });
},
remove: async (classRkId: number): Promise<void> => {
await staffFetch(`/staff/my-classes/${classRkId}`, { method: 'DELETE' });
},
};
export const apiSeatingLayout = {
get: async (classRkId: number): Promise<string | null> => {
const res = await staffFetch(`/classes/${classRkId}/seating-layout`);
if (!res.ok) return null;
const json = await res.json() as { layoutJson: string | null };
return json.layoutJson ?? null;
},
save: async (classRkId: number, layoutJson: string): Promise<void> => {
await staffFetch(`/classes/${classRkId}/seating-layout`, {
method: 'PUT',
body: JSON.stringify({ layoutJson }),
});
},
delete: async (classRkId: number): Promise<void> => {
await staffFetch(`/classes/${classRkId}/seating-layout`, { method: 'DELETE' });
},
};
export const apiQldt = {
getToken: async (): Promise<{ token: string }> => {
const res = await staffFetch('/qldt-token');