- Restructure: move backend from new_project/ to backend/ - Add full React/TypeScript frontend (37 pages, 17 services, 16 type defs, 11 query hooks) - Add docs/ with SRS specs, user stories, and workflow documentation - Update .gitignore for new directory layout Workflows implemented: WF1 User Signup, WF2 Placement Test, WF3 Exam Configuration, WF4 General English Exam, WF5 Course Generation, WF6 Entity Student Onboarding, AI Course Generation, Adaptive Learning Engine UI, White-Label Branding, Score Release Made-with: Cursor
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
import { queryKeys } from "./keys";
|
|
import { adaptiveEngineService } from "@/services/adaptive-engine.service";
|
|
import type { AdaptiveThresholdSettings } from "@/types";
|
|
|
|
export function useAdaptiveDashboard() {
|
|
return useQuery({
|
|
queryKey: queryKeys.adaptiveEngine.dashboard,
|
|
queryFn: () => adaptiveEngineService.getDashboard(),
|
|
});
|
|
}
|
|
|
|
export function useAdaptiveStudents(params?: { page?: number; limit?: number }) {
|
|
return useQuery({
|
|
queryKey: queryKeys.adaptiveEngine.students(params as Record<string, unknown> | undefined),
|
|
queryFn: () => adaptiveEngineService.getStudents(params),
|
|
});
|
|
}
|
|
|
|
export function useStudentSignals(studentId: number | undefined) {
|
|
return useQuery({
|
|
queryKey: queryKeys.adaptiveEngine.signals(studentId ?? 0),
|
|
queryFn: () => adaptiveEngineService.getStudentSignals(studentId!),
|
|
enabled: !!studentId && studentId > 0,
|
|
});
|
|
}
|
|
|
|
export function useStudentAbility(studentId: number | undefined) {
|
|
return useQuery({
|
|
queryKey: queryKeys.adaptiveEngine.ability(studentId ?? 0),
|
|
queryFn: () => adaptiveEngineService.getStudentAbility(studentId!),
|
|
enabled: !!studentId && studentId > 0,
|
|
});
|
|
}
|
|
|
|
export function useAdaptiveSettings() {
|
|
return useQuery({
|
|
queryKey: queryKeys.adaptiveEngine.settings,
|
|
queryFn: () => adaptiveEngineService.getSettings(),
|
|
});
|
|
}
|
|
|
|
export function useUpdateAdaptiveSettings() {
|
|
const qc = useQueryClient();
|
|
return useMutation({
|
|
mutationFn: (data: AdaptiveThresholdSettings) => adaptiveEngineService.updateSettings(data),
|
|
onSuccess: () => {
|
|
qc.invalidateQueries({ queryKey: queryKeys.adaptiveEngine.settings });
|
|
},
|
|
});
|
|
}
|