import type { PrismaClient } from "@capakraken/db"; import { emitAllocationUpdated } from "../sse/event-bus.js"; import { applyTimelineBatchAllocationShift } from "./timeline-allocation-shift-support.js"; export async function shiftTimelineAllocations( db: PrismaClient, input: Omit[0], "db">, ) { const results = await applyTimelineBatchAllocationShift({ db, allocationIds: input.allocationIds, daysDelta: input.daysDelta, mode: input.mode, }); for (const allocation of results) { emitAllocationUpdated({ id: allocation.id, projectId: allocation.projectId, resourceId: allocation.resourceId, }); } return { count: results.length }; }