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,31 @@
|
||||
use crate::{db::Pool, error::AppResult, models::pack::PackDefinition, services::pack as pack_svc};
|
||||
use tracing::info;
|
||||
|
||||
/// Seeds the market with NPC listings if empty.
|
||||
pub async fn maybe_seed(_pool: &Pool) -> AppResult<()> {
|
||||
// Any one-time startup seeds go here.
|
||||
// Currently we just ensure the market gets listings on first run.
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Grants the starter pack to a newly created club.
|
||||
pub async fn grant_starter_pack(
|
||||
pool: &Pool,
|
||||
club_id: &str,
|
||||
pack_defs: &[PackDefinition],
|
||||
) -> AppResult<()> {
|
||||
// Look for the gold starter pack first; fall back to the first available definition.
|
||||
let starter_def = pack_defs
|
||||
.iter()
|
||||
.find(|p| p.id == "gold_pack")
|
||||
.or_else(|| pack_defs.first());
|
||||
|
||||
if let Some(def) = starter_def {
|
||||
info!("Granting starter pack '{}' to club {}", def.id, club_id);
|
||||
pack_svc::grant_pack(pool, club_id, &def.id).await?;
|
||||
} else {
|
||||
tracing::warn!("No pack definitions loaded; skipping starter pack grant");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user