All files / src/lib/api-docs/endpoints notifications.ts

100% Statements 56/56
100% Branches 0/0
100% Functions 0/0
100% Lines 56/56

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 571x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Notifications Endpoints
 * User notification management
 */
 
import type { ApiEndpoint } from '@/types/api-docs';
 
export const notificationsEndpoints: ApiEndpoint[] = [
  {
    id: 'notifications-list',
    method: 'GET',
    path: '/api/notifications',
    summary: 'List notifications',
    description: 'Returns user notifications with pagination',
    category: 'notifications',
    requiresAuth: true,
    parameters: [
      { name: 'unreadOnly', type: 'boolean', required: false, location: 'query', description: 'Filter unread only' },
      { name: 'type', type: 'string', required: false, location: 'query', description: 'Filter by type', enum: ['order', 'promotion', 'system', 'support'] },
      { name: 'page', type: 'number', required: false, location: 'query', description: 'Page number' },
      { name: 'limit', type: 'number', required: false, location: 'query', description: 'Items per page' },
    ],
    responses: [
      { status: 200, description: 'List of notifications', example: { success: true, data: { notifications: [], unreadCount: 5, total: 25 } } },
      { status: 401, description: 'Authentication required' },
    ],
  },
  {
    id: 'notifications-mark-read',
    method: 'PATCH',
    path: '/api/notifications/{id}/read',
    summary: 'Mark notification as read',
    description: 'Marks a specific notification as read',
    category: 'notifications',
    requiresAuth: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Notification ID' },
    ],
    responses: [
      { status: 200, description: 'Notification marked as read' },
      { status: 404, description: 'Notification not found' },
    ],
  },
  {
    id: 'notifications-mark-all-read',
    method: 'PATCH',
    path: '/api/notifications/read-all',
    summary: 'Mark all as read',
    description: 'Marks all notifications as read',
    category: 'notifications',
    requiresAuth: true,
    responses: [
      { status: 200, description: 'All notifications marked as read', example: { success: true, data: { updated: 15 } } },
    ],
  },
];