feat: enforce public bank SaaS scopes

This commit is contained in:
Codex
2026-06-30 08:55:22 +08:00
parent 4f64b7aed8
commit d1cb341351
10 changed files with 576 additions and 80 deletions

View File

@@ -2121,15 +2121,26 @@ async function main() {
values (
$1, $2, 'starter_yearly', 'active',
'2026-06-21T00:00:00Z', '2027-06-21T00:00:00Z',
'yearly', 980000, '{"source":"smoke-seed"}'::jsonb
'yearly', 980000,
jsonb_build_object(
'source', 'smoke-seed',
'publicQuestionBankAccess', jsonb_build_object(
'mode', 'limited_regions',
'allowedRegionIds', jsonb_build_array($3::text)
)
)
)
on conflict (id)
do update set status = excluded.status,
do update set plan_code = excluded.plan_code,
status = excluded.status,
starts_at = excluded.starts_at,
expires_at = excluded.expires_at,
billing_cycle = excluded.billing_cycle,
amount_cents = excluded.amount_cents,
metadata = excluded.metadata,
updated_at = now()
`,
[ids.partnerSubscription, ids.partnerTenant],
[ids.partnerSubscription, ids.partnerTenant, ids.region],
);
await client.query(