feat: Phase 1 — core game loop complete
New endpoints: - GET /cards/:card_id single card lookup - POST /packs/buy purchase pack with coins - POST /objectives/claim claim completed objective reward - GET /matches match history (limit/mode query params) - GET /sbc/:sbc_id single SBC lookup Card pool expanded: - Bronze: 11 → 30 cards (19 nations) - Silver: 0 → 20 cards (20 nations) - Rare Gold: 0 → 10 cards (10 nations) SBC pool expanded: - Added 5 new SBCs (tri_nations, silver_to_gold, league_loyalty, african_stars, gold_standard) Infrastructure: - SQLite WAL mode enabled on pool init - Foreign key enforcement enabled Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
use axum::{extract::State, Json};
|
||||
use serde::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::{
|
||||
app::AppState,
|
||||
error::AppResult,
|
||||
services::{objective as obj_svc, profile as profile_svc},
|
||||
services::{club as club_svc, objective as obj_svc, profile as profile_svc},
|
||||
};
|
||||
|
||||
pub async fn get_objectives(State(state): State<AppState>) -> AppResult<Json<Value>> {
|
||||
@@ -13,3 +14,25 @@ pub async fn get_objectives(State(state): State<AppState>) -> AppResult<Json<Val
|
||||
obj_svc::get_objectives_with_progress(&state.pool, &profile.id, &state.obj_defs).await?;
|
||||
Ok(Json(json!({ "objectives": objectives })))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ClaimRequest {
|
||||
pub objective_id: String,
|
||||
}
|
||||
|
||||
pub async fn post_claim_objective(
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<ClaimRequest>,
|
||||
) -> AppResult<Json<Value>> {
|
||||
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
||||
let reward = obj_svc::claim_objective(
|
||||
&state.pool,
|
||||
&profile.id,
|
||||
&club.id,
|
||||
&state.obj_defs,
|
||||
&req.objective_id,
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(json!({ "claimed": true, "reward": reward })))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user