style: cargo fmt --all
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
use domain::{
|
||||
entities::UsageType,
|
||||
errors::DomainError,
|
||||
ports::{QuotaRepository, UsageLedgerRepository},
|
||||
storage::services::{check_quota, QuotaCheckResult},
|
||||
storage::services::{QuotaCheckResult, check_quota},
|
||||
value_objects::SystemId,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct CheckQuotaQuery {
|
||||
@@ -24,7 +24,10 @@ impl CheckQuotaHandler {
|
||||
quota_repo: Arc<dyn QuotaRepository>,
|
||||
ledger_repo: Arc<dyn UsageLedgerRepository>,
|
||||
) -> Self {
|
||||
Self { quota_repo, ledger_repo }
|
||||
Self {
|
||||
quota_repo,
|
||||
ledger_repo,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn execute(&self, query: CheckQuotaQuery) -> Result<QuotaCheckResult, DomainError> {
|
||||
@@ -39,7 +42,15 @@ impl CheckQuotaHandler {
|
||||
});
|
||||
};
|
||||
|
||||
let current = self.ledger_repo.sum_usage(&query.user_id, query.usage_type, None).await?;
|
||||
Ok(check_quota("a, query.usage_type, current, query.requested_amount))
|
||||
let current = self
|
||||
.ledger_repo
|
||||
.sum_usage(&query.user_id, query.usage_type, None)
|
||||
.await?;
|
||||
Ok(check_quota(
|
||||
"a,
|
||||
query.usage_type,
|
||||
current,
|
||||
query.requested_amount,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user