fix
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export const endpoints = {
|
||||
// ─── Auth & profile ────────────────────────────────────────────────────────
|
||||
register: '/register',
|
||||
resendVerificationCodeForRegister: '/resend-verification-code',
|
||||
verifyCode: '/verify-code',
|
||||
@@ -10,13 +11,14 @@ export const endpoints = {
|
||||
verifyForgotPasswordCode: '/verify-forgot-password-code',
|
||||
resetPassword: '/reset-password',
|
||||
logout: '/logout',
|
||||
uploadMedia: '/media',
|
||||
me: '/auth/me',
|
||||
updateProfile: '/profile',
|
||||
|
||||
// ─── Geo ───────────────────────────────────────────────────────────────────
|
||||
provinceList: '/provinces',
|
||||
citiesList: '/provinces/:provinceId/cities',
|
||||
|
||||
me: '/auth/me',
|
||||
updateProfile: '/profile',
|
||||
// ─── Student-facing ────────────────────────────────────────────────────────
|
||||
getStudentCourses: '/student/courses',
|
||||
showStudentCourse: '/student/courses/:id',
|
||||
getStudentTerms: '/student/terms',
|
||||
@@ -45,12 +47,12 @@ export const endpoints = {
|
||||
getStudentCertificates: '/student/certificates',
|
||||
downloadStudentCertificate: '/student/certificates/:id/download',
|
||||
|
||||
// ─── Admin: users (out of scope of the Terms/Courses backend doc) ──────────
|
||||
getPendingStudents: '/admin/pending-students',
|
||||
showPendingStudent: '/admin/pending-students/:id',
|
||||
changeStatusPendingStudent: '/admin/pending-students/:id/status',
|
||||
downloadPdfPendingStudentInfo: '/admin/pending-students/:id/pdf',
|
||||
getApprovedUsers: '/admin/users',
|
||||
|
||||
showUserDetails: '/admin/users/:id',
|
||||
addNewUser: '/admin/users',
|
||||
updateUser: '/admin/users/:id',
|
||||
@@ -59,63 +61,92 @@ export const endpoints = {
|
||||
changeUserStatus: '/admin/users/:id/status',
|
||||
deleteUser: '/admin/users/:id',
|
||||
|
||||
// ─── Backend-aligned: Terms ────────────────────────────────────────────────
|
||||
getTermsList: '/terms',
|
||||
addNewTerm: '/terms',
|
||||
showTerm: '/terms/:id',
|
||||
updateTerm: '/terms/:id',
|
||||
deleteTerm: '/terms/:id',
|
||||
cloneTerm: '/admin/terms/:id/clone',
|
||||
changeStatusTerm: '/admin/terms/:id/status',
|
||||
|
||||
listUserTerm: '/admin/terms/:termId/students',
|
||||
addUserTerm: '/admin/terms/:termId/students',
|
||||
removeUserTerm: '/admin/terms/:termId/students/:userId',
|
||||
changeLeaveStatus: '/admin/terms/:termId/students/:userId/toggle-leave',
|
||||
|
||||
listCourseTerm: '/admin/terms/:termId/courses',
|
||||
addCourseTerm: '/admin/terms/:termId/courses',
|
||||
removeCourseTerm: '/admin/terms/:termId/courses/:courseId',
|
||||
|
||||
// ─── Backend-aligned: Courses ──────────────────────────────────────────────
|
||||
getCoursesList: '/courses',
|
||||
addNewCourse: '/courses',
|
||||
showCourse: '/courses/:id',
|
||||
updateCourse: '/courses/:id',
|
||||
deleteCourse: '/courses/:id',
|
||||
changeStatusCourse: '/admin/courses/:id/toggle-status',
|
||||
|
||||
getCourseTemplatesList: '/admin/courses',
|
||||
addNewCourseTemplate: '/admin/courses',
|
||||
showCourseTemplate: '/admin/courses/:id',
|
||||
updateCourseTemplate: '/admin/courses/:id',
|
||||
deleteCourseTemplate: '/admin/courses/:id',
|
||||
changeStatusCourseTemplate: '/admin/course-templates/:id/status',
|
||||
|
||||
listTemplateStudents: '/admin/course-templates/:templateId/students',
|
||||
addTemplateStudent: '/admin/course-templates/:templateId/students',
|
||||
removeTemplateStudent: '/admin/course-templates/:templateId/students/:userId',
|
||||
|
||||
listTemplateSessions: '/admin/course-templates/:templateId/sessions',
|
||||
attachTemplateSession: '/admin/course-templates/:templateId/sessions',
|
||||
detachTemplateSession: '/admin/course-templates/:templateId/sessions/:sessionId',
|
||||
|
||||
// ─── Backend-aligned: Sessions ─────────────────────────────────────────────
|
||||
getSessionsList: '/sessions',
|
||||
addNewSession: '/sessions',
|
||||
showSession: '/sessions/:id',
|
||||
updateSession: '/sessions/:id',
|
||||
deleteSession: '/sessions/:id',
|
||||
changeStatusSession: '/admin/sessions/:id/toggle-status',
|
||||
|
||||
// ─── Backend-aligned: Exams ────────────────────────────────────────────────
|
||||
// `getExamsList` is not yet in the backend Postman doc, but per the user
|
||||
// the backend will add it at /exams — wired up now so the FE doesn't need
|
||||
// to change when the endpoint lands.
|
||||
getExamsList: '/exams',
|
||||
showExam: '/exams/:id',
|
||||
addNewExam: '/exams',
|
||||
updateExam: '/exams/:id',
|
||||
deleteExam: '/exams/:id',
|
||||
addExamQuestion: '/exams/:examId/questions',
|
||||
addQuestionOption: '/questions/:questionId/options',
|
||||
submitExam: '/exams/:examId/submit',
|
||||
|
||||
// ─── Backend-aligned: Homeworks (FE calls them "assignments") ──────────────
|
||||
addNewAssignment: '/homeworks',
|
||||
updateAssignment: '/homeworks/:id',
|
||||
deleteAssignment: '/homeworks/:id',
|
||||
submitHomework: '/homeworks/:homeworkId/submit',
|
||||
reviewAssignmentSubmission: '/homework-submissions/:submissionId/review',
|
||||
|
||||
// ─── Backend-aligned: Media ────────────────────────────────────────────────
|
||||
uploadMedia: '/media',
|
||||
downloadMedia: '/media/:id/download',
|
||||
deleteMedia: '/media/:id',
|
||||
|
||||
// ─── FE mock-only — NOT in backend Postman doc ─────────────────────────────
|
||||
// Kept so existing UI screens continue to work against the mock layer.
|
||||
// See docs/backend-vs-ui-gaps.md for the list of decisions pending.
|
||||
|
||||
// Terms — clone + status + students-in-term + courses-in-term
|
||||
cloneTerm: '/admin/terms/:id/clone',
|
||||
listUserTerm: '/admin/terms/:termId/students',
|
||||
addUserTerm: '/admin/terms/:termId/students',
|
||||
removeUserTerm: '/admin/terms/:termId/students/:userId',
|
||||
changeLeaveStatus: '/admin/terms/:termId/students/:userId/toggle-leave',
|
||||
listCourseTerm: '/admin/terms/:termId/courses',
|
||||
addCourseTerm: '/admin/terms/:termId/courses',
|
||||
removeCourseTerm: '/admin/terms/:termId/courses/:courseId',
|
||||
|
||||
// Courses — students-in-course + attach/detach sessions (backend uses 1:N via session.course_id)
|
||||
listCourseStudents: '/admin/courses/:courseId/students',
|
||||
addCourseStudent: '/admin/courses/:courseId/students',
|
||||
removeCourseStudent: '/admin/courses/:courseId/students/:userId',
|
||||
listCourseSessions: '/admin/courses/:courseId/sessions',
|
||||
attachCourseSession: '/admin/courses/:courseId/sessions',
|
||||
detachCourseSession: '/admin/courses/:courseId/sessions/:sessionId',
|
||||
|
||||
// Sessions — attendance roster
|
||||
getSessionsAttendance: '/admin/sessions/:sessionId/attendances',
|
||||
|
||||
getAssignmentsList: '/admin/assignments',
|
||||
addNewAssignment: '/admin/assignments',
|
||||
showAssignment: '/admin/assignments/:id',
|
||||
updateAssignment: '/admin/assignments/:id',
|
||||
deleteAssignment: '/admin/assignments/:id',
|
||||
getAssignmentSubmissions: '/admin/assignments/:assignmentId/submissions',
|
||||
showAssignmentSubmission: '/admin/assignments/:assignmentId/submissions/:submissionId',
|
||||
reviewAssignmentSubmission: '/admin/assignments/:assignmentId/submissions/:submissionId/review',
|
||||
// Exams — participants only (backend has /exams/:id but no participants endpoints)
|
||||
getExamParticipants: '/admin/exams/:examId/participants',
|
||||
showExamParticipant: '/admin/exams/:examId/participants/:participantId',
|
||||
|
||||
// Homeworks — list, show, submissions list, show submission
|
||||
// Paths aligned to backend `/homeworks` and `/homework-submissions`. The
|
||||
// backend Postman doc currently exposes only create/update/delete/submit/review;
|
||||
// list + show + submissions list + show-submission stay mock-only until backend
|
||||
// adds them, but URL shape is locked in.
|
||||
getAssignmentsList: '/homeworks',
|
||||
showAssignment: '/homeworks/:id',
|
||||
getAssignmentSubmissions: '/homeworks/:homeworkId/submissions',
|
||||
showAssignmentSubmission: '/homework-submissions/:submissionId',
|
||||
|
||||
// ─── Tickets / Consultations (out of scope of Terms/Courses backend doc) ───
|
||||
getTicketsList: '/admin/tickets',
|
||||
showTicket: '/admin/tickets/:id',
|
||||
sendTicketMessage: '/admin/tickets/:id/messages',
|
||||
@@ -125,14 +156,6 @@ export const endpoints = {
|
||||
showConsultation: '/admin/consultations/:id',
|
||||
sendConsultationMessage: '/admin/consultations/:id/messages',
|
||||
changeConsultationStatus: '/admin/consultations/:id/status',
|
||||
|
||||
getExamsList: '/admin/exams',
|
||||
addNewExam: '/admin/exams',
|
||||
showExam: '/admin/exams/:id',
|
||||
updateExam: '/admin/exams/:id',
|
||||
deleteExam: '/admin/exams/:id',
|
||||
getExamParticipants: '/admin/exams/:examId/participants',
|
||||
showExamParticipant: '/admin/exams/:examId/participants/:participantId',
|
||||
}
|
||||
|
||||
export const buildUrl = (template, params = {}) =>
|
||||
|
||||
Reference in New Issue
Block a user