brackt/scripts/backfill/match-tournament.ts
Chris Parsons f3937d0d84
feat: auto-provision canonical tournaments and participants on create
Creating new qualifying scoring_events or season_participants now
auto-upserts the matching canonical rows. Needed so the check constraint
doesn't reject qualifying events, and so new season participants
flow through syncTournamentResults.

- Extract tournament identity shared between backfill and event-creation
  into app/lib/tournament-identity.ts; scripts/backfill re-exports it.
- createScoringEvent + bulkCreateScoringEvents now accept tournamentId.
- Event creation routes auto-compute (name, year) and upsert tournament.
- createParticipant + createManyParticipants auto-link to canonical
  participants by (sportId, name).

Phase 3 Task 7 of canonical tournament layer migration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-01 22:32:16 +00:00

11 lines
373 B
TypeScript

/**
* Re-exports the canonical tournament identity extractor. The implementation
* lives in `app/lib/tournament-identity.ts` so it can be shared by the
* Phase 2 backfill and by the admin event-creation flow.
*/
export {
extractTournamentIdentity,
type TournamentIdentity,
type ScoringEventIdentityInput as ScoringEventInput,
} from "~/lib/tournament-identity";