4ae1081aa9
Card pool: - TOTW cards (5): overall 88-92, rarity "totw" - Hero cards (5): overall 85-88, rarity "hero" - Icon cards (5): overall 93-95, rarity "icon" (permanent, non-loan) Packs: - TOTW Pack (30,000 coins): 5 TOTW cards guaranteed - Icon Pack (50,000 coins): 3 icon cards guaranteed - Hero Pack (20,000 coins): 5 hero cards guaranteed Objectives: - Milestone objectives (6): win 10/50, score 100/500 goals, 10 SBCs, 25 packs Formations: - GET /formations returns 12 valid formation strings Multiple named squads (#20): - POST /squad with no squad_id always creates a new squad - POST /squad with squad_id updates that specific squad - GET /squads: list all squads for the club (metadata only) - GET /squads/🆔 squad with players + chemistry - DELETE /squads/🆔 remove a squad Per-position goal stats (#41): - Migration 0003: position_goals table - POST /matches/result accepts optional goal_positions: ["ST","CAM",...] - GET /statistics now includes position_goals map Settings (#44-46): - GET /settings: { difficulty, preferred_formation } with defaults - PUT /settings: upsert any key-value combination Draft mode skeleton (#38): - GET /draft/squad?difficulty=... returns a randomly generated 11-player squad Integration tests: - 9 new tests covering: formations, pack buy/open, SBC submit, settings R/W, multiple squads, draft endpoint, goal position tracking, win streak Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
57 lines
1.3 KiB
Rust
57 lines
1.3 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct Squad {
|
|
pub id: String,
|
|
pub club_id: String,
|
|
pub name: String,
|
|
pub formation: String,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
impl Squad {
|
|
pub fn new(
|
|
club_id: impl Into<String>,
|
|
name: impl Into<String>,
|
|
formation: impl Into<String>,
|
|
) -> Self {
|
|
let now = chrono::Utc::now().to_rfc3339();
|
|
Self {
|
|
id: Uuid::new_v4().to_string(),
|
|
club_id: club_id.into(),
|
|
name: name.into(),
|
|
formation: formation.into(),
|
|
created_at: now.clone(),
|
|
updated_at: now,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
|
|
pub struct SquadPlayer {
|
|
pub id: String,
|
|
pub squad_id: String,
|
|
pub owned_card_id: String,
|
|
pub position_index: i64,
|
|
pub is_captain: bool,
|
|
pub is_on_bench: bool,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct SaveSquadRequest {
|
|
pub squad_id: Option<String>,
|
|
pub name: Option<String>,
|
|
pub formation: Option<String>,
|
|
pub players: Vec<SquadPlayerInput>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
pub struct SquadPlayerInput {
|
|
pub owned_card_id: String,
|
|
pub position_index: i64,
|
|
pub is_captain: bool,
|
|
pub is_on_bench: bool,
|
|
}
|