Spaces:
Running

axeronis commited on
Commit
dc1e953
·
1 Parent(s): 68688a7

Fix: lowercase subscription plan for PostgreSQL enum

Browse files
Files changed (1) hide show
  1. backend/app/api/admin.py +2 -1
backend/app/api/admin.py CHANGED
@@ -318,7 +318,8 @@ async def update_user(
318
  if body.subscription_plan and user.tenant_id:
319
  tenant = await session.get(Tenant, user.tenant_id)
320
  if tenant:
321
- tenant.subscription_plan = body.subscription_plan
 
322
  tenant.subscription_status = "active" # Activate when admin changes plan
323
  session.add(tenant)
324
  logger.info(f"Admin updated tenant {tenant.id} plan to {body.subscription_plan}")
 
318
  if body.subscription_plan and user.tenant_id:
319
  tenant = await session.get(Tenant, user.tenant_id)
320
  if tenant:
321
+ # PostgreSQL enum requires lowercase values
322
+ tenant.subscription_plan = body.subscription_plan.lower()
323
  tenant.subscription_status = "active" # Activate when admin changes plan
324
  session.add(tenant)
325
  logger.info(f"Admin updated tenant {tenant.id} plan to {body.subscription_plan}")