This commit is contained in:
sajjadtalkhabi
2026-05-15 17:12:51 +03:30
parent b8ced45375
commit c82701888a
101 changed files with 8125 additions and 96 deletions
+21
View File
@@ -0,0 +1,21 @@
import { register } from '@/services/mock/registry'
import { endpoints } from '@/services/api/endpoints'
import { findOrThrow, paginate } from '@/services/mock/helpers'
import { studentTerms } from '@/services/mock/fixtures/student-terms'
const CURRENT_STATUSES = new Set(['watching', 'waitForExam'])
const ENDED_STATUSES = new Set(['completed', 'failed'])
register('GET', endpoints.getStudentTerms, ({ query }) => {
let list = [...studentTerms]
if (query.status === 'current') {
list = list.filter((t) => CURRENT_STATUSES.has(t.status))
} else if (query.status === 'ended') {
list = list.filter((t) => ENDED_STATUSES.has(t.status))
}
return paginate(list, query)
})
register('GET', endpoints.showStudentTerm, ({ params }) => ({
data: findOrThrow(studentTerms, params.id),
}))