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

@@ -155,7 +155,7 @@ actor MockCloudKitService {
}.sorted { $0.dateTime < $1.dateTime }
}
func fetchGame(by id: UUID) async throws -> Game? {
func fetchGame(by id: String) async throws -> Game? {
try await simulateNetwork()
return games.first { $0.id == id }
}
@@ -167,7 +167,7 @@ actor MockCloudKitService {
return stadiums.map { stadium in
CloudKitService.SyncStadium(
stadium: stadium,
canonicalId: stadium.id.uuidString
canonicalId: stadium.id
)
}
}
@@ -177,8 +177,8 @@ actor MockCloudKitService {
return teams.filter { $0.sport == sport }.map { team in
CloudKitService.SyncTeam(
team: team,
canonicalId: team.id.uuidString,
stadiumCanonicalId: team.stadiumId.uuidString
canonicalId: team.id,
stadiumCanonicalId: team.stadiumId
)
}
}
@@ -197,10 +197,10 @@ actor MockCloudKitService {
}.map { game in
CloudKitService.SyncGame(
game: game,
canonicalId: game.id.uuidString,
homeTeamCanonicalId: game.homeTeamId.uuidString,
awayTeamCanonicalId: game.awayTeamId.uuidString,
stadiumCanonicalId: game.stadiumId.uuidString
canonicalId: game.id,
homeTeamCanonicalId: game.homeTeamId,
awayTeamCanonicalId: game.awayTeamId,
stadiumCanonicalId: game.stadiumId
)
}
}