Merge branch 'worktree-agent-a2939317'

This commit is contained in:
2026-04-09 14:44:51 +02:00
14 changed files with 48 additions and 48 deletions
@@ -1,6 +1,6 @@
import { AllocationStatus, PermissionKey, SystemRole } from "@capakraken/shared"; import { AllocationStatus, PermissionKey, SystemRole } from "@capakraken/shared";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";
import { allocationRouter } from "../router/allocation.js"; import { allocationRouter } from "../router/allocation/index.js";
import { emitAllocationCreated, emitAllocationDeleted, emitNotificationCreated } from "../sse/event-bus.js"; import { emitAllocationCreated, emitAllocationDeleted, emitNotificationCreated } from "../sse/event-bus.js";
import { checkBudgetThresholds } from "../lib/budget-alerts.js"; import { checkBudgetThresholds } from "../lib/budget-alerts.js";
import { generateAutoSuggestions } from "../lib/auto-staffing.js"; import { generateAutoSuggestions } from "../lib/auto-staffing.js";
-12
View File
@@ -1,12 +0,0 @@
import { allocationAssignmentProcedures } from "./allocation-assignment-procedures.js";
import { allocationConflictProcedures } from "./allocation-conflict-procedures.js";
import { allocationDemandProcedures } from "./allocation-demand-procedures.js";
import { allocationReadProcedures } from "./allocation-read-procedures.js";
import { createTRPCRouter } from "../trpc.js";
export const allocationRouter = createTRPCRouter({
...allocationReadProcedures,
...allocationDemandProcedures,
...allocationAssignmentProcedures,
...allocationConflictProcedures,
});
@@ -2,12 +2,12 @@ import {
emitAllocationCreated, emitAllocationCreated,
emitAllocationDeleted, emitAllocationDeleted,
emitAllocationUpdated, emitAllocationUpdated,
} from "../sse/event-bus.js"; } from "../../sse/event-bus.js";
import { import {
checkBudgetThresholdsInBackground, checkBudgetThresholdsInBackground,
dispatchAllocationWebhookInBackground, dispatchAllocationWebhookInBackground,
invalidateDashboardCacheInBackground, invalidateDashboardCacheInBackground,
} from "./allocation-effects.js"; } from "./effects.js";
type AllocationMutationDb = Parameters<typeof checkBudgetThresholdsInBackground>[0]; type AllocationMutationDb = Parameters<typeof checkBudgetThresholdsInBackground>[0];
@@ -16,13 +16,13 @@ import {
} from "@capakraken/shared"; } from "@capakraken/shared";
import { TRPCError } from "@trpc/server"; import { TRPCError } from "@trpc/server";
import { z } from "zod"; import { z } from "zod";
import { findUniqueOrThrow } from "../db/helpers.js"; import { findUniqueOrThrow } from "../../db/helpers.js";
import { ASSIGNMENT_INCLUDE, toIsoDate } from "./allocation-shared.js"; import { ASSIGNMENT_INCLUDE, toIsoDate } from "./shared.js";
import { import {
findAllocationEntryOrNull, findAllocationEntryOrNull,
toAssignmentUpdateInput, toAssignmentUpdateInput,
toDemandRequirementUpdateInput, toDemandRequirementUpdateInput,
} from "./allocation-support.js"; } from "./support.js";
type AllocationMutationDb = Pick< type AllocationMutationDb = Pick<
PrismaClient, PrismaClient,
@@ -11,14 +11,14 @@ import {
UpdateAssignmentSchema, UpdateAssignmentSchema,
} from "@capakraken/shared"; } from "@capakraken/shared";
import { z } from "zod"; import { z } from "zod";
import { findUniqueOrThrow } from "../db/helpers.js"; import { findUniqueOrThrow } from "../../db/helpers.js";
import { import {
publishAllocationCreated, publishAllocationCreated,
publishAllocationDeleted, publishAllocationDeleted,
publishAllocationUpdated, publishAllocationUpdated,
publishBatchAllocationDeletes, publishBatchAllocationDeletes,
publishBatchAllocationStatusUpdates, publishBatchAllocationStatusUpdates,
} from "./allocation-assignment-effects.js"; } from "./assignment-effects.js";
import { import {
batchDeleteAllocationsWithAudit, batchDeleteAllocationsWithAudit,
batchUpdateAllocationStatusWithAudit, batchUpdateAllocationStatusWithAudit,
@@ -27,11 +27,11 @@ import {
deleteAssignmentWithAudit, deleteAssignmentWithAudit,
ensureAssignmentRecord, ensureAssignmentRecord,
updateAllocationWithAudit, updateAllocationWithAudit,
} from "./allocation-assignment-mutations.js"; } from "./assignment-mutations.js";
import { import {
managerProcedure, managerProcedure,
requirePermission, requirePermission,
} from "../trpc.js"; } from "../../trpc.js";
export const allocationAssignmentProcedures = { export const allocationAssignmentProcedures = {
create: managerProcedure create: managerProcedure
@@ -6,8 +6,8 @@ import {
calculateEffectiveDayAvailability, calculateEffectiveDayAvailability,
countEffectiveWorkingDays, countEffectiveWorkingDays,
loadResourceDailyAvailabilityContexts, loadResourceDailyAvailabilityContexts,
} from "../lib/resource-capacity.js"; } from "../../lib/resource-capacity.js";
import { averagePerWorkingDay, round1, toIsoDate } from "./allocation-shared.js"; import { averagePerWorkingDay, round1, toIsoDate } from "./shared.js";
export async function buildResourceAvailabilityView( export async function buildResourceAvailabilityView(
db: Pick<import("@capakraken/db").PrismaClient, "resource" | "assignment" | "vacation" | "holidayCalendar">, db: Pick<import("@capakraken/db").PrismaClient, "resource" | "assignment" | "vacation" | "holidayCalendar">,
@@ -11,28 +11,28 @@ import {
UpdateDemandRequirementSchema, UpdateDemandRequirementSchema,
} from "@capakraken/shared"; } from "@capakraken/shared";
import { z } from "zod"; import { z } from "zod";
import { findUniqueOrThrow } from "../db/helpers.js"; import { findUniqueOrThrow } from "../../db/helpers.js";
import { import {
emitAllocationCreated, emitAllocationCreated,
emitAllocationDeleted, emitAllocationDeleted,
emitAllocationUpdated, emitAllocationUpdated,
} from "../sse/event-bus.js"; } from "../../sse/event-bus.js";
import { import {
checkBudgetThresholdsInBackground, checkBudgetThresholdsInBackground,
createDemandRequirementWithEffects, createDemandRequirementWithEffects,
dispatchAllocationWebhookInBackground, dispatchAllocationWebhookInBackground,
fillDemandRequirementWithEffects, fillDemandRequirementWithEffects,
invalidateDashboardCacheInBackground, invalidateDashboardCacheInBackground,
} from "./allocation-effects.js"; } from "./effects.js";
import { DEMAND_INCLUDE } from "./allocation-shared.js"; import { DEMAND_INCLUDE } from "./shared.js";
import { import {
buildCreateDemandRequirementInput, buildCreateDemandRequirementInput,
getDemandRequirementByIdOrThrow, getDemandRequirementByIdOrThrow,
} from "./allocation-support.js"; } from "./support.js";
import { import {
managerProcedure, managerProcedure,
requirePermission, requirePermission,
} from "../trpc.js"; } from "../../trpc.js";
export const allocationDemandProcedures = { export const allocationDemandProcedures = {
createDemandRequirement: managerProcedure createDemandRequirement: managerProcedure
@@ -1,12 +1,12 @@
import { createDemandRequirement, fillDemandRequirement } from "@capakraken/application"; import { createDemandRequirement, fillDemandRequirement } from "@capakraken/application";
import { buildTaskAction, CreateDemandRequirementSchema, FillDemandRequirementSchema } from "@capakraken/shared"; import { buildTaskAction, CreateDemandRequirementSchema, FillDemandRequirementSchema } from "@capakraken/shared";
import { z } from "zod"; import { z } from "zod";
import { checkBudgetThresholds } from "../lib/budget-alerts.js"; import { checkBudgetThresholds } from "../../lib/budget-alerts.js";
import { generateAutoSuggestions } from "../lib/auto-staffing.js"; import { generateAutoSuggestions } from "../../lib/auto-staffing.js";
import { invalidateDashboardCache } from "../lib/cache.js"; import { invalidateDashboardCache } from "../../lib/cache.js";
import { logger } from "../lib/logger.js"; import { logger } from "../../lib/logger.js";
import { dispatchWebhooks } from "../lib/webhook-dispatcher.js"; import { dispatchWebhooks } from "../../lib/webhook-dispatcher.js";
import { emitAllocationCreated, emitAllocationUpdated, emitNotificationCreated } from "../sse/event-bus.js"; import { emitAllocationCreated, emitAllocationUpdated, emitNotificationCreated } from "../../sse/event-bus.js";
export function runAllocationBackgroundEffect( export function runAllocationBackgroundEffect(
effectName: string, effectName: string,
@@ -0,0 +1,12 @@
import { allocationAssignmentProcedures } from "./assignment-procedures.js";
import { allocationConflictProcedures } from "../allocation-conflict-procedures.js";
import { allocationDemandProcedures } from "./demand.js";
import { allocationReadProcedures } from "./read.js";
import { createTRPCRouter } from "../../trpc.js";
export const allocationRouter = createTRPCRouter({
...allocationReadProcedures,
...allocationDemandProcedures,
...allocationAssignmentProcedures,
...allocationConflictProcedures,
});
@@ -1,11 +1,11 @@
import { AllocationStatus } from "@capakraken/shared"; import { AllocationStatus } from "@capakraken/shared";
import { z } from "zod"; import { z } from "zod";
import { findUniqueOrThrow } from "../db/helpers.js"; import { findUniqueOrThrow } from "../../db/helpers.js";
import { anonymizeResource, getAnonymizationDirectory } from "../lib/anonymization.js"; import { anonymizeResource, getAnonymizationDirectory } from "../../lib/anonymization.js";
import { planningReadProcedure } from "../trpc.js"; import { planningReadProcedure } from "../../trpc.js";
import { buildResourceAvailabilitySummary, buildResourceAvailabilityView } from "./allocation-availability.js"; import { buildResourceAvailabilitySummary, buildResourceAvailabilityView } from "./availability.js";
import { ASSIGNMENT_INCLUDE, DEMAND_INCLUDE } from "./allocation-shared.js"; import { ASSIGNMENT_INCLUDE, DEMAND_INCLUDE } from "./shared.js";
import { getDemandRequirementByIdOrThrow, loadAllocationReadModel, resolveAssignmentBySelection } from "./allocation-support.js"; import { getDemandRequirementByIdOrThrow, loadAllocationReadModel, resolveAssignmentBySelection } from "./support.js";
export const allocationReadProcedures = { export const allocationReadProcedures = {
list: planningReadProcedure list: planningReadProcedure
@@ -1,7 +1,7 @@
import { AllocationStatus, UpdateAllocationSchema } from "@capakraken/shared"; import { AllocationStatus, UpdateAllocationSchema } from "@capakraken/shared";
export { toIsoDate, round1, averagePerWorkingDay } from "@capakraken/shared"; export { toIsoDate, round1, averagePerWorkingDay } from "@capakraken/shared";
import { z } from "zod"; import { z } from "zod";
import { PROJECT_BRIEF_SELECT, RESOURCE_BRIEF_SELECT, ROLE_BRIEF_SELECT } from "../db/selects.js"; import { PROJECT_BRIEF_SELECT, RESOURCE_BRIEF_SELECT, ROLE_BRIEF_SELECT } from "../../db/selects.js";
export const DEMAND_INCLUDE = { export const DEMAND_INCLUDE = {
project: { select: PROJECT_BRIEF_SELECT }, project: { select: PROJECT_BRIEF_SELECT },
@@ -2,9 +2,9 @@ import { buildSplitAllocationReadModel, loadAllocationEntry } from "@capakraken/
import { AllocationStatus, CreateDemandRequirementSchema } from "@capakraken/shared"; import { AllocationStatus, CreateDemandRequirementSchema } from "@capakraken/shared";
import { TRPCError } from "@trpc/server"; import { TRPCError } from "@trpc/server";
import { z } from "zod"; import { z } from "zod";
import { findUniqueOrThrow } from "../db/helpers.js"; import { findUniqueOrThrow } from "../../db/helpers.js";
import { anonymizeResource, getAnonymizationDirectory } from "../lib/anonymization.js"; import { anonymizeResource, getAnonymizationDirectory } from "../../lib/anonymization.js";
import { ASSIGNMENT_INCLUDE, type AllocationEntryUpdateInput, type AllocationListFilters, type AssignmentResolutionInput, type CreateDemandDraftInput, DEMAND_INCLUDE, toIsoDate } from "./allocation-shared.js"; import { ASSIGNMENT_INCLUDE, type AllocationEntryUpdateInput, type AllocationListFilters, type AssignmentResolutionInput, type CreateDemandDraftInput, DEMAND_INCLUDE, toIsoDate } from "./shared.js";
export function toDemandRequirementUpdateInput(input: AllocationEntryUpdateInput) { export function toDemandRequirementUpdateInput(input: AllocationEntryUpdateInput) {
return { return {
+1 -1
View File
@@ -50,7 +50,7 @@ import { experienceMultiplierRouter } from "./experience-multiplier.js";
import { dashboardRouter } from "./dashboard.js"; import { dashboardRouter } from "./dashboard.js";
import { insightsRouter } from "./insights.js"; import { insightsRouter } from "./insights.js";
import { scenarioRouter } from "./scenario.js"; import { scenarioRouter } from "./scenario.js";
import { allocationRouter } from "./allocation.js"; import { allocationRouter } from "./allocation/index.js";
import { staffingRouter } from "./staffing.js"; import { staffingRouter } from "./staffing.js";
import { advancedTimelineToolDefinitions, createAdvancedTimelineExecutors } from "./assistant-tools/advanced-timeline.js"; import { advancedTimelineToolDefinitions, createAdvancedTimelineExecutors } from "./assistant-tools/advanced-timeline.js";
import { import {
+1 -1
View File
@@ -1,5 +1,5 @@
import { createTRPCRouter } from "../trpc.js"; import { createTRPCRouter } from "../trpc.js";
import { allocationRouter } from "./allocation.js"; import { allocationRouter } from "./allocation/index.js";
import { assistantRouter } from "./assistant.js"; import { assistantRouter } from "./assistant.js";
import { auditLogRouter } from "./audit-log.js"; import { auditLogRouter } from "./audit-log.js";
import { calculationRuleRouter } from "./calculation-rules.js"; import { calculationRuleRouter } from "./calculation-rules.js";