17 lines
622 B
TypeScript
17 lines
622 B
TypeScript
import { jsonError, jsonOk } from "@/lib/server/api";
|
|
import { requireSuperAdminSession } from "@/lib/server/auth/current-user";
|
|
import { listBillingPriceRules } from "@/lib/server/billing-store";
|
|
import { ensureDefaultBillingPriceRules } from "@/lib/server/billing-catalog";
|
|
|
|
export const runtime = "nodejs";
|
|
|
|
export async function GET() {
|
|
try {
|
|
await requireSuperAdminSession();
|
|
await ensureDefaultBillingPriceRules();
|
|
return jsonOk({ priceRules: await listBillingPriceRules({ includeDisabled: true }) });
|
|
} catch (error) {
|
|
return jsonError(error, 500, { source: "api.admin.billing.prices" });
|
|
}
|
|
}
|