Files
full_encoach_platform/frontend/src/services/notification.service.ts
Yamen Ahmad f1c4953a63 feat(v3): restructure project + add complete frontend
- Restructure: move backend from new_project/ to backend/
- Add full React/TypeScript frontend (37 pages, 17 services, 16 type defs, 11 query hooks)
- Add docs/ with SRS specs, user stories, and workflow documentation
- Update .gitignore for new directory layout

Workflows implemented:
  WF1 User Signup, WF2 Placement Test, WF3 Exam Configuration,
  WF4 General English Exam, WF5 Course Generation,
  WF6 Entity Student Onboarding, AI Course Generation,
  Adaptive Learning Engine UI, White-Label Branding, Score Release

Made-with: Cursor
2026-04-10 17:26:42 +04:00

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);
},
};