import { ok, type ReadonlyDB } from "@tailor-platform/erp-kit/core"; import type { DB } from "../generated/kysely-tailordb"; export interface GetPositionInput { id: string; } /** * Function: getPosition * Retrieves a single Position generation by its id, returning the post's * Department/Site placement, JobProfile reference, status, and headcount * as of that generation. Returns any status — the caller already has a * reference to this specific generation. */ export async function run(db: ReadonlyDB, input: GetPositionInput) { const position = await db .selectFrom("Position") .selectAll() .where("id", "=", input.id) .executeTakeFirst(); return ok({ position: position ?? null }); }