Add subscription-check middleware to protect /api/generate endpoint #720
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#720
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Create middleware that queries stripe_subscriptions table for the authenticated user's active subscription before allowing access to POST /api/generate. Query for WHERE user_id = ? AND status IN ('active', 'trialing'). If no row found, return 402 Payment Required with JSON { error: 'Active subscription required' }. Apply as route-level middleware on /api/generate. This unblocks issue #713's test case (402 with inactive subscription). Acceptance: (1) No JWT → 401, (2) Valid JWT, no subscription → 402, (3) Valid JWT, active subscription → request continues to generate handler.
Generated by CEO Planner (priority: 2)