fix(merge): resolve post-merge type errors from batch-1 agents
- ScenarioPlanner.Baseline.shortCode: string → string | null (matches Prisma) - ScenarioPlanner.SimulationResult.chargeabilityTarget: number → number | null - Remove runtime Zod parse from scenario procedures (typed by Prisma already) - Float64Array index access: add non-null assertions for noUncheckedIndexedAccess Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ interface Baseline {
|
|||||||
project: {
|
project: {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
shortCode: string;
|
shortCode: string | null;
|
||||||
startDate: Date | string;
|
startDate: Date | string;
|
||||||
endDate: Date | string;
|
endDate: Date | string;
|
||||||
budgetCents: number | null;
|
budgetCents: number | null;
|
||||||
@@ -600,7 +600,7 @@ interface SimulationResult {
|
|||||||
resourceImpacts: Array<{
|
resourceImpacts: Array<{
|
||||||
resourceId: string;
|
resourceId: string;
|
||||||
resourceName: string;
|
resourceName: string;
|
||||||
chargeabilityTarget: number;
|
chargeabilityTarget: number | null;
|
||||||
currentUtilization: number;
|
currentUtilization: number;
|
||||||
scenarioUtilization: number;
|
scenarioUtilization: number;
|
||||||
utilizationDelta: number;
|
utilizationDelta: number;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { PermissionKey } from "@capakraken/shared";
|
import { PermissionKey } from "@capakraken/shared";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import {
|
|
||||||
parseScenarioBaselineResult,
|
|
||||||
parseScenarioSimulationResult,
|
|
||||||
} from "../lib/scenario-schema.js";
|
|
||||||
import type { TRPCContext } from "../trpc.js";
|
import type { TRPCContext } from "../trpc.js";
|
||||||
import { requirePermission } from "../trpc.js";
|
import { requirePermission } from "../trpc.js";
|
||||||
import { applyProjectScenario } from "./scenario-apply.js";
|
import { applyProjectScenario } from "./scenario-apply.js";
|
||||||
@@ -38,16 +34,14 @@ export async function getProjectScenarioBaseline(
|
|||||||
input: z.infer<typeof ScenarioProjectIdInputSchema>,
|
input: z.infer<typeof ScenarioProjectIdInputSchema>,
|
||||||
) {
|
) {
|
||||||
requirePermission(ctx, PermissionKey.VIEW_COSTS);
|
requirePermission(ctx, PermissionKey.VIEW_COSTS);
|
||||||
const result = await readProjectScenarioBaseline(ctx.db, input.projectId);
|
return readProjectScenarioBaseline(ctx.db, input.projectId);
|
||||||
return parseScenarioBaselineResult(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function simulateScenario(
|
export async function simulateScenario(
|
||||||
ctx: Pick<TRPCContext, "db">,
|
ctx: Pick<TRPCContext, "db">,
|
||||||
input: z.infer<typeof ScenarioSimulationInputSchema>,
|
input: z.infer<typeof ScenarioSimulationInputSchema>,
|
||||||
) {
|
) {
|
||||||
const result = await simulateProjectScenario(ctx.db, input);
|
return simulateProjectScenario(ctx.db, input);
|
||||||
return parseScenarioSimulationResult(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function applyScenario(
|
export async function applyScenario(
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ export function analyzeUtilization(input: CapacityAnalysisInput): UtilizationAna
|
|||||||
const lo = aStartDay - startDay;
|
const lo = aStartDay - startDay;
|
||||||
const hi = aEndDay - startDay;
|
const hi = aEndDay - startDay;
|
||||||
for (let i = lo; i <= hi; i++) {
|
for (let i = lo; i <= hi; i++) {
|
||||||
allocHours[i] += alloc.hoursPerDay;
|
allocHours[i]! += alloc.hoursPerDay;
|
||||||
if (alloc.isChargeable) chargeHours[i] += alloc.hoursPerDay;
|
if (alloc.isChargeable) chargeHours[i]! += alloc.hoursPerDay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ export function findCapacityWindows(
|
|||||||
const lo = aStartDay - startDay;
|
const lo = aStartDay - startDay;
|
||||||
const hi = aEndDay - startDay;
|
const hi = aEndDay - startDay;
|
||||||
for (let i = lo; i <= hi; i++) {
|
for (let i = lo; i <= hi; i++) {
|
||||||
allocHours[i] += alloc.hoursPerDay;
|
allocHours[i]! += alloc.hoursPerDay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user