All files / src/lib/api-docs/endpoints user-loyalty.ts

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

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 371x 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  
/**
 * User Loyalty Endpoints
 * User loyalty points, tiers, and rewards endpoints
 */
 
import type { ApiEndpoint } from '@/types/api-docs';
 
export const userLoyaltyEndpoints: ApiEndpoint[] = [
  {
    id: 'user-loyalty-get',
    method: 'GET',
    path: '/api/user/loyalty',
    summary: 'Get user loyalty information',
    description: "Get current user's loyalty program status, points, tier, and transaction history",
    category: 'user-loyalty',
    requiresAuth: true,
    responses: [
      {
        status: 200,
        description: 'Loyalty information including points, tier, progress, and transactions',
        example: {
          success: true,
          data: {
            enrolled: true,
            program: { id: 1, name: 'Rewards', pointsPerDollar: 10, redemptionRate: 0.01 },
            points: { current: 500, lifetime: 1200, value: 5.00 },
            tier: { id: 1, name: 'Silver', minPoints: 0, pointsMultiplier: 1.0 },
            nextTier: { id: 2, name: 'Gold', minPoints: 1000, pointsToReach: 800, progressPercent: 20 },
            transactions: [],
          },
        },
      },
      { status: 401, description: 'Unauthorized' },
    ],
  },
];