chore(api): apply rustfmt across modules and tests

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chengdong Zhang
2026-09-21 18:52:52 +08:00
co-authored by Cursor
parent 6c1357ec4d
commit a4ef6ca49e
46 changed files with 495 additions and 334 deletions
+5 -9
View File
@@ -113,14 +113,14 @@ pub fn checkout_discount(
}
let now = Utc::now();
if now < coupon.starts_at || now > coupon.ends_at {
return Err(ApiError::Conflict("coupon is outside its active window".into()));
return Err(ApiError::Conflict(
"coupon is outside its active window".into(),
));
}
let from = currencies
.iter()
.find(|c| c.code == coupon.currency)
.ok_or_else(|| {
ApiError::BadRequest(format!("currency {} is disabled", coupon.currency))
})?;
.ok_or_else(|| ApiError::BadRequest(format!("currency {} is disabled", coupon.currency)))?;
let amount = convert_minor(coupon.amount_minor, from, target)?;
let threshold = convert_minor(coupon.threshold_minor, from, target)?;
if subtotal_minor < threshold {
@@ -132,11 +132,7 @@ pub fn checkout_discount(
Ok(amount.min(subtotal_minor))
}
pub async fn redeem(
tx: &mut PgConnection,
coupon_id: Uuid,
order_id: Uuid,
) -> ApiResult<Coupon> {
pub async fn redeem(tx: &mut PgConnection, coupon_id: Uuid, order_id: Uuid) -> ApiResult<Coupon> {
repo::redeem(tx, coupon_id, order_id).await
}