14 lines
782 B
TypeScript
14 lines
782 B
TypeScript
import { getCloudViewer } from "@/app/cloud-auth";
|
|
import { DomainError } from "@/db/repository";
|
|
import { apiError, readJsonMutation } from "../../respond";
|
|
|
|
export async function POST(request: Request) {
|
|
try {
|
|
const viewer = await getCloudViewer();
|
|
if (!viewer) return Response.json({ error: "authentication_required", message: "请先登录" }, { status: 401 });
|
|
if (!viewer.isAdmin) return Response.json({ error: "forbidden", message: "没有商业后台权限" }, { status: 403 });
|
|
await readJsonMutation<{ period?: "month" | "year"; amountMinor?: number; reason?: string; idempotencyKey?: string }>(request);
|
|
throw new DomainError("paid_features_deferred", "免费公测阶段不发布价格版本", 409);
|
|
} catch (error) { return apiError(error); }
|
|
}
|