fix: Add missing /api/v1 prefix to notification endpoints
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

All notification API calls were missing the /api/v1 prefix causing 404 errors.
Fixed all endpoints:
- GET /api/v1/notifications
- PATCH /api/v1/notifications/:id/read
- PATCH /api/v1/notifications/mark-all-read
- PATCH /api/v1/notifications/:id/dismiss

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andrei
2025-10-09 13:44:50 +00:00
parent d7318c0f22
commit 46b2aef979

View File

@@ -44,7 +44,7 @@ export const notificationsApi = {
* Get user notifications with optional filters
*/
async getNotifications(params?: GetNotificationsParams): Promise<GetNotificationsResponse> {
const { data } = await apiClient.get<BackendResponse<{ notifications: Notification[] }>>('/notifications', { params });
const { data } = await apiClient.get<BackendResponse<{ notifications: Notification[] }>>('/api/v1/notifications', { params });
const notifications = data.data.notifications;
const unreadCount = notifications.filter(n => !n.readAt && !n.dismissedAt).length;
@@ -60,7 +60,7 @@ export const notificationsApi = {
* Mark a notification as read
*/
async markAsRead(notificationId: string): Promise<Notification> {
const { data } = await apiClient.patch<BackendResponse<any>>(`/notifications/${notificationId}/read`);
const { data } = await apiClient.patch<BackendResponse<any>>(`/api/v1/notifications/${notificationId}/read`);
// Backend returns success message, not the notification, so we return empty object
return {} as Notification;
},
@@ -69,7 +69,7 @@ export const notificationsApi = {
* Mark all notifications as read
*/
async markAllAsRead(): Promise<{ count: number }> {
await apiClient.patch<BackendResponse<any>>('/notifications/mark-all-read');
await apiClient.patch<BackendResponse<any>>('/api/v1/notifications/mark-all-read');
return { count: 0 }; // Backend doesn't return count
},
@@ -77,7 +77,7 @@ export const notificationsApi = {
* Dismiss a notification
*/
async dismiss(notificationId: string): Promise<Notification> {
await apiClient.patch<BackendResponse<any>>(`/notifications/${notificationId}/dismiss`);
await apiClient.patch<BackendResponse<any>>(`/api/v1/notifications/${notificationId}/dismiss`);
return {} as Notification;
},