Add usage tracking table for document generation counts per billing period #821

Open
opened 2026-04-11 20:33:19 -04:00 by pook · 0 comments
Owner

Create migration for document_usage table (id SERIAL, user_id TEXT NOT NULL, generated_at TIMESTAMP DEFAULT NOW(), document_type TEXT). Add incrementUsage(userId, documentType) function that inserts a row. Add getUsageThisPeriod(userId) function that counts rows since the user's current billing period start (from stripe_subscriptions.current_period_start). This enables the free plan limit check (#806) and future tier-based enforcement. Add unit tests for both functions.


Generated by CEO Planner (priority: 3)

Create migration for document_usage table (id SERIAL, user_id TEXT NOT NULL, generated_at TIMESTAMP DEFAULT NOW(), document_type TEXT). Add incrementUsage(userId, documentType) function that inserts a row. Add getUsageThisPeriod(userId) function that counts rows since the user's current billing period start (from stripe_subscriptions.current_period_start). This enables the free plan limit check (#806) and future tier-based enforcement. Add unit tests for both functions. --- *Generated by CEO Planner (priority: 3)*
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#821
No description provided.