Files
OpenFUT/openfut-core/src/models/squad.rs
T
funman300 6ef4c40e29 Initial commit: OpenFUT Core + Bridge scaffold
Two-repo monorepo for an offline FUT backend inspired by SPT.

openfut-core: game-independent REST API backend (Axum, SQLite, SQLx)
- 19 API endpoints: auth, profiles, clubs, cards, packs, squads,
  objectives, SBCs, match rewards, NPC market, statistics
- JSON-driven card/pack/objective/SBC data (fully moddable)
- SQLx migrations, weighted pack generator, SBC validation engine
- 5 integration tests passing

openfut-bridge: FIFA 23 traffic proxy + reverse-engineering scaffold
- Catch-all HTTP proxy with request capture to captures/
- Known-route mapper (FUT paths → Core API calls)
- Placeholder responses for unknown endpoints
- Admin endpoints: captures, unknown endpoint list
- 4 unit tests passing

cargo fmt ✓  cargo clippy -D warnings ✓  cargo test ✓

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-25 14:42:16 -07:00

56 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 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,
}