refactor(routes): update route files for schema rename
Update route imports from ~/models/participant to ~/models/season-participant and fix references to .participant/.participantId on event results to use .seasonParticipant/.seasonParticipantId after schema rename. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0dc962135c
commit
c561099570
21 changed files with 29 additions and 29 deletions
|
|
@ -6,7 +6,7 @@ import { logger } from "~/lib/logger";
|
|||
import { findAllSports } from "~/models/sport";
|
||||
import { findAllSportsSeasons } from "~/models/sports-season";
|
||||
import { findAllSeasonTemplates } from "~/models/season-template";
|
||||
import { countAllParticipants } from "~/models/participant";
|
||||
import { countAllParticipants } from "~/models/season-participant";
|
||||
import { countAllParticipantEVs } from "~/models/participant-expected-value";
|
||||
import { importSportsDataFromJSON } from "~/utils/sports-data-sync.server";
|
||||
import { Button } from "~/components/ui/button";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from './+types/admin.sports-seasons.$id.elo-ratings';
|
|||
|
||||
import { logger } from '~/lib/logger';
|
||||
import { findSportsSeasonById, updateSportsSeason } from '~/models/sports-season';
|
||||
import { findParticipantsBySportsSeasonId } from '~/models/participant';
|
||||
import { findParticipantsBySportsSeasonId } from '~/models/season-participant';
|
||||
import {
|
||||
getAllParticipantEVsForSeason,
|
||||
batchSaveSourceElos,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Route } from "./+types/admin.sports-seasons.$id.events.$eventId.bracket";
|
||||
|
||||
import { findSportsSeasonById } from "~/models/sports-season";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/season-participant";
|
||||
import { getScoringEventById, updateScoringEvent } from "~/models/scoring-event";
|
||||
import {
|
||||
findPlayoffMatchesByEventId,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from './+types/admin.sports-seasons.$id.events.$eventId.cs
|
|||
|
||||
import { findSportsSeasonById } from '~/models/sports-season';
|
||||
import { getScoringEventById } from '~/models/scoring-event';
|
||||
import { findParticipantsBySportsSeasonId } from '~/models/participant';
|
||||
import { findParticipantsBySportsSeasonId } from '~/models/season-participant';
|
||||
import {
|
||||
getCs2StageResultsForEvent,
|
||||
upsertCs2StageAssignments,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Route } from "./+types/admin.sports-seasons.$id.events.$eventId";
|
||||
import { logger } from "~/lib/logger";
|
||||
import { findSportsSeasonById } from "~/models/sports-season";
|
||||
import { findParticipantsBySportsSeasonId, createParticipant } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId, createParticipant } from "~/models/season-participant";
|
||||
import {
|
||||
getScoringEventById,
|
||||
completeScoringEvent,
|
||||
|
|
@ -134,7 +134,7 @@ export async function action({ request, params }: Route.ActionArgs) {
|
|||
// This marks them as "competed, earned nothing" so simulations skip this event.
|
||||
const allParticipants = await findParticipantsBySportsSeasonId(params.id);
|
||||
const existingResults = await getEventResults(params.eventId);
|
||||
const existingIds = new Set(existingResults.map((r) => r.participantId));
|
||||
const existingIds = new Set(existingResults.map((r) => r.seasonParticipantId));
|
||||
const missingIds = findParticipantsWithoutResults(
|
||||
allParticipants.map((p) => p.id),
|
||||
existingIds
|
||||
|
|
@ -373,7 +373,7 @@ export async function action({ request, params }: Route.ActionArgs) {
|
|||
|
||||
try {
|
||||
const existingResults = await getEventResults(params.eventId);
|
||||
const existingIds = new Set(existingResults.map((r) => r.participantId));
|
||||
const existingIds = new Set(existingResults.map((r) => r.seasonParticipantId));
|
||||
const newResults = filterNewResults(incoming, existingIds);
|
||||
|
||||
if (newResults.length > 0) {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ export default function EventResults({
|
|||
|
||||
// Create a map of participants with results for easy lookup
|
||||
const participantResultsMap = new Map(
|
||||
results.map((r: { participant: { id: string } }) => [r.participant.id, r])
|
||||
results.map((r: { seasonParticipant: { id: string } }) => [r.seasonParticipant.id, r])
|
||||
);
|
||||
|
||||
// Get participants without results
|
||||
|
|
@ -419,7 +419,7 @@ export default function EventResults({
|
|||
participants={participants}
|
||||
sportsSeasonId={sportsSeason.id}
|
||||
existingResultParticipantIds={
|
||||
new Set(results.map((r: { participant: { id: string } }) => r.participant.id))
|
||||
new Set(results.map((r: { seasonParticipant: { id: string } }) => r.seasonParticipant.id))
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
|
@ -576,7 +576,7 @@ export default function EventResults({
|
|||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>{result.participant.name}</TableCell>
|
||||
<TableCell>{result.seasonParticipant.name}</TableCell>
|
||||
{event.isQualifyingEvent && event.isComplete && (
|
||||
<TableCell className="text-right">
|
||||
{result.qualifyingPointsAwarded ? (
|
||||
|
|
@ -620,7 +620,7 @@ export default function EventResults({
|
|||
variant="ghost"
|
||||
className="h-8 w-8 p-0 text-destructive hover:text-destructive"
|
||||
onClick={(e) => {
|
||||
if (!confirm(`Delete result for ${result.participant.name}?`)) {
|
||||
if (!confirm(`Delete result for ${result.seasonParticipant.name}?`)) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import type { Route } from "./+types/admin.sports-seasons.$id.expected-values";
|
||||
import { logger } from "~/lib/logger";
|
||||
import { findSportsSeasonById } from "~/models/sports-season";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/season-participant";
|
||||
import {
|
||||
batchUpsertParticipantEVs,
|
||||
getAllParticipantEVsForSeason
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from './+types/admin.sports-seasons.$id.futures-odds';
|
|||
|
||||
import { logger } from '~/lib/logger';
|
||||
import { findSportsSeasonById, updateSportsSeason } from '~/models/sports-season';
|
||||
import { findParticipantsBySportsSeasonId } from '~/models/participant';
|
||||
import { findParticipantsBySportsSeasonId } from '~/models/season-participant';
|
||||
import { getAllParticipantEVsForSeason, batchSaveSourceOdds, batchUpsertParticipantEVs } from '~/models/participant-expected-value';
|
||||
import { batchUpsertParticipantEvSnapshots } from '~/models/ev-snapshot';
|
||||
import { getSimulator, type SimulatorType } from '~/services/simulations/registry';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from './+types/admin.sports-seasons.$id.golf-skills';
|
|||
|
||||
import { logger } from '~/lib/logger';
|
||||
import { findSportsSeasonById, updateSportsSeason } from '~/models/sports-season';
|
||||
import { findParticipantsBySportsSeasonId, findParticipantByName, createParticipant } from '~/models/participant';
|
||||
import { findParticipantsBySportsSeasonId, findParticipantByName, createParticipant } from '~/models/season-participant';
|
||||
import { batchUpsertParticipantEVs } from '~/models/participant-expected-value';
|
||||
import { batchUpsertParticipantEvSnapshots } from '~/models/ev-snapshot';
|
||||
import { getGolfSkillsForSeason, batchUpsertGolfSkills } from '~/models/golf-skills';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from "./+types/admin.sports-seasons.$id.regular-standings"
|
|||
|
||||
import { logger } from "~/lib/logger";
|
||||
import { findSportsSeasonById } from "~/models/sports-season";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/season-participant";
|
||||
import { getRegularSeasonStandings, upsertManualStanding } from "~/models/regular-season-standings";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Input } from "~/components/ui/input";
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import type { Route } from "./+types/admin.sports-seasons.$id.simulate";
|
|||
import { findSportsSeasonById, updateSportsSeason } from "~/models/sports-season";
|
||||
import { batchUpsertParticipantEVs } from "~/models/participant-expected-value";
|
||||
import { batchUpsertParticipantEvSnapshots } from "~/models/ev-snapshot";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/season-participant";
|
||||
import { getSimulator, type SimulatorType } from "~/services/simulations/registry";
|
||||
import { calculateEV } from "~/services/ev-calculator";
|
||||
import { DEFAULT_SCORING_RULES } from "~/lib/scoring-types";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from "./+types/admin.sports-seasons.$id.standings";
|
|||
|
||||
import { logger } from "~/lib/logger";
|
||||
import { findSportsSeasonById } from "~/models/sports-season";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId } from "~/models/season-participant";
|
||||
import { getSeasonResults, upsertSeasonResultsBulk } from "~/models/participant-season-result";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Input } from "~/components/ui/input";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type { Route } from './+types/admin.sports-seasons.$id.surface-elo';
|
|||
|
||||
import { logger } from '~/lib/logger';
|
||||
import { findSportsSeasonById, updateSportsSeason } from '~/models/sports-season';
|
||||
import { findParticipantsBySportsSeasonId, findParticipantByName, createParticipant } from '~/models/participant';
|
||||
import { findParticipantsBySportsSeasonId, findParticipantByName, createParticipant } from '~/models/season-participant';
|
||||
import {
|
||||
batchUpsertParticipantEVs,
|
||||
} from '~/models/participant-expected-value';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import {
|
|||
getPendingStandingsMappings,
|
||||
deletePendingStandingsMapping,
|
||||
} from "~/models/pending-standings-mappings";
|
||||
import { findParticipantsBySportsSeasonId, updateParticipant } from "~/models/participant";
|
||||
import { findParticipantsBySportsSeasonId, updateParticipant } from "~/models/season-participant";
|
||||
import { getLastSyncedAt, upsertRegularSeasonStandings } from "~/models/regular-season-standings";
|
||||
import { Button } from "~/components/ui/button";
|
||||
import { Input } from "~/components/ui/input";
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ vi.mock("~/models/draft-pick", () => ({
|
|||
getDraftPicksWithSports: vi.fn(),
|
||||
getTeamDraftPicksWithSports: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/models/participant", () => ({
|
||||
vi.mock("~/models/season-participant", () => ({
|
||||
getParticipantsForSeasonWithSports: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/models/season-sport", () => ({
|
||||
|
|
@ -138,7 +138,7 @@ describe("draft.force-manual-pick action", () => {
|
|||
vi.mocked(getDraftPicksWithSports).mockResolvedValue([]);
|
||||
vi.mocked(getTeamDraftPicksWithSports).mockResolvedValue([]);
|
||||
|
||||
const { getParticipantsForSeasonWithSports } = await import("~/models/participant");
|
||||
const { getParticipantsForSeasonWithSports } = await import("~/models/season-participant");
|
||||
vi.mocked(getParticipantsForSeasonWithSports).mockResolvedValue([]);
|
||||
|
||||
const { getSeasonSportsSimple } = await import("~/models/season-sport");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ vi.mock("~/models/draft-pick", () => ({
|
|||
getDraftPicksWithSports: vi.fn(),
|
||||
getTeamDraftPicksWithSports: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/models/participant", () => ({
|
||||
vi.mock("~/models/season-participant", () => ({
|
||||
getParticipantsForSeasonWithSports: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/models/season-sport", () => ({
|
||||
|
|
@ -141,7 +141,7 @@ describe("draft.force-manual-pick action — timer mode behavior", () => {
|
|||
vi.mocked(getDraftPicksWithSports).mockResolvedValue([]);
|
||||
vi.mocked(getTeamDraftPicksWithSports).mockResolvedValue([]);
|
||||
|
||||
const { getParticipantsForSeasonWithSports } = await import("~/models/participant");
|
||||
const { getParticipantsForSeasonWithSports } = await import("~/models/season-participant");
|
||||
vi.mocked(getParticipantsForSeasonWithSports).mockResolvedValue([]);
|
||||
|
||||
const { getSeasonSportsSimple } = await import("~/models/season-sport");
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ vi.mock("~/models/draft-pick", () => ({
|
|||
getDraftPicksWithSports: vi.fn(),
|
||||
getTeamDraftPicksWithSports: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/models/participant", () => ({
|
||||
vi.mock("~/models/season-participant", () => ({
|
||||
getParticipantsForSeasonWithSports: vi.fn(),
|
||||
}));
|
||||
vi.mock("~/models/season-sport", () => ({
|
||||
|
|
@ -138,7 +138,7 @@ describe("draft.make-pick action — timer mode behavior", () => {
|
|||
vi.mocked(getDraftPicksWithSports).mockResolvedValue([]);
|
||||
vi.mocked(getTeamDraftPicksWithSports).mockResolvedValue([]);
|
||||
|
||||
const { getParticipantsForSeasonWithSports } = await import("~/models/participant");
|
||||
const { getParticipantsForSeasonWithSports } = await import("~/models/season-participant");
|
||||
vi.mocked(getParticipantsForSeasonWithSports).mockResolvedValue([]);
|
||||
|
||||
const { getSeasonSportsSimple } = await import("~/models/season-sport");
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { eq, and, sql } from "drizzle-orm";
|
|||
import { isUserAdmin } from "~/models/user";
|
||||
import { calculateDraftEligibility } from "~/lib/draft-eligibility";
|
||||
import { getDraftPicksWithSports, getTeamDraftPicksWithSports } from "~/models/draft-pick";
|
||||
import { getParticipantsForSeasonWithSports } from "~/models/participant";
|
||||
import { getParticipantsForSeasonWithSports } from "~/models/season-participant";
|
||||
import { getSeasonSportsSimple } from "~/models/season-sport";
|
||||
import { calculatePickInfo, checkAndTriggerNextAutodraft } from "~/models/draft-utils";
|
||||
import { logCommissionerAction } from "~/models/audit-log";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { eq, and, sql } from "drizzle-orm";
|
|||
import { isUserAdmin } from "~/models/user";
|
||||
import { calculateDraftEligibility } from "~/lib/draft-eligibility";
|
||||
import { getDraftPicksWithSports, getTeamDraftPicksWithSports } from "~/models/draft-pick";
|
||||
import { getParticipantsForSeasonWithSports } from "~/models/participant";
|
||||
import { getParticipantsForSeasonWithSports } from "~/models/season-participant";
|
||||
import { getSeasonSportsSimple } from "~/models/season-sport";
|
||||
import { calculatePickInfo, checkAndTriggerNextAutodraft, pruneIneligibleQueueItems } from "~/models/draft-utils";
|
||||
import { getSocketIO, scheduleDraftRoomClosure } from "../../../server/socket";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { eq, and } from "drizzle-orm";
|
|||
import { isCommissioner } from "~/models/commissioner";
|
||||
import { calculateDraftEligibility } from "~/lib/draft-eligibility";
|
||||
import { getDraftPicksWithSports, getTeamDraftPicksWithSports } from "~/models/draft-pick";
|
||||
import { getParticipantsForSeasonWithSports } from "~/models/participant";
|
||||
import { getParticipantsForSeasonWithSports } from "~/models/season-participant";
|
||||
import { getSeasonSportsSimple } from "~/models/season-sport";
|
||||
import { logCommissionerAction } from "~/models/audit-log";
|
||||
import { getSocketIO } from "../../../server/socket";
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { getTeamWatchlist } from "~/models/watchlist";
|
|||
import { findSeasonWithTeamsAndLeague } from "~/models/season";
|
||||
import { findDraftSlotsBySeasonId } from "~/models/draft-slot";
|
||||
import { getDraftPicksForSeason } from "~/models/draft-pick";
|
||||
import { getDraftParticipants } from "~/models/participant";
|
||||
import { getDraftParticipants } from "~/models/season-participant";
|
||||
import { getSeasonTimers } from "~/models/draft-timer";
|
||||
import { getSeasonAutodraftSettings } from "~/models/autodraft-settings";
|
||||
import { hasCommissionerRecord } from "~/models/commissioner";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue