import { ok, type ReadonlyDB } from "@tailor-platform/erp-kit/core"; import type { DB } from "../generated/kysely-tailordb"; export interface GetAccountingPeriodInput { id: string; } /** * Function: getAccountingPeriod * * Retrieves a single accounting period by id. */ export async function run(db: ReadonlyDB, input: GetAccountingPeriodInput) { const result = await db .selectFrom("AccountingPeriod") .selectAll() .where("id", "=", input.id) .executeTakeFirst(); return ok({ accountingPeriod: result ?? null }); }