import "../../../../../base64-CmWvODNW.mjs";
import "../../../../../types-CuW0zWDA.mjs";
import "../../../../../byline-registry-BOjqDOim.mjs";
import { a as unwrapResult, i as requireDb } from "../../../../../error-CkAseSqZ.mjs";
import { n as parseBody, t as isParseError } from "../../../../../parse-GmjecGct.mjs";
import "../../../../../redirects-DXEXBAII.mjs";
import { i as bylineFieldReorderBody } from "../../../../../byline-fields-2Lp5Hbgf.mjs";
import "../../../../../status-CqJQX1QN.mjs";
import "../../../../../api/schemas/index.mjs";
import { n as requirePerm } from "../../../../../authorize-Dz88F_Fw.mjs";
import { a as handleBylineFieldReorder } from "../../../../../byline-fields-CIx_GuN4.mjs";

//#region src/astro/routes/api/admin/byline-fields/reorder.ts
const prerender = false;
const POST = async ({ request, locals }) => {
	const { emdash, user } = locals;
	const denied = requirePerm(user, "schema:manage");
	if (denied) return denied;
	const dbErr = requireDb(emdash?.db);
	if (dbErr) return dbErr;
	const body = await parseBody(request, bylineFieldReorderBody);
	if (isParseError(body)) return body;
	return unwrapResult(await handleBylineFieldReorder(emdash.db, body.slugs));
};

//#endregion
export { POST, prerender };
//# sourceMappingURL=reorder.mjs.map