fix(simulations): déplacer incrément simulations_used après correction réussie (Option B)

This commit is contained in:
Hermann_Kitio 2026-04-21 02:01:13 +03:00
parent 1a5b79807e
commit ecb478e10c
3 changed files with 23 additions and 27 deletions

View file

@ -1,6 +1,5 @@
import { supabase } from '../lib/supabase.js'
import { canUserSimulate, getPlanPermissions } from '../lib/access.js'
import type { Plan } from '../lib/access.js'
import { canUserSimulate } from '../lib/access.js'
import type { EERapport } from '../lib/deepseek.js'
import type { AuthProfile } from '../middleware/auth.js'
@ -114,15 +113,6 @@ export async function create(
}
}
// 4. Incrémenter simulations_used si le plan a une limite (via access.ts — Règle D)
const perms = getPlanPermissions(profile.plan as Plan)
if (perms.simulations_lifetime !== null) {
await supabase
.from('profiles')
.update({ simulations_used: profile.simulations_used + 1 })
.eq('id', profile.id)
}
return {
data: {
id: data.id,