Files
shiftcraft/server/utils/solver/feasibilityCheck.ts
Clanker 36e0946ee4 feat: complete ShiftCraft — AI-powered shift scheduling SaaS
Complete implementation including:
- Landing page with hero, features, how-it-works, pricing
- Employee management (CRUD with soft delete)
- AI constraint parser (Anthropic Claude API)
- German labor law templates (ArbZG §3, §5, §9)
- HiGHS ILP solver for optimal fair schedules
- Schedule calendar result view (employee × date grid)
- Shift framework configuration (periods + shifts)
- Subscription tiers: Free / Pro / Business
- PocketBase setup script with collection creation + seed data
- .env.example with all required variables documented

Pages: employees, constraints (list/new/templates), schedules (list/new/[id]),
       settings (organization/shifts/billing), dashboard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 07:47:31 +02:00

33 lines
908 B
TypeScript

import type { SolveInput } from '~/shared/types/schedule'
interface FeasibilityIssue {
message: string
blocking: boolean
}
export function checkFeasibility(input: SolveInput): FeasibilityIssue[] {
const issues: FeasibilityIssue[] = []
const { employees, framework } = input
if (employees.length === 0) {
issues.push({ message: 'Keine Mitarbeiter vorhanden', blocking: true })
return issues
}
if (framework.shifts.length === 0) {
issues.push({ message: 'Keine Schichten definiert', blocking: true })
return issues
}
// Check if enough employees for the highest shift requirement
const maxRequired = Math.max(...framework.shifts.map(s => s.workers_required))
if (employees.length < maxRequired) {
issues.push({
message: `Zu wenige Mitarbeiter: ${maxRequired} benötigt, nur ${employees.length} vorhanden`,
blocking: true
})
}
return issues
}