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>
71 lines
2.5 KiB
TypeScript
71 lines
2.5 KiB
TypeScript
import type { z } from "zod";
|
|
import { createTRPCRouter, controllerProcedure } from "../trpc.js";
|
|
import {
|
|
dashboardChargeabilityOverviewInputSchema,
|
|
dashboardDemandInputSchema,
|
|
dashboardDetailInputSchema,
|
|
dashboardPeakTimesInputSchema,
|
|
dashboardTopValueResourcesInputSchema,
|
|
getDashboardBudgetForecastDetail,
|
|
getDashboardBudgetForecastRead,
|
|
getDashboardChargeabilityOverviewRead,
|
|
getDashboardDemandRead,
|
|
getDashboardDetail,
|
|
getDashboardOverviewRead,
|
|
getDashboardPeakTimesRead,
|
|
getDashboardProjectHealthDetail,
|
|
getDashboardProjectHealthRead,
|
|
getDashboardSkillGapSummaryRead,
|
|
getDashboardSkillGapsRead,
|
|
getDashboardStatisticsDetail,
|
|
getDashboardTopValueResourcesRead,
|
|
} from "./dashboard-procedure-support.js";
|
|
|
|
export const dashboardRouter = createTRPCRouter({
|
|
getOverview: controllerProcedure.query(({ ctx }) => getDashboardOverviewRead(ctx)),
|
|
|
|
getStatisticsDetail: controllerProcedure.query(({ ctx }) => getDashboardStatisticsDetail(ctx)),
|
|
|
|
getPeakTimes: controllerProcedure
|
|
.input(dashboardPeakTimesInputSchema)
|
|
.query(({ ctx, input }) => getDashboardPeakTimesRead(ctx, input)),
|
|
|
|
getTopValueResources: controllerProcedure
|
|
.input(dashboardTopValueResourcesInputSchema)
|
|
.query(({ ctx, input }) => getDashboardTopValueResourcesRead(ctx, input)),
|
|
|
|
getDemand: controllerProcedure
|
|
.input(
|
|
dashboardDemandInputSchema as z.ZodType<
|
|
z.infer<typeof dashboardDemandInputSchema>,
|
|
z.ZodTypeDef,
|
|
z.input<typeof dashboardDemandInputSchema>
|
|
>,
|
|
)
|
|
.query(({ ctx, input }) => getDashboardDemandRead(ctx, input)),
|
|
|
|
getDetail: controllerProcedure
|
|
.input(dashboardDetailInputSchema)
|
|
.query(({ ctx, input }) => getDashboardDetail(ctx, input)),
|
|
|
|
getChargeabilityOverview: controllerProcedure
|
|
.input(dashboardChargeabilityOverviewInputSchema)
|
|
.query(({ ctx, input }) => getDashboardChargeabilityOverviewRead(ctx, input)),
|
|
|
|
getBudgetForecast: controllerProcedure.query(({ ctx }) => getDashboardBudgetForecastRead(ctx)),
|
|
|
|
getBudgetForecastDetail: controllerProcedure.query(({ ctx }) =>
|
|
getDashboardBudgetForecastDetail(ctx),
|
|
),
|
|
|
|
getSkillGaps: controllerProcedure.query(({ ctx }) => getDashboardSkillGapsRead(ctx)),
|
|
|
|
getSkillGapSummary: controllerProcedure.query(({ ctx }) => getDashboardSkillGapSummaryRead(ctx)),
|
|
|
|
getProjectHealth: controllerProcedure.query(({ ctx }) => getDashboardProjectHealthRead(ctx)),
|
|
|
|
getProjectHealthDetail: controllerProcedure.query(({ ctx }) =>
|
|
getDashboardProjectHealthDetail(ctx),
|
|
),
|
|
});
|