CourseKitType Reference
Conflict Types
Types for conflict detection, validation, and constraint evaluation
Conflict
A single constraint violation detected by the conflict pipeline.
type ConflictSeverity = 'error' | 'warning';
interface Conflict {
id: string;
type: string; // e.g. "instructor-double-book", "room-overlap"
severity: ConflictSeverity;
message: string;
involvedEventIds: string[];
involvedEntityIds: string[];
metadata: Record<string, unknown>;
}| Field | Description |
|---|---|
id | Unique identifier for this specific conflict instance |
type | Constraint-defined type string (e.g., 'instructor-double-book', 'room-over-capacity', 'availability-violation') |
severity | 'error' for blocking issues, 'warning' for advisories |
message | Human-readable description |
involvedEventIds | IDs of events involved in the conflict |
involvedEntityIds | IDs of entities involved (instructors, rooms, groups) |
metadata | Additional data from the constraint (times, capacities, etc.) |
ConflictCheckResult
Aggregated result from the constraint pipeline.
interface ConflictCheckResult {
hasErrors: boolean;
hasWarnings: boolean;
conflicts: Conflict[];
}ConstraintContext
Context object passed to ScheduleConstraint.evaluate() with lookup helpers.
interface ConstraintContext {
dateRange: DateRange;
allEvents: TimetableEvent[];
getInstructorsForEvent: (eventId: string) => Promise<string[]>;
getGroupsForEvent: (eventId: string) => Promise<string[]>;
getRoomById: (roomId: string) => Promise<Room | null>;
getGroupStudentCount: (groupId: string) => Promise<number>;
isEntityAvailable: (
entityType: AvailabilityEntityType,
entityId: string,
start: Date,
durationMin: number,
) => Promise<{ available: boolean; conflicts: Availability[] }>;
}These helpers are injected by ConflictService to give constraints access to related data without coupling them to storage directly.
ScheduleConstraint
Abstract class that all constraints must extend.
abstract class ScheduleConstraint {
abstract readonly type: string;
abstract readonly description: string;
abstract evaluate(
occurrences: MaterializedOccurrence[],
context: ConstraintContext,
): Promise<Conflict[]>;
}ValidationError
Used by DTO static validate() methods.
interface ValidationError {
field: string;
message: string;
value?: unknown;
}ValidationResult
interface ValidationResult {
valid: boolean;
errors: ValidationError[];
}