fix(admin): corrigir erro SQL de coluna active_plan_id inexistente na busca de planos
Build and Deploy (Gitea Actions) / build-and-deploy (push) Successful in 2m40s
Details
Build and Deploy (Gitea Actions) / build-and-deploy (push) Successful in 2m40s
Details
This commit is contained in:
parent
104974abd1
commit
cbf8b639e8
|
|
@ -10,7 +10,7 @@ export async function GET() {
|
|||
COALESCE(p.max_professionals, 1) as "maxProfessionals",
|
||||
COALESCE(p.max_services, 10) as "maxServices",
|
||||
p.features, p.is_active as active,
|
||||
(SELECT COUNT(*) FROM tenants WHERE active_plan_id = p.id) as subscribers
|
||||
(SELECT COUNT(*) FROM subscriptions WHERE plan_id = p.id AND status = 'active') as subscribers
|
||||
FROM plans p
|
||||
ORDER BY p.price ASC
|
||||
`);
|
||||
|
|
@ -39,7 +39,7 @@ export async function GET() {
|
|||
COALESCE(p.max_professionals, 1) as "maxProfessionals",
|
||||
COALESCE(p.max_services, 10) as "maxServices",
|
||||
p.features, p.is_active as active,
|
||||
(SELECT COUNT(*) FROM tenants WHERE active_plan_id = p.id) as subscribers
|
||||
(SELECT COUNT(*) FROM subscriptions WHERE plan_id = p.id AND status = 'active') as subscribers
|
||||
FROM plans p
|
||||
ORDER BY p.price ASC
|
||||
`);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,9 @@ export default function Plans() {
|
|||
const res = await fetch('/api/plans');
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
setPlans(data);
|
||||
if (Array.isArray(data)) {
|
||||
setPlans(data);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue