Round system redesign: Phases 1-7 complete
Full pipeline/track/stage architecture replacing the legacy round system. Schema: 11 new models (Pipeline, Track, Stage, StageTransition, ProjectStageState, RoutingRule, Cohort, CohortProject, LiveProgressCursor, OverrideAction, AudienceVoter) + 8 new enums. Backend: 9 new routers (pipeline, stage, routing, stageFiltering, stageAssignment, cohort, live, decision, award) + 6 new services (stage-engine, routing-engine, stage-filtering, stage-assignment, stage-notifications, live-control). Frontend: Pipeline wizard (17 components), jury stage pages (7), applicant pipeline pages (3), public stage pages (2), admin pipeline pages (5), shared stage components (3), SSE route, live hook. Phase 6 refit: 23 routers/services migrated from roundId to stageId, all frontend components refitted. Deleted round.ts (985 lines), roundTemplate.ts, round-helpers.ts, round-settings.ts, round-type-settings.tsx, 10 legacy admin pages, 7 legacy jury pages, 3 legacy dialogs. Phase 7 validation: 36 tests (10 unit + 8 integration files) all passing, TypeScript 0 errors, Next.js build succeeds, 13 integrity checks, legacy symbol sweep clean, auto-seed on first Docker startup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
143
src/lib/pipeline-defaults.ts
Normal file
143
src/lib/pipeline-defaults.ts
Normal file
@@ -0,0 +1,143 @@
|
||||
import type {
|
||||
IntakeConfig,
|
||||
FilterConfig,
|
||||
EvaluationConfig,
|
||||
SelectionConfig,
|
||||
LiveFinalConfig,
|
||||
ResultsConfig,
|
||||
WizardStageConfig,
|
||||
WizardTrackConfig,
|
||||
WizardState,
|
||||
} from '@/types/pipeline-wizard'
|
||||
|
||||
export function defaultIntakeConfig(): IntakeConfig {
|
||||
return {
|
||||
submissionWindowEnabled: true,
|
||||
lateSubmissionPolicy: 'flag',
|
||||
lateGraceHours: 24,
|
||||
fileRequirements: [
|
||||
{
|
||||
name: 'Executive Summary',
|
||||
description: 'A PDF executive summary of your project',
|
||||
acceptedMimeTypes: ['application/pdf'],
|
||||
maxSizeMB: 50,
|
||||
isRequired: true,
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultFilterConfig(): FilterConfig {
|
||||
return {
|
||||
rules: [],
|
||||
aiRubricEnabled: false,
|
||||
aiConfidenceThresholds: { high: 0.85, medium: 0.6, low: 0.4 },
|
||||
manualQueueEnabled: true,
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultEvaluationConfig(): EvaluationConfig {
|
||||
return {
|
||||
requiredReviews: 3,
|
||||
maxLoadPerJuror: 20,
|
||||
minLoadPerJuror: 5,
|
||||
availabilityWeighting: true,
|
||||
overflowPolicy: 'queue',
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultSelectionConfig(): SelectionConfig {
|
||||
return {
|
||||
finalistCount: undefined,
|
||||
rankingMethod: 'score_average',
|
||||
tieBreaker: 'admin_decides',
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultLiveConfig(): LiveFinalConfig {
|
||||
return {
|
||||
juryVotingEnabled: true,
|
||||
audienceVotingEnabled: false,
|
||||
audienceVoteWeight: 0,
|
||||
cohortSetupMode: 'manual',
|
||||
revealPolicy: 'ceremony',
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultResultsConfig(): ResultsConfig {
|
||||
return {
|
||||
publicationMode: 'manual',
|
||||
showDetailedScores: false,
|
||||
showRankings: true,
|
||||
}
|
||||
}
|
||||
|
||||
function slugify(name: string): string {
|
||||
return name
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-|-$/g, '')
|
||||
}
|
||||
|
||||
export function defaultMainTrackStages(): WizardStageConfig[] {
|
||||
return [
|
||||
{ name: 'Intake', slug: 'intake', stageType: 'INTAKE', sortOrder: 0, configJson: defaultIntakeConfig() as unknown as Record<string, unknown> },
|
||||
{ name: 'Filtering', slug: 'filtering', stageType: 'FILTER', sortOrder: 1, configJson: defaultFilterConfig() as unknown as Record<string, unknown> },
|
||||
{ name: 'Evaluation', slug: 'evaluation', stageType: 'EVALUATION', sortOrder: 2, configJson: defaultEvaluationConfig() as unknown as Record<string, unknown> },
|
||||
{ name: 'Selection', slug: 'selection', stageType: 'SELECTION', sortOrder: 3, configJson: defaultSelectionConfig() as unknown as Record<string, unknown> },
|
||||
{ name: 'Live Finals', slug: 'live-finals', stageType: 'LIVE_FINAL', sortOrder: 4, configJson: defaultLiveConfig() as unknown as Record<string, unknown> },
|
||||
{ name: 'Results', slug: 'results', stageType: 'RESULTS', sortOrder: 5, configJson: defaultResultsConfig() as unknown as Record<string, unknown> },
|
||||
]
|
||||
}
|
||||
|
||||
export function defaultMainTrack(): WizardTrackConfig {
|
||||
return {
|
||||
name: 'Main Competition',
|
||||
slug: 'main-competition',
|
||||
kind: 'MAIN',
|
||||
sortOrder: 0,
|
||||
stages: defaultMainTrackStages(),
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultAwardTrack(index: number): WizardTrackConfig {
|
||||
const name = `Award ${index + 1}`
|
||||
return {
|
||||
name,
|
||||
slug: slugify(name),
|
||||
kind: 'AWARD',
|
||||
sortOrder: index + 1,
|
||||
routingModeDefault: 'PARALLEL',
|
||||
decisionMode: 'JURY_VOTE',
|
||||
stages: [
|
||||
{ name: 'Evaluation', slug: 'evaluation', stageType: 'EVALUATION', sortOrder: 0, configJson: defaultEvaluationConfig() as unknown as Record<string, unknown> },
|
||||
{ name: 'Results', slug: 'results', stageType: 'RESULTS', sortOrder: 1, configJson: defaultResultsConfig() as unknown as Record<string, unknown> },
|
||||
],
|
||||
awardConfig: { name, scoringMode: 'PICK_WINNER' },
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultNotificationConfig(): Record<string, boolean> {
|
||||
return {
|
||||
'stage.transitioned': true,
|
||||
'filtering.completed': true,
|
||||
'assignment.generated': true,
|
||||
'routing.executed': true,
|
||||
'live.cursor.updated': true,
|
||||
'cohort.window.changed': true,
|
||||
'decision.overridden': true,
|
||||
'award.winner.finalized': true,
|
||||
}
|
||||
}
|
||||
|
||||
export function defaultWizardState(programId: string): WizardState {
|
||||
return {
|
||||
name: '',
|
||||
slug: '',
|
||||
programId,
|
||||
settingsJson: {},
|
||||
tracks: [defaultMainTrack()],
|
||||
notificationConfig: defaultNotificationConfig(),
|
||||
overridePolicy: { allowedRoles: ['SUPER_ADMIN', 'PROGRAM_ADMIN'] },
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user