import "../../../../../../base64-CmWvODNW.mjs";
import "../../../../../../types-CuW0zWDA.mjs";
import "../../../../../../byline-registry-BOjqDOim.mjs";
import { a as unwrapResult, i as requireDb, t as apiError } from "../../../../../../error-CkAseSqZ.mjs";
import { n as requirePerm } from "../../../../../../authorize-Dz88F_Fw.mjs";
import { s as handleBylineFieldUsage } from "../../../../../../byline-fields-CIx_GuN4.mjs";

//#region src/astro/routes/api/admin/byline-fields/[slug]/usage.ts
const prerender = false;
const GET = async ({ params, locals }) => {
	const { emdash, user } = locals;
	const denied = requirePerm(user, "schema:read");
	if (denied) return denied;
	const dbErr = requireDb(emdash?.db);
	if (dbErr) return dbErr;
	const slug = params.slug;
	if (!slug) return apiError("MISSING_PARAM", "Field slug is required", 400);
	return unwrapResult(await handleBylineFieldUsage(emdash.db, slug));
};

//#endregion
export { GET, prerender };
//# sourceMappingURL=usage.mjs.map