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,57 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ObjectiveType {
|
||||
Daily,
|
||||
Weekly,
|
||||
Lifetime,
|
||||
Milestone,
|
||||
Season,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ObjectiveMetric {
|
||||
MatchesWon,
|
||||
MatchesPlayed,
|
||||
GoalsScored,
|
||||
PacksOpened,
|
||||
SbcsCompleted,
|
||||
CoinsEarned,
|
||||
}
|
||||
|
||||
/// Objective definition from data/objectives/*.json
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ObjectiveDefinition {
|
||||
pub id: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub objective_type: ObjectiveType,
|
||||
pub metric: ObjectiveMetric,
|
||||
pub target: i64,
|
||||
pub reward_coins: i64,
|
||||
pub reward_pack_id: Option<String>,
|
||||
pub reward_xp: i64,
|
||||
}
|
||||
|
||||
/// Progress row in DB
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct ObjectiveProgress {
|
||||
pub id: String,
|
||||
pub profile_id: String,
|
||||
pub objective_id: String,
|
||||
pub current: i64,
|
||||
pub completed: bool,
|
||||
pub claimed: bool,
|
||||
pub updated_at: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct ObjectiveWithProgress {
|
||||
#[serde(flatten)]
|
||||
pub definition: ObjectiveDefinition,
|
||||
pub current: i64,
|
||||
pub completed: bool,
|
||||
pub claimed: bool,
|
||||
}
|
||||
Reference in New Issue
Block a user