refactor: change domain model IDs from UUID to String canonical IDs

This refactor fixes the achievement system by using stable canonical string
IDs (e.g., "stadium_mlb_fenway_park") instead of random UUIDs. This ensures
stadium mappings for achievements are consistent across app launches and
CloudKit sync operations.

Changes:
- Stadium, Team, Game: id property changed from UUID to String
- Trip, TripStop, TripPreferences: updated to use String IDs for games/stadiums
- CKModels: removed UUID parsing, use canonical IDs directly
- AchievementEngine: now matches against canonical stadium IDs
- All test files updated to use String IDs instead of UUID()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-12 09:24:33 -06:00
parent 4b2cacaeba
commit 1703ca5b0f
53 changed files with 642 additions and 727 deletions

View File

@@ -30,7 +30,7 @@ struct ConcurrencyTests {
/// Creates a stadium at a known location
private func makeStadium(
id: UUID = UUID(),
id: String = "stadium_test_\(UUID().uuidString)",
city: String,
lat: Double,
lon: Double,
@@ -50,10 +50,10 @@ struct ConcurrencyTests {
/// Creates a game at a stadium
private func makeGame(
id: UUID = UUID(),
stadiumId: UUID,
homeTeamId: UUID = UUID(),
awayTeamId: UUID = UUID(),
id: String = "game_test_\(UUID().uuidString)",
stadiumId: String,
homeTeamId: String = "team_test_\(UUID().uuidString)",
awayTeamId: String = "team_test_\(UUID().uuidString)",
dateTime: Date,
sport: Sport = .mlb
) -> Game {
@@ -73,7 +73,7 @@ struct ConcurrencyTests {
startDate: Date,
endDate: Date,
games: [Game],
stadiums: [UUID: Stadium]
stadiums: [String: Stadium]
) -> PlanningRequest {
let preferences = TripPreferences(
planningMode: .dateRange,
@@ -107,8 +107,8 @@ struct ConcurrencyTests {
let pair = cityPairs[requestIndex % cityPairs.count]
let stadium1Id = UUID()
let stadium2Id = UUID()
let stadium1Id = "stadium_1_\(UUID().uuidString)"
let stadium2Id = "stadium_2_\(UUID().uuidString)"
let stadium1 = makeStadium(id: stadium1Id, city: pair.city1.0, lat: pair.city1.1, lon: pair.city1.2)
let stadium2 = makeStadium(id: stadium2Id, city: pair.city2.0, lat: pair.city2.1, lon: pair.city2.2)