Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | 102x 102x 102x 102x 7x 30x 6x 5x 29x 4x 4x 4x 38x 4x 4x 4x 4x 4x 4x 9x 4x 21x 14x 4x 4x 4x 4x 4x 4x 6x 6x 6x 4x 4x 4x 9x 4x 6x 4x 4x 12x 4x 4x 4x 48x 4x 12x 52x 4x 6x 3x 3x 3x 3x | /**
* API Endpoints
*
* Centralized source of truth for all API endpoint paths.
* Use these constants instead of hardcoding paths in service files.
*
* Usage:
* ```js
* import { API_ENDPOINTS } from '@/api/endpoints'
*
* // Static endpoints
* const url = API_ENDPOINTS.users.find
*
* // Dynamic endpoints with parameters
* const url = API_ENDPOINTS.teacher.class.delete(classUUID)
* ```
*/
const TEACHER_STUDENT_URL = import.meta.env.VITE_TEACHER_STUDENT_API;
const BULK_UPLOAD_URL = import.meta.env.VITE_BULK_UPLOAD_API;
const VERSION = "v1";
export const API_ENDPOINTS = {
// ============================================================================
// SYSTEM ENDPOINTS (Public)
// ============================================================================
system: {
health: `${TEACHER_STUDENT_URL}/${VERSION}/health`,
},
// ============================================================================
// AUTH ENDPOINTS (Public)
// ============================================================================
auth: {
login: `${TEACHER_STUDENT_URL}/${VERSION}/auth/login`,
me: `${TEACHER_STUDENT_URL}/${VERSION}/auth/me`,
refresh: `${TEACHER_STUDENT_URL}/${VERSION}/auth/refresh`,
logout: `${TEACHER_STUDENT_URL}/${VERSION}/auth/logout`,
forgotPassword: `${TEACHER_STUDENT_URL}/${VERSION}/auth/forgot-password`,
},
// ============================================================================
// USERS ENDPOINTS (Shared)
// ============================================================================
users: {
find: `${TEACHER_STUDENT_URL}/${VERSION}/users/find`,
},
// ============================================================================
// TEACHER ENDPOINTS
// ============================================================================
teacher: {
account: {
find: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/find`,
update: (teacherUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/${teacherUUID}/update`,
picture: {
add: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/picture/add`,
update: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/picture/update`,
delete: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/picture/delete`,
},
password: {
update: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/password/update`,
},
theme: {
fetch: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/theme/fetch`,
apply: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/theme/apply`,
update: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/theme/update`,
delete: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/account/theme/delete`,
},
},
class: {
fetchAll: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/all/fetch`,
create: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/create`,
find: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classCode}/find`,
update: (classUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classUUID}/update`,
delete: (classUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classUUID}/delete`,
gradebook: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/gradebook/${classCode}/fetch`,
photo: {
add: (classUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classUUID}/photo/add`,
update: (classUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classUUID}/photo/update`,
delete: (classUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classUUID}/photo/delete`,
},
roster: {
fetch: (classID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/roster/${classID}/fetch`,
},
student: {
accept: (classID, studentID) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classID}/${studentID}/student_accept`,
leaveApproved: (classID, studentID) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classID}/${studentID}/leave_approved`,
remove: (classID, studentID) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/class/${classID}/${studentID}/student_remove`,
},
},
assignment: {
fetchAll: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/all/fetch`,
create: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/create`,
fetch: (assignmentUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${assignmentUUID}/fetch`,
update: (assignmentUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${assignmentUUID}/update`,
delete: (assignmentUUID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${assignmentUUID}/delete`,
// Per-assignment question point override — edits assignments_collection
// only, never the shared question document in teacher_questionbank.
updateQuestionPoints: (assignmentUUID, questionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${assignmentUUID}/question/${questionId}/points/update`,
staffAssignmentsFetchAll: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/staff/assignments/all/fetch`,
staffAssignmentsFetch: (assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/staff/assignments/${assignmentId}/fetch`,
staffAssignmentsCreate: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/staff/assignments/create`,
analytics: {
itemAnalysis: (classCode, assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/item_analysis/fetch`,
summary: (classCode, assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/summary/fetch`,
// Similar response shape to student.assignment.submission(assignmentId) —
// { data: { details: [...], studentAnswers: [...], studentScore, totalScore, totalCorrectAnswers, ... } }
// NOTE: field names diverge from the student endpoint here — this endpoint's
// `studentScore` (earned) / `totalScore` (max possible) are that endpoint's
// `totalScore` (earned) / `totalPoints` (max possible), respectively.
// scoped to an arbitrary student in the class instead of the logged-in user.
studentSubmission: (classCode, assignmentId, studentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/student-submission/${studentId}/fetch`,
addStudentAnswerComment: (classCode, assignmentId, studentId, questionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/student-submission/${studentId}/comment/${questionId}/add`,
updateStudentAnswerComment: (classCode, assignmentId, studentId, questionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/student-submission/${studentId}/comment/${questionId}/update`,
deleteStudentAnswerComment: (classCode, assignmentId, studentId, questionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/student-submission/${studentId}/comment/${questionId}/delete`,
// Hand-marking ONE student's written answer. Distinct from
// updateQuestionPoints above, which changes what a question is worth for
// every student in the assignment — this awards what this student earned.
markStudentAnswer: (classCode, assignmentId, studentId, questionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${classCode}/${assignmentId}/analytics/student-submission/${studentId}/mark/${questionId}`,
},
// EI-1210 — late-submission teacher-approval endpoints
latePendingFetch: (assignmentUuid) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/${assignmentUuid}/late-submissions/pending/fetch`,
approveLateSubmission: (submissionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/late-submission/${submissionId}/approve`,
rejectLateSubmission: (submissionId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/assignment/late-submission/${submissionId}/reject`,
},
question: {
fetchAll: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/all/fetch`,
fetchStaff: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/staff/questions/all/fetch`,
create: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/create`,
update: (questionID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/${questionID}/update`,
delete: (questionID) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/${questionID}/delete`,
imageUpload: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/image/upload`,
// Bulk import. The frontend talks only to the TS API — it must never call
// the ingest service directly, unlike the bulkUpload.users.* endpoints.
import: {
upload: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/import/upload`,
text: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/import/text`,
status: (jobId) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/import/${jobId}/status`,
questions: (jobId) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/import/${jobId}/questions`,
commit: (jobId) => `${TEACHER_STUDENT_URL}/${VERSION}/teacher/question/import/${jobId}/commit`,
},
},
dashboard: {
classStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/dashboard/class/statistics/fetch`,
assignmentsStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/dashboard/assignments/statistics/fetch`,
studentsStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/dashboard/students/statistics/fetch`,
submissionsStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/dashboard/submissions/statistics/fetch`,
},
students: {
create: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/students/create`,
},
features: {
effective: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/effective`,
teacherMadeAssignmentsQuota: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/teacher-made-assignments/quota`,
organization: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/organization`,
school: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/school`,
districtPlan: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/district/plan`,
districtFeatures: `${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/district/features`,
featureStatus: (featureName) =>
`${TEACHER_STUDENT_URL}/${VERSION}/teacher/features/district/features/${featureName}/status`,
},
},
// ============================================================================
// STUDENT ENDPOINTS
// ============================================================================
student: {
account: {
fetch: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/fetch`,
teacherFind: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/teacher_find`,
picture: {
add: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/picture/add`,
update: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/picture/update`,
// Added by Allan Ninal — 2026-09-24 (EI-T81). The backend has had
// DELETE /v1/student/account/picture/delete all along; only the
// teacher side declared it here, which is why a student had no way
// to remove their photo.
delete: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/picture/delete`,
},
password: {
update: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/password/update`,
},
theme: {
fetch: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/theme/fetch`,
apply: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/theme/apply`,
update: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/theme/update`,
delete: `${TEACHER_STUDENT_URL}/${VERSION}/student/account/theme/delete`,
},
},
class: {
fetchAll: `${TEACHER_STUDENT_URL}/${VERSION}/student/classes/all/fetch`,
fetch: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/student/classes/${classCode}/fetch`,
join: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/student/classes/${classCode}/join`,
leave: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/student/classes/${classCode}/leave`,
},
assignment: {
fetchAll: (classCode) => `${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${classCode}/all/fetch`,
fetch: (assignmentId) => `${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${assignmentId}/fetch`,
questions: (assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${assignmentId}/questions/fetch`,
submission: (assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${assignmentId}/submission/fetch`,
gradeAverage: (classCode) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${classCode}/grade/average/fetch`,
saveAnswers: (assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${assignmentId}/answers/save`,
submitAnswers: (assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${assignmentId}/answers/submit`,
reportViolation: (assignmentId) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/assignment/${assignmentId}/violations`,
},
features: {
effective: `${TEACHER_STUDENT_URL}/${VERSION}/student/features/effective`,
organization: `${TEACHER_STUDENT_URL}/${VERSION}/student/features/organization`,
school: `${TEACHER_STUDENT_URL}/${VERSION}/student/features/school`,
districtPlan: `${TEACHER_STUDENT_URL}/${VERSION}/student/features/district/plan`,
districtFeatures: `${TEACHER_STUDENT_URL}/${VERSION}/student/features/district/features`,
featureStatus: (featureName) =>
`${TEACHER_STUDENT_URL}/${VERSION}/student/features/district/features/${featureName}/status`,
},
dashboard: {
classesStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/classes/statistics/fetch`,
assignmentsStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/assignments/statistics/fetch`,
submissionsStatistics: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/submissions/statistics/fetch`,
upcomingAssignments: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/assignments/upcoming/fetch`,
gpa: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/gpa/fetch`,
gradeDistribution: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/grade-distribution/fetch`,
achievements: `${TEACHER_STUDENT_URL}/${VERSION}/student/dashboard/achievements/fetch`,
},
},
// ============================================================================
// BULK UPLOAD / INVITATION ENDPOINTS (live: client.bulk-users-eruditiontx.com; local dev: :5050)
// ============================================================================
bulkUpload: {
users: {
fetchAll: `${BULK_UPLOAD_URL}/users/all/fetch`,
create: `${BULK_UPLOAD_URL}/users/single/create`,
bulkCreate: `${BULK_UPLOAD_URL}/users/bulk/create`,
fetch: (email) => `${BULK_UPLOAD_URL}/users/${email}/fetch`,
update: (email) => `${BULK_UPLOAD_URL}/users/${email}/update`,
delete: (email) => `${BULK_UPLOAD_URL}/users/${email}/delete`,
resendInvitation: (email) => `${BULK_UPLOAD_URL}/users/${email}/resend-invitation`,
bulkResendInvitation: `${BULK_UPLOAD_URL}/users/bulk-resend-invitation`,
},
},
};
|