Initial commit: OpenFUT Core
Offline Ultimate Team backend — game-independent REST API. - 19 API endpoints: auth, profiles, clubs, cards, packs, squads, objectives, SBCs, match rewards, NPC market, statistics - Axum + SQLite + SQLx with full migrations - Weighted pack generator, SBC validation engine - JSON-driven mod data (cards, packs, objectives, SBCs) - 5 integration tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
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 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,
|
||||
}
|
||||
Reference in New Issue
Block a user