feat: add ranking and hall of fame features

- Implemented new routes for Best General and Hall of Fame views in the frontend.
- Created BestGeneralView and HallOfFameView components to display rankings based on game data.
- Added new database models for RankData and HallOfFame to store ranking information.
- Introduced ranking types and hall of fame types in common types for better type safety.
- Developed ranking router to handle fetching of best general and hall of fame data.
- Updated database schema with migrations to include new tables for rank data and hall of fame.
- Enhanced the main view with links to the new ranking features.
This commit is contained in:
2026-01-29 18:18:35 +00:00
parent 19c359d0b2
commit 9fff671c2f
16 changed files with 1217 additions and 2 deletions
+47
View File
@@ -146,6 +146,53 @@ model General {
@@map("general")
}
model RankData {
id Int @id @default(autoincrement())
nationId Int @default(0) @map("nation_id")
generalId Int @map("general_id")
type String @db.VarChar(20)
value Int @default(0)
@@unique([generalId, type])
@@index([type, value], name: "by_type")
@@index([nationId, type, value], name: "by_nation")
@@map("rank_data")
}
model HallOfFame {
id Int @id @default(autoincrement())
serverId String @map("server_id")
season Int
scenario Int
generalNo Int @map("general_no")
type String @db.VarChar(20)
value Float
owner String? @map("owner")
aux Json @default(dbgenerated("'{}'::jsonb"))
@@unique([serverId, type, generalNo])
@@unique([owner, serverId, type], name: "hall_owner")
@@index([serverId, type, value], name: "server_show")
@@index([season, scenario, type, value], name: "scenario")
@@map("hall")
}
model GameHistory {
id Int @id @default(autoincrement())
serverId String @map("server_id")
date DateTime
winnerNation Int? @map("winner_nation")
map String? @map("map")
season Int
scenario Int
scenarioName String @map("scenario_name")
env Json @default(dbgenerated("'{}'::jsonb"))
@@unique([serverId])
@@index([date])
@@map("ng_games")
}
model Troop {
troopLeaderId Int @id @map("troop_leader")
nationId Int @map("nation")