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>
22 lines
740 B
TypeScript
22 lines
740 B
TypeScript
import type { z } from "zod";
|
|
import { adminProcedure, createTRPCRouter } from "../trpc.js";
|
|
import {
|
|
listSystemRoleConfigs,
|
|
systemRoleConfigUpdateInputSchema,
|
|
updateSystemRoleConfig,
|
|
} from "./system-role-config-procedure-support.js";
|
|
|
|
export const systemRoleConfigRouter = createTRPCRouter({
|
|
/** List all role configs (sorted by sortOrder) */
|
|
list: adminProcedure.query(({ ctx }) => listSystemRoleConfigs(ctx)),
|
|
|
|
/** Update a role's default permissions, label, description, and color */
|
|
update: adminProcedure
|
|
.input(
|
|
systemRoleConfigUpdateInputSchema as z.ZodType<
|
|
z.infer<typeof systemRoleConfigUpdateInputSchema>
|
|
>,
|
|
)
|
|
.mutation(({ ctx, input }) => updateSystemRoleConfig(ctx, input)),
|
|
});
|