refactor(api): extract timeline shift mutation routing
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { PermissionKey, ShiftProjectSchema } from "@capakraken/shared";
|
||||
import { managerProcedure, requirePermission } from "../trpc.js";
|
||||
import { timelineAllocationMutationProcedures } from "./timeline-allocation-mutations.js";
|
||||
import { applyTimelineProjectShiftMutation } from "./timeline-shift-router-support.js";
|
||||
|
||||
export const timelineMutationProcedures = {
|
||||
...timelineAllocationMutationProcedures,
|
||||
|
||||
applyShift: managerProcedure
|
||||
.input(ShiftProjectSchema)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
requirePermission(ctx, PermissionKey.MANAGE_ALLOCATIONS);
|
||||
|
||||
return applyTimelineProjectShiftMutation({
|
||||
db: ctx.db,
|
||||
projectId: input.projectId,
|
||||
newStartDate: input.newStartDate,
|
||||
newEndDate: input.newEndDate,
|
||||
});
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user