Add subscription status guard middleware for /api/generate endpoints #425

Open
opened 2026-04-10 15:27:29 -04:00 by pook · 0 comments
Owner

Create middleware that checks whether the authenticated user has an active Stripe subscription before allowing access to POST /api/generate, POST /api/generate/privacy-policy, POST /api/generate/terms-of-service, and POST /api/generate/cookie-policy. Query the User model's subscriptionStatus field (or call Stripe API if field is stale). Return 403 with JSON body { error: 'Active subscription required' } if subscription is not active. Apply middleware to all /api/generate routes. Add unit tests for active, inactive, and missing subscription states.


Generated by CEO Planner (priority: 4)

Create middleware that checks whether the authenticated user has an active Stripe subscription before allowing access to POST /api/generate, POST /api/generate/privacy-policy, POST /api/generate/terms-of-service, and POST /api/generate/cookie-policy. Query the User model's subscriptionStatus field (or call Stripe API if field is stale). Return 403 with JSON body { error: 'Active subscription required' } if subscription is not active. Apply middleware to all /api/generate routes. Add unit tests for active, inactive, and missing subscription states. --- *Generated by CEO Planner (priority: 4)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#425
No description provided.