diff --git a/admin/src/app/api/plans/route.ts b/admin/src/app/api/plans/route.ts index e6407a5..f09f51f 100644 --- a/admin/src/app/api/plans/route.ts +++ b/admin/src/app/api/plans/route.ts @@ -5,8 +5,8 @@ export async function GET() { try { let res = await query(` SELECT p.id, p.name, COALESCE(p.slug, LOWER(p.name)) as slug, - COALESCE(p.price, p.price_monthly, 0) as "priceMonthly", - COALESCE(p.price_yearly, p.price * 10, 0) as "priceYearly", + COALESCE(NULLIF(p.price_monthly, 0), NULLIF(p.price, 0), 0) as "priceMonthly", + COALESCE(NULLIF(p.price_yearly, 0), p.price * 10, 0) as "priceYearly", COALESCE(p.max_professionals, 1) as "maxProfessionals", COALESCE(p.max_services, 10) as "maxServices", p.features, p.is_active as active, @@ -34,8 +34,8 @@ export async function GET() { res = await query(` SELECT p.id, p.name, COALESCE(p.slug, LOWER(p.name)) as slug, - COALESCE(p.price, p.price_monthly, 0) as "priceMonthly", - COALESCE(p.price_yearly, p.price * 10, 0) as "priceYearly", + COALESCE(NULLIF(p.price_monthly, 0), NULLIF(p.price, 0), 0) as "priceMonthly", + COALESCE(NULLIF(p.price_yearly, 0), p.price * 10, 0) as "priceYearly", COALESCE(p.max_professionals, 1) as "maxProfessionals", COALESCE(p.max_services, 10) as "maxServices", p.features, p.is_active as active,