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,59 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// SBC definition from data/sbcs/*.json
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SbcDefinition {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub requirements: SbcRequirements,
|
||||
pub reward: SbcReward,
|
||||
pub expires_at: Option<String>,
|
||||
pub repeatable: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SbcRequirements {
|
||||
pub squad_size: u8,
|
||||
pub min_overall: Option<u8>,
|
||||
pub max_overall: Option<u8>,
|
||||
pub min_chemistry: Option<u8>,
|
||||
pub required_leagues: Vec<String>,
|
||||
pub required_nations: Vec<String>,
|
||||
pub required_clubs: Vec<String>,
|
||||
pub min_players_from_same_league: Option<u8>,
|
||||
pub min_players_from_same_nation: Option<u8>,
|
||||
pub min_players_from_same_club: Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct SbcReward {
|
||||
pub coins: i64,
|
||||
pub xp: i64,
|
||||
pub pack_id: Option<String>,
|
||||
}
|
||||
|
||||
/// DB record of a completed submission
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct SbcSubmission {
|
||||
pub id: String,
|
||||
pub profile_id: String,
|
||||
pub sbc_id: String,
|
||||
pub submitted_card_ids: String,
|
||||
pub passed: bool,
|
||||
pub submitted_at: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct SubmitSbcRequest {
|
||||
pub sbc_id: String,
|
||||
pub owned_card_ids: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct SbcResult {
|
||||
pub passed: bool,
|
||||
pub failures: Vec<String>,
|
||||
pub reward: Option<SbcReward>,
|
||||
}
|
||||
Reference in New Issue
Block a user