Add 4 new Odoo modules coverage: - encoach_courseware: chapters, materials, chapter progress, AI workbench - encoach_communication: discussion boards, announcements, messaging - encoach_notification: notification engine, rules, preferences - encoach_faq: FAQ categories and items, role-filtered Frontend changes: - 4 new type files (courseware, communication, notification, faq) - 5 new service files (courseware, communication, notification, faq, plagiarism) - 4 new hook files (useCourseware, useCommunication, useNotifications, useFaq) - 15 new page components (teacher: chapters, chapter detail, AI workbench, discussions, announcements; student: chapter view, discussions, announcements, messages, journey; admin: FAQ manager, notification rules, approval config; public: official exam access, FAQ page) - Updated App.tsx routing with all new pages - Updated TeacherLayout, StudentLayout, AdminLmsLayout sidebars SRS updates: - ENCOACH_UNIFIED_SRS.md: added Parts IX-XI (Courseware, Communication, Notifications/FAQ), enhanced exam management (exercise vs exam, official access modes), enhanced approval workflows (timed stages, escalation, bypass), enhanced assignments (late submissions, extensions), plagiarism detection. Total modules: 35 - ENCOACH_ODOO19_BACKEND_SRS.md v2.0: added sections 26-31, updated module inventory to 35, updated endpoint count to 280+, added enhanced assignment models with late submission/extension support Made-with: Cursor
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
import { api } from "@/lib/api-client";
|
|
import type {
|
|
Notification,
|
|
NotificationRule,
|
|
NotificationPreferences,
|
|
NotificationRuleCreateRequest,
|
|
} from "@/types/notification";
|
|
import type { ApiSuccessResponse, PaginatedResponse, PaginationParams } from "@/types";
|
|
|
|
export const notificationService = {
|
|
async listNotifications(
|
|
params?: PaginationParams & { type?: string; is_read?: boolean },
|
|
): Promise<PaginatedResponse<Notification>> {
|
|
return api.get<PaginatedResponse<Notification>>(
|
|
"/notifications",
|
|
params as Record<string, string | number | boolean | undefined>,
|
|
);
|
|
},
|
|
|
|
async markNotificationRead(id: number): Promise<Notification> {
|
|
return api.post<Notification>(`/notifications/${id}/read`);
|
|
},
|
|
|
|
async markAllNotificationsRead(): Promise<ApiSuccessResponse> {
|
|
return api.post<ApiSuccessResponse>("/notifications/read-all");
|
|
},
|
|
|
|
async getUnreadNotificationCount(): Promise<{ count: number }> {
|
|
return api.get<{ count: number }>("/notifications/unread-count");
|
|
},
|
|
|
|
async listNotificationRules(): Promise<NotificationRule[]> {
|
|
return api.get<NotificationRule[]>("/notification-rules");
|
|
},
|
|
|
|
async createNotificationRule(data: NotificationRuleCreateRequest): Promise<NotificationRule> {
|
|
return api.post<NotificationRule>("/notification-rules", data);
|
|
},
|
|
|
|
async updateNotificationRule(id: number, data: Partial<NotificationRuleCreateRequest>): Promise<NotificationRule> {
|
|
return api.patch<NotificationRule>(`/notification-rules/${id}`, data);
|
|
},
|
|
|
|
async deleteNotificationRule(id: number): Promise<ApiSuccessResponse> {
|
|
return api.delete<ApiSuccessResponse>(`/notification-rules/${id}`);
|
|
},
|
|
|
|
async getNotificationPreferences(): Promise<NotificationPreferences> {
|
|
return api.get<NotificationPreferences>("/notification-preferences");
|
|
},
|
|
|
|
async updateNotificationPreferences(data: Partial<NotificationPreferences>): Promise<NotificationPreferences> {
|
|
return api.patch<NotificationPreferences>("/notification-preferences", data);
|
|
},
|
|
};
|