test: add supabase jwks auth regression

This commit is contained in:
Codex
2026-06-30 01:45:29 +08:00
parent 3bd2ac1799
commit 3e741a2a23
9 changed files with 215 additions and 9 deletions

View File

@@ -86,6 +86,9 @@ function validateProductionConfig(nextConfig: ApiConfig) {
if (!nextConfig.authJwtJwksUrl && isUnsafeSecret(nextConfig.authJwtSecret, DEFAULT_AUTH_JWT_SECRET)) {
failures.push('AUTH_JWT_SECRET or AUTH_JWT_JWKS_URL must be configured for production JWT verification');
}
if (nextConfig.authJwtJwksUrl && !nextConfig.authJwtIssuer.trim()) {
failures.push('AUTH_JWT_ISSUER is required when AUTH_JWT_JWKS_URL is configured');
}
if (isUnsafeSecret(nextConfig.platformAdminApiKey, DEFAULT_PLATFORM_ADMIN_API_KEY)) {
failures.push('PLATFORM_ADMIN_API_KEY must be a strong production secret until platform JWT is implemented');
}

View File

@@ -783,7 +783,9 @@ export async function adjustmentVoucherReportRoute(ctx: RequestContext) {
`
select status, count(*)::int as count, coalesce(sum(amount_cents), 0)::int as "amountCents"
from public.commerce_adjustment_vouchers
where tenant_id = $1 and created_at >= $2::date and created_at < ($3::date + interval '1 day')
where tenant_id = $1
and created_at >= ($2::date::timestamp at time zone 'Asia/Shanghai')
and created_at < (($3::date + interval '1 day')::timestamp at time zone 'Asia/Shanghai')
group by status
order by status
`,
@@ -794,7 +796,9 @@ export async function adjustmentVoucherReportRoute(ctx: RequestContext) {
select adjustment_type as "adjustmentType", direction,
count(*)::int as count, coalesce(sum(amount_cents), 0)::int as "amountCents"
from public.commerce_adjustment_vouchers
where tenant_id = $1 and created_at >= $2::date and created_at < ($3::date + interval '1 day')
where tenant_id = $1
and created_at >= ($2::date::timestamp at time zone 'Asia/Shanghai')
and created_at < (($3::date + interval '1 day')::timestamp at time zone 'Asia/Shanghai')
group by adjustment_type, direction
order by adjustment_type, direction
`,
@@ -805,7 +809,9 @@ export async function adjustmentVoucherReportRoute(ctx: RequestContext) {
select source_type as "sourceType", count(*)::int as count,
coalesce(sum(amount_cents), 0)::int as "amountCents"
from public.commerce_adjustment_vouchers
where tenant_id = $1 and created_at >= $2::date and created_at < ($3::date + interval '1 day')
where tenant_id = $1
and created_at >= ($2::date::timestamp at time zone 'Asia/Shanghai')
and created_at < (($3::date + interval '1 day')::timestamp at time zone 'Asia/Shanghai')
group by source_type
order by source_type
`,
@@ -813,11 +819,13 @@ export async function adjustmentVoucherReportRoute(ctx: RequestContext) {
),
query<Record<string, unknown>>(
`
select created_at::date::text as date, status, count(*)::int as count,
select (created_at at time zone 'Asia/Shanghai')::date::text as date, status, count(*)::int as count,
coalesce(sum(amount_cents), 0)::int as "amountCents"
from public.commerce_adjustment_vouchers
where tenant_id = $1 and created_at >= $2::date and created_at < ($3::date + interval '1 day')
group by created_at::date, status
where tenant_id = $1
and created_at >= ($2::date::timestamp at time zone 'Asia/Shanghai')
and created_at < (($3::date + interval '1 day')::timestamp at time zone 'Asia/Shanghai')
group by (created_at at time zone 'Asia/Shanghai')::date, status
order by date asc, status
`,
[auth.tenantId, startDate, endDate],