This PR resolves 4 enhancement issues:
- Implemented API versioning interceptor that adds
X-API-Versionresponse header - Added
Deprecationheader for v1 withLinkheader pointing to v2 successor - Updated Swagger config to support
x-api-versionheader for API version negotiation
- Added
pageandlimitquery parameters toGET /api/v1/productsendpoint - Updated
getActiveProductsservice method to support Prisma-based pagination withtake/skip - Claims list endpoints (
getClaimsByWalletQuery,getClaimHistory) already had pagination
- Added claim-specific rate limiting (
limit: 5/60s) toPOST /api/v1/claimsendpoint - Uses
@Throttledecorator with stricter limits than global throttler (60/60s)
- Created
WebhooksServicewith register/unregister/list and status notification methods - Created
WebhooksControllerwithPOST /api/v1/webhooks/registerandGET /api/v1/webhooksendpoints - Policy status changes (e.g., cancel) trigger webhooks with
policy.status.changeevent - Claim status changes (e.g., PROCESSING → FAILED, PROCESSING → CLAIMED) trigger webhooks with
claim.status.changeevent
This PR closes the following issues using GitHub keyword syntax:
- Closes #375 - API versioning strategy
- Closes #373 - No pagination on policy and claims list endpoints
- Closes #372 - No rate limiting on claim submission endpoint
- Closes #374 - No webhook support for policy/claim status changes
- All endpoints return proper pagination metadata (
{ success, data, total, page, limit }) - Rate limiting prevents claim submission spam beyond 5 attempts per 60 seconds
- Webhooks can be registered with specific events (
policy.status.change,claim.status.change) - API versioning headers are present on all responses