9bd3781c03
Cast Zod schemas with .refine()/.superRefine() to z.ZodType<InferredType> at the procedure level. This short-circuits TypeScript's deep type recursion through tRPC's middleware chain, eliminating 4 of 5 @ts-expect-error TS2589 suppressions in web components (VacationModal, ProjectModal, UsersClient, CountriesClient). Applied same pattern to allocation, timeline, staffing, dashboard, project, and resource query/mutation procedures to reduce client-side type depth. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
24 lines
904 B
TypeScript
24 lines
904 B
TypeScript
import { PermissionKey, ShiftProjectSchema } from "@capakraken/shared";
|
|
import type { ShiftProjectInput } from "@capakraken/shared";
|
|
import type { z } from "zod";
|
|
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 as z.ZodType<ShiftProjectInput>)
|
|
.mutation(async ({ ctx, input }) => {
|
|
requirePermission(ctx, PermissionKey.MANAGE_ALLOCATIONS);
|
|
|
|
return applyTimelineProjectShiftMutation({
|
|
db: ctx.db,
|
|
projectId: input.projectId,
|
|
newStartDate: input.newStartDate,
|
|
newEndDate: input.newEndDate,
|
|
});
|
|
}),
|
|
};
|