wip: checkpoint multi-game core work
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::extractors::GameId;
|
||||
use axum::{
|
||||
extract::{Query, State},
|
||||
Json,
|
||||
@@ -20,9 +21,10 @@ pub struct MatchHistoryQuery {
|
||||
|
||||
pub async fn get_matches(
|
||||
State(state): State<AppState>,
|
||||
game: GameId,
|
||||
Query(query): Query<MatchHistoryQuery>,
|
||||
) -> AppResult<Json<Value>> {
|
||||
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||
let profile = profile_svc::get_active_profile(&state.pool, game.as_str()).await?;
|
||||
let limit = query.limit.unwrap_or(20).clamp(1, 100);
|
||||
|
||||
let matches = if let Some(mode) = &query.mode {
|
||||
@@ -63,9 +65,10 @@ pub async fn get_opponent(
|
||||
|
||||
pub async fn post_match_result(
|
||||
State(state): State<AppState>,
|
||||
game: GameId,
|
||||
Json(req): Json<SubmitMatchRequest>,
|
||||
) -> AppResult<Json<MatchRewardResult>> {
|
||||
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||
let profile = profile_svc::get_active_profile(&state.pool, game.as_str()).await?;
|
||||
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
||||
|
||||
let result =
|
||||
|
||||
Reference in New Issue
Block a user