push to maple-street
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { NextRequest } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { gateOrUser } from "@/auth/api";
|
||||
import { composeSkillName } from "@/domain/skills";
|
||||
import { dedupeKey } from "@/db/positions";
|
||||
|
||||
@@ -39,6 +40,9 @@ const bad = (message: string) =>
|
||||
* technologyName?, functionId?, functionName? } -> { name, dedupeKey }.
|
||||
*/
|
||||
export const POST = async (req: NextRequest) => {
|
||||
const gate = await gateOrUser("training.author");
|
||||
if (gate instanceof Response) return gate;
|
||||
|
||||
const body = await readBody(req);
|
||||
if (!body || typeof body !== "object") return bad("invalid body");
|
||||
const parsed = composeSchema.safeParse(body);
|
||||
|
||||
Reference in New Issue
Block a user