Phase 9: division/season tracking, club customization, pack history, notifications
CI / Build, lint & test (push) Failing after 1m42s
CI / Build, lint & test (push) Failing after 1m42s
- GET /division returns live season stats (points, record, promotion threshold) - PUT /club allows updating club name and manager_name - GET /packs/history returns opened packs with full card definitions - GET /notifications dynamically surfaces completed objectives, expiring loans, season end - Club model gains manager_name column (migration 0006 already added it) - Pack model gains opened_cards and opened_at; pack SELECT queries updated - 9 new integration tests — all 45 pass, clippy clean Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,9 +5,33 @@ use crate::{
|
||||
services::{club as club_svc, profile as profile_svc},
|
||||
};
|
||||
use axum::{extract::State, Json};
|
||||
use serde::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
|
||||
pub async fn get_club(State(state): State<AppState>) -> AppResult<Json<Club>> {
|
||||
let profile = profile_svc::get_active_profile(&state.pool).await?;
|
||||
let club = club_svc::get_club_by_profile(&state.pool, &profile.id).await?;
|
||||
Ok(Json(club))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct UpdateClubRequest {
|
||||
pub name: Option<String>,
|
||||
pub manager_name: Option<String>,
|
||||
}
|
||||
|
||||
pub async fn put_club(
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<UpdateClubRequest>,
|
||||
) -> 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 updated = club_svc::update_club(
|
||||
&state.pool,
|
||||
&club.id,
|
||||
req.name.as_deref(),
|
||||
req.manager_name.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(json!({ "club": updated })))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user