mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 11:55:43 +00:00
Adding more functionalities for all the license types
This commit is contained in:
@@ -5,6 +5,12 @@ import type {
|
||||
CreateExamPayload,
|
||||
UpdateExamPayload,
|
||||
AssignQuestionsPayload,
|
||||
RandomQuestionsPayload,
|
||||
ExamRegistration,
|
||||
RecordAttendancePayload,
|
||||
ExamIncident,
|
||||
CreateIncidentPayload,
|
||||
ResolveIncidentPayload,
|
||||
} from '../types/exam';
|
||||
|
||||
const examApi = baseApi.injectEndpoints({
|
||||
@@ -41,6 +47,49 @@ const examApi = baseApi.injectEndpoints({
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
/** Server-side draw from the approved bank (US-EXAM-005). */
|
||||
selectRandomQuestions: builder.mutation<Exam, RandomQuestionsPayload>({
|
||||
query: ({ examId, count }) => ({
|
||||
url: `/exams/${examId}/questions/random`,
|
||||
method: 'POST',
|
||||
body: { count },
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
// --- Candidates and attendance (US-EXAM-007/009) ---------------------
|
||||
getExamRegistrations: builder.query<ExamRegistration[], string>({
|
||||
query: (examId) => `/exams/${examId}/registrations`,
|
||||
providesTags: ['Api'],
|
||||
}),
|
||||
recordAttendance: builder.mutation<ExamRegistration, RecordAttendancePayload>({
|
||||
query: ({ registrationId, ...body }) => ({
|
||||
url: `/exams/registrations/${registrationId}/attendance`,
|
||||
method: 'POST',
|
||||
body,
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
// --- Session incidents (US-EXAM-010) ---------------------------------
|
||||
getExamIncidents: builder.query<ExamIncident[], string>({
|
||||
query: (examId) => `/exams/${examId}/incidents`,
|
||||
providesTags: ['Api'],
|
||||
}),
|
||||
recordIncident: builder.mutation<ExamIncident, CreateIncidentPayload>({
|
||||
query: ({ examId, ...body }) => ({
|
||||
url: `/exams/${examId}/incidents`,
|
||||
method: 'POST',
|
||||
body,
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
resolveIncident: builder.mutation<ExamIncident, ResolveIncidentPayload>({
|
||||
query: ({ incidentId, ...body }) => ({
|
||||
url: `/exams/incidents/${incidentId}/resolve`,
|
||||
method: 'POST',
|
||||
body,
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
}),
|
||||
overrideExisting: false,
|
||||
});
|
||||
@@ -52,4 +101,10 @@ export const {
|
||||
useUpdateExamMutation,
|
||||
useDeleteExamMutation,
|
||||
useAssignQuestionsMutation,
|
||||
useSelectRandomQuestionsMutation,
|
||||
useGetExamRegistrationsQuery,
|
||||
useRecordAttendanceMutation,
|
||||
useGetExamIncidentsQuery,
|
||||
useRecordIncidentMutation,
|
||||
useResolveIncidentMutation,
|
||||
} = examApi;
|
||||
|
||||
Reference in New Issue
Block a user