cd78f72f33
Complete rename of all technical identifiers across the codebase: Package names (11 packages): - @planarchy/* → @capakraken/* in all package.json, tsconfig, imports Import statements: 277 files, 548 occurrences replaced Database & Docker: - PostgreSQL user/db: planarchy → capakraken - Docker volumes: planarchy_pgdata → capakraken_pgdata - Connection strings updated in docker-compose, .env, CI CI/CD: - GitHub Actions workflow: all filter commands updated - Test database credentials updated Infrastructure: - Redis channel: planarchy:sse → capakraken:sse - Logger service name: planarchy-api → capakraken-api - Anonymization seed updated - Start/stop/restart scripts updated Test data: - Seed emails: @planarchy.dev → @capakraken.dev - E2E test credentials: all 11 spec files updated - Email defaults: @planarchy.app → @capakraken.app - localStorage keys: planarchy_* → capakraken_* Documentation: 30+ .md files updated Verification: - pnpm install: workspace resolution works - TypeScript: only pre-existing TS2589 (no new errors) - Engine: 310/310 tests pass - Staffing: 37/37 tests pass Co-Authored-By: claude-flow <ruv@ruv.net>
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import {
|
|
buildSplitAllocationReadModel,
|
|
type SplitAssignmentRecord,
|
|
type SplitDemandRequirementRecord,
|
|
} from "@capakraken/application";
|
|
import type { ShiftInput } from "@capakraken/engine";
|
|
import type { WeekdayAvailability } from "@capakraken/shared";
|
|
|
|
export interface TimelineShiftWindow {
|
|
id: string;
|
|
resourceId: string;
|
|
projectId: string;
|
|
startDate: Date | string;
|
|
endDate: Date | string;
|
|
hoursPerDay: number;
|
|
status: string;
|
|
}
|
|
|
|
export interface BuildTimelineShiftPlanInput {
|
|
demandRequirements: SplitDemandRequirementRecord[];
|
|
assignments: SplitAssignmentRecord[];
|
|
allAssignmentWindows: TimelineShiftWindow[];
|
|
}
|
|
|
|
export interface TimelineShiftPlan {
|
|
validationAllocations: ShiftInput["allocations"];
|
|
}
|
|
|
|
export function buildTimelineShiftPlan({
|
|
demandRequirements,
|
|
assignments,
|
|
allAssignmentWindows,
|
|
}: BuildTimelineShiftPlanInput): TimelineShiftPlan {
|
|
const readModel = buildSplitAllocationReadModel({
|
|
demandRequirements,
|
|
assignments,
|
|
});
|
|
|
|
const validationAllocations = readModel.assignments
|
|
.filter((assignment) => assignment.resourceId !== null && assignment.resource)
|
|
.map((assignment) => {
|
|
const metadata = (assignment.metadata as Record<string, unknown> | null | undefined) ?? {};
|
|
|
|
return {
|
|
...assignment,
|
|
resource: {
|
|
...assignment.resource!,
|
|
availability: assignment.resource!.availability as WeekdayAvailability,
|
|
},
|
|
allAllocationsForResource: allAssignmentWindows.filter(
|
|
(window) => window.resourceId === assignment.resourceId,
|
|
),
|
|
includeSaturday: (metadata.includeSaturday as boolean | undefined) ?? false,
|
|
};
|
|
}) as unknown as ShiftInput["allocations"];
|
|
|
|
return {
|
|
validationAllocations,
|
|
};
|
|
}
|