This commit is contained in:
@@ -381,6 +381,31 @@ export interface StudentSessionLogItem {
|
||||
lastActiveAt?: string;
|
||||
}
|
||||
|
||||
export interface StudentViolationItem {
|
||||
id: number;
|
||||
studentRkId: number;
|
||||
studentCode: string;
|
||||
fullName: string;
|
||||
classRkId: number;
|
||||
kind: string;
|
||||
reason: string;
|
||||
monitorMode: string;
|
||||
clientAt?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export const VIOLATION_KIND_OPTIONS = [
|
||||
{ value: '', label: 'Tất cả loại' },
|
||||
{ value: 'app_closed', label: 'Tự đóng app' },
|
||||
{ value: 'unclean_shutdown', label: 'Tắt đột ngột' },
|
||||
{ value: 'multi_monitor', label: 'Nhiều màn hình' },
|
||||
{ value: 'user_switch', label: 'Đổi user' },
|
||||
{ value: 'session_change', label: 'Khóa / đổi phiên' },
|
||||
{ value: 'virtual_desktop', label: 'Desktop ảo' },
|
||||
{ value: 'wifi', label: 'WiFi trái phép' },
|
||||
{ value: 'guard', label: 'Vi phạm môi trường (cũ)' },
|
||||
] as const;
|
||||
|
||||
export const api = {
|
||||
getStats: async (): Promise<StatsResponse> => {
|
||||
const res = await staffFetch('/stats');
|
||||
@@ -716,6 +741,30 @@ export const apiFetchClassSessionLogs = async (
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export const apiFetchClassViolations = async (
|
||||
rkId: number,
|
||||
date: string,
|
||||
kind = ''
|
||||
): Promise<{ data: StudentViolationItem[]; date: string }> => {
|
||||
const params = new URLSearchParams({ date });
|
||||
if (kind) params.set('kind', kind);
|
||||
const res = await staffFetch(`/classes/${rkId}/violations?${params}`);
|
||||
if (!res.ok) throw new Error('Failed to fetch class violations');
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export const apiFetchExamViolations = async (
|
||||
examId: number,
|
||||
date: string,
|
||||
kind = ''
|
||||
): Promise<{ data: StudentViolationItem[]; date: string }> => {
|
||||
const params = new URLSearchParams({ date });
|
||||
if (kind) params.set('kind', kind);
|
||||
const res = await staffFetch(`/exam-rooms/${examId}/violations?${params}`);
|
||||
if (!res.ok) throw new Error('Failed to fetch exam violations');
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export const apiFetchOnlineStudents = async (rkId: number): Promise<{ onlineStudentIds: number[] }> => {
|
||||
const res = await staffFetch(`/classes/${rkId}/online-students`);
|
||||
if (!res.ok) throw new Error('Failed to fetch online students list');
|
||||
|
||||
Reference in New Issue
Block a user