feat(exam): add mark scheme editor
This commit is contained in:
@@ -13,6 +13,9 @@ import type {
|
||||
CreateTemplatePayload,
|
||||
ExamTemplate,
|
||||
ExamTemplateDetail,
|
||||
Neo4jSyncResult,
|
||||
PatchQuestionPayload,
|
||||
SpecPoint,
|
||||
} from '../../types/exam.types';
|
||||
|
||||
const EXAM_BASE = `${API_BASE}/api/exam`;
|
||||
@@ -51,6 +54,28 @@ export const examRepository = {
|
||||
const headers = await authHeaders();
|
||||
await axios.delete(`${EXAM_BASE}/templates/${templateId}`, { headers });
|
||||
},
|
||||
|
||||
async patchQuestion(questionId: string, payload: PatchQuestionPayload) {
|
||||
const headers = await authHeaders();
|
||||
const res = await axios.patch(`${EXAM_BASE}/questions/${questionId}`, payload, { headers });
|
||||
return res.data;
|
||||
},
|
||||
|
||||
async listSpecPoints(specCode: string, search?: string): Promise<SpecPoint[]> {
|
||||
const headers = await authHeaders();
|
||||
const res = await axios.get<{ points?: SpecPoint[] } | SpecPoint[]>(
|
||||
`${EXAM_BASE}/specs/${encodeURIComponent(specCode)}/points`,
|
||||
{ headers, params: search ? { q: search } : undefined },
|
||||
);
|
||||
if (Array.isArray(res.data)) return res.data;
|
||||
return res.data.points ?? [];
|
||||
},
|
||||
|
||||
async syncTemplateToGraph(templateId: string): Promise<Neo4jSyncResult> {
|
||||
const headers = await authHeaders();
|
||||
const res = await axios.post<Neo4jSyncResult>(`${EXAM_BASE}/templates/${templateId}/neo4j-sync`, {}, { headers });
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
|
||||
export default examRepository;
|
||||
|
||||
Reference in New Issue
Block a user