6ef4c40e29
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>
23 lines
692 B
Rust
23 lines
692 B
Rust
use axum::{extract::State, Json};
|
|
|
|
use crate::{
|
|
app::AppState,
|
|
error::AppResult,
|
|
models::match_result::{MatchRewardResult, SubmitMatchRequest},
|
|
services::{club as club_svc, match_service, profile as profile_svc},
|
|
};
|
|
|
|
pub async fn post_match_result(
|
|
State(state): State<AppState>,
|
|
Json(req): Json<SubmitMatchRequest>,
|
|
) -> AppResult<Json<MatchRewardResult>> {
|
|
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
|
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
|
|
|
let result =
|
|
match_service::process_match(&state.pool, &profile.id, &club.id, &req, &state.obj_defs)
|
|
.await?;
|
|
|
|
Ok(Json(result))
|
|
}
|