Roadmap P0
- Ship /logo.svg fallback and rewire asset references (superseded later by
the project-manager PNG in a separate commit).
Roadmap P1
- Response envelope alignment ({items,total,page,size}) across services
and query hooks.
- Approval/ticket UX updates tied to the new backend rollback semantics.
Roadmap P2
- React.lazy + Vite manualChunks to split vendor-radix/charts/icons/forms
from the main bundle and cut initial JS.
- Fix the 181 tsc errors (PaginationParams class + per-service generics).
- Auto-refresh flow for JWT refresh tokens wired into api-client.ts.
Roadmap P3
- i18n: i18next + language detector, en/ar locales, RTL auto-switch,
LanguageToggle component in RoleLayout and AdminLmsLayout.
- GDPR: PrivacyCenter page for data export and right-to-erasure, backed
by gdpr.service.ts; logout via AuthContext after erasure.
- Human-in-the-loop exam review UI: admin ExamReviewQueue + ExamReviewDetail
pages, useExamReview hooks, exam-review.service.ts.
- AI quality loop: AIPromptEditor (versioning + render preview),
AIFeedbackButtons for students, AIFeedbackTriage admin page, dedicated
services, hooks, and types.
- Dark mode: ThemeProvider + ThemeToggle + chart color tokens.
- Accessibility: DialogDescription on every DialogContent; alert-dialog
and sheet updates.
- Retire dead pages: ExamPage marketing, Index, ProfilePage import.
- Playwright e2e scaffolding: playwright.config.ts + e2e/login.spec.ts
smoke tests, npm scripts test:e2e / test:e2e:install.
Made-with: Cursor
82 lines
3.1 KiB
TypeScript
82 lines
3.1 KiB
TypeScript
import { api } from "@/lib/api-client";
|
|
import type { Subject, Domain, Topic, LearningObjective, TaxonomyTree, PaginatedResponse, PaginationParams, ApiSuccessResponse } from "@/types";
|
|
|
|
export const taxonomyService = {
|
|
async listSubjects(): Promise<Subject[]> {
|
|
const res = await api.get<Record<string, unknown>>("/subjects");
|
|
if (Array.isArray(res)) return res;
|
|
const r = res as { data?: Subject[]; items?: Subject[]; subjects?: Subject[] };
|
|
return r.data ?? r.items ?? r.subjects ?? [];
|
|
},
|
|
|
|
async getSubject(id: number): Promise<Subject> {
|
|
const res = await api.get<{ data: Subject } | Subject>(`/subjects/${id}`);
|
|
const wrapped = res as { data?: Subject };
|
|
return (wrapped.data ?? (res as Subject));
|
|
},
|
|
|
|
async createSubject(data: Partial<Subject>): Promise<Subject> {
|
|
return api.post<Subject>("/subjects", data);
|
|
},
|
|
|
|
async updateSubject(id: number, data: Partial<Subject>): Promise<Subject> {
|
|
return api.patch<Subject>(`/subjects/${id}`, data);
|
|
},
|
|
|
|
async deleteSubject(id: number): Promise<ApiSuccessResponse> {
|
|
return api.delete<ApiSuccessResponse>(`/subjects/${id}`);
|
|
},
|
|
|
|
async getTaxonomyTree(subjectId: number): Promise<TaxonomyTree> {
|
|
const res = await api.get<{ data: TaxonomyTree } | TaxonomyTree>(`/subjects/${subjectId}/taxonomy`);
|
|
const wrapped = res as { data?: TaxonomyTree };
|
|
return (wrapped.data ?? (res as TaxonomyTree));
|
|
},
|
|
|
|
async importTaxonomy(subjectId: number, data: FormData): Promise<ApiSuccessResponse> {
|
|
return api.upload<ApiSuccessResponse>(`/subjects/${subjectId}/taxonomy/import`, data);
|
|
},
|
|
|
|
async listDomains(params?: { subject_id?: number }): Promise<Domain[]> {
|
|
const res = await api.get<Record<string, unknown>>("/domains", params as Record<string, string | number | boolean | undefined>);
|
|
if (Array.isArray(res)) return res;
|
|
const r = res as { data?: Domain[]; items?: Domain[] };
|
|
return r.data ?? r.items ?? [];
|
|
},
|
|
|
|
async createDomain(data: Partial<Domain>): Promise<Domain> {
|
|
return api.post<Domain>("/domains", data);
|
|
},
|
|
|
|
async updateDomain(id: number, data: Partial<Domain>): Promise<Domain> {
|
|
return api.patch<Domain>(`/domains/${id}`, data);
|
|
},
|
|
|
|
async deleteDomain(id: number): Promise<ApiSuccessResponse> {
|
|
return api.delete<ApiSuccessResponse>(`/domains/${id}`);
|
|
},
|
|
|
|
async aiSuggestTopics(domainId: number): Promise<{ suggestions: Partial<Topic>[] }> {
|
|
return api.post(`/domains/${domainId}/ai-suggest`);
|
|
},
|
|
|
|
async listTopics(params?: { domain_id?: number; subject_id?: number }): Promise<Topic[]> {
|
|
const res = await api.get<Record<string, unknown>>("/topics", params as Record<string, string | number | boolean | undefined>);
|
|
if (Array.isArray(res)) return res;
|
|
const r = res as { data?: Topic[]; items?: Topic[] };
|
|
return r.data ?? r.items ?? [];
|
|
},
|
|
|
|
async createTopic(data: Partial<Topic>): Promise<Topic> {
|
|
return api.post<Topic>("/topics", data);
|
|
},
|
|
|
|
async updateTopic(id: number, data: Partial<Topic>): Promise<Topic> {
|
|
return api.patch<Topic>(`/topics/${id}`, data);
|
|
},
|
|
|
|
async deleteTopic(id: number): Promise<ApiSuccessResponse> {
|
|
return api.delete<ApiSuccessResponse>(`/topics/${id}`);
|
|
},
|
|
};
|