24 lines
794 B
TypeScript
24 lines
794 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { getSessionUser } from "@/lib/session";
|
|
import { listSkillPricing } from "@/lib/db";
|
|
|
|
/**
|
|
* GET /api/skills/pricing
|
|
*
|
|
* Returns the platform-wide skill pricing (daily price + setup fee
|
|
* per skill) for display in the customer's cost-disclosure dialog
|
|
* before they enable a priced skill. Any logged-in user can read
|
|
* this — pricing isn't org-specific and is effectively public
|
|
* information for anyone who'd be considering activation.
|
|
*
|
|
* Empty array means no skill is currently priced.
|
|
*/
|
|
export async function GET() {
|
|
const user = await getSessionUser();
|
|
if (!user) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
const rows = await listSkillPricing();
|
|
return NextResponse.json(rows);
|
|
}
|