fix: recipe/storage tier limits are lifetime totals, not monthly (v0.58.0)

Recipe count and storage usage shared the monthly user_usage bucket with
AI calls, so both incorrectly reset every month even though nothing was
deleted. Only AI calls should be monthly.

Recipe count and storage are now derived live from real data (recipes,
recipe/review photos, avatar) instead of a counter — deleting a photo or
recipe is itself the "decrement", no extra wiring needed. Storage size is
tracked per-row (recipePhotos.sizeMb, ratings.photoSizeMb, users.avatarSizeMb)
and threaded through presign -> upload -> save.

Also fixes avatar removal silently no-oping (client sent a field the PATCH
schema didn't recognize).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Arnaud
2026-07-20 20:32:31 +02:00
parent f6214e60df
commit f6975e98a9
34 changed files with 11356 additions and 240 deletions
+2 -2
View File
@@ -419,8 +419,8 @@
"apiKeys": "API Keys",
"webhooks": "Webhooks",
"usage": {
"title": "Usage this month",
"description": "Resets at the start of each month ({month}).",
"title": "Usage & limits",
"description": "AI calls reset monthly ({month}). Recipes and storage are lifetime totals.",
"aiCalls": "AI calls",
"recipes": "Recipes created",
"storage": "Storage",
+2 -2
View File
@@ -419,8 +419,8 @@
"apiKeys": "Clés API",
"webhooks": "Webhooks",
"usage": {
"title": "Utilisation ce mois-ci",
"description": "Réinitialisé au début de chaque mois ({month}).",
"title": "Utilisation et limites",
"description": "Les appels IA se réinitialisent chaque mois ({month}). Les recettes et le stockage sont des totaux à vie.",
"aiCalls": "Appels IA",
"recipes": "Recettes créées",
"storage": "Stockage",