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_professionals, 1) as "maxProfessionals",
|
||||||
COALESCE(p.max_services, 10) as "maxServices",
|
COALESCE(p.max_services, 10) as "maxServices",
|
||||||
p.features, p.is_active as active,
|
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
|
FROM plans p
|
||||||
ORDER BY p.price ASC
|
ORDER BY p.price ASC
|
||||||
`);
|
`);
|
||||||
|
|
@ -39,7 +39,7 @@ export async function GET() {
|
||||||
COALESCE(p.max_professionals, 1) as "maxProfessionals",
|
COALESCE(p.max_professionals, 1) as "maxProfessionals",
|
||||||
COALESCE(p.max_services, 10) as "maxServices",
|
COALESCE(p.max_services, 10) as "maxServices",
|
||||||
p.features, p.is_active as active,
|
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
|
FROM plans p
|
||||||
ORDER BY p.price ASC
|
ORDER BY p.price ASC
|
||||||
`);
|
`);
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,10 @@ export default function Plans() {
|
||||||
const res = await fetch('/api/plans');
|
const res = await fetch('/api/plans');
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
if (Array.isArray(data)) {
|
||||||
setPlans(data);
|
setPlans(data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue