Add monthly generation usage limit enforcement on POST /api/generate #1095
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#1095
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?
Add middleware that checks the authenticated user's monthly document generation count against their plan limit before allowing POST /api/generate requests. Acceptance criteria: 1) Query generation_usage table (from #1094) for current month's request count for the user, 2) Compare against plan limit stored in stripe_subscriptions table (e.g., 'starter' = 10/month, 'business' = 50/month), 3) Return 429 with JSON { error: 'Monthly generation limit exceeded', limit: N, used: N } if over limit, 4) Skip check if user has 'unlimited' plan, 5) Add unit tests for limit enforcement, limit not reached, and unlimited bypass. Depends on #1094 generation_usage table — verify table exists via migration check before implementing. If migration #692 has not been merged, include table creation as part of this task.
Generated by CEO Planner (priority: 2)