style(core): apply cargo fmt across routes, services, models, tests
CI / Build, lint & test (push) Successful in 2m19s
CI / Build, lint & test (push) Successful in 2m19s
Pure rustfmt reflow (import grouping, array/match-arm/call-arg wrapping, alphabetized module decls, comment realignment). No semantic change: full-diff and `git diff -w` both confirm logic byte-identical to 271c363; workspace builds and all 74 core tests pass. Retained pre-existing WIP brought forward after verification.
This commit is contained in:
+19
-14
@@ -11,8 +11,7 @@ use crate::{
|
||||
error::{AppError, AppResult},
|
||||
models::card::OwnedCard,
|
||||
services::{
|
||||
club as club_svc,
|
||||
economy as economy_svc,
|
||||
club as club_svc, economy as economy_svc,
|
||||
inventory::{self, OwnedItemQuery, OwnedItemView},
|
||||
profile as profile_svc,
|
||||
},
|
||||
@@ -20,11 +19,17 @@ use crate::{
|
||||
|
||||
/// Quick-sell value for a card based on overall rating.
|
||||
fn quick_sell_coins(overall: u8) -> i64 {
|
||||
if overall >= 85 { 1500 }
|
||||
else if overall >= 80 { 900 }
|
||||
else if overall >= 75 { 600 }
|
||||
else if overall >= 65 { 300 }
|
||||
else { 150 }
|
||||
if overall >= 85 {
|
||||
1500
|
||||
} else if overall >= 80 {
|
||||
900
|
||||
} else if overall >= 75 {
|
||||
600
|
||||
} else if overall >= 65 {
|
||||
300
|
||||
} else {
|
||||
150
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
@@ -96,7 +101,9 @@ pub async fn get_cards(
|
||||
cards.truncate(limit);
|
||||
}
|
||||
|
||||
Ok(Json(json!({ "cards": cards, "total": total, "returned": cards.len() })))
|
||||
Ok(Json(
|
||||
json!({ "cards": cards, "total": total, "returned": cards.len() }),
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn get_collection(
|
||||
@@ -119,8 +126,7 @@ pub async fn get_collection(
|
||||
.filter_map(|o| {
|
||||
state.card_db.get(&o.card_id).map(|def| {
|
||||
let effective_overall = def.overall as i64 + o.training_bonus;
|
||||
let effective_position =
|
||||
o.position_override.as_deref().unwrap_or(&def.position);
|
||||
let effective_position = o.position_override.as_deref().unwrap_or(&def.position);
|
||||
let body = json!({
|
||||
"owned_card_id": o.id,
|
||||
"is_loan": o.is_loan,
|
||||
@@ -178,10 +184,9 @@ pub async fn delete_owned_card(
|
||||
.await?
|
||||
.ok_or_else(|| AppError::NotFound(format!("owned card '{owned_card_id}' not found")))?;
|
||||
|
||||
let card = state
|
||||
.card_db
|
||||
.get(&owned.card_id)
|
||||
.ok_or_else(|| AppError::NotFound(format!("card definition '{}' missing", owned.card_id)))?;
|
||||
let card = state.card_db.get(&owned.card_id).ok_or_else(|| {
|
||||
AppError::NotFound(format!("card definition '{}' missing", owned.card_id))
|
||||
})?;
|
||||
|
||||
let coins = quick_sell_coins(card.overall);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user