mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-24 05:32:16 +00:00
- Add error mapping to list_rating_plans in engine.rs - Add dead_code attributes to get/list_map/deactivate methods in rating_plans_repo and row_to_plan function - Add list method to RatingPlansRepo returning Vec<RatingPlan> - Add dead_code attribute to validate_imsi in helpers - Add UsageBlocked and ConfigurationError variants to ChargingError with Display/IntoResponse implementations - Add Default
55 lines
1.0 KiB
Rust
55 lines
1.0 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
pub charging_engine: std::sync::Arc<crate::charging::ChargingEngine>,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Deserialize)]
|
|
pub struct CreditCheckRequest {
|
|
pub bytes_requested: u64,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Serialize)]
|
|
pub struct CreditCheckResponse {
|
|
pub allowed: bool,
|
|
pub remaining_bytes: i64,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Deserialize)]
|
|
pub struct DeductRequest {
|
|
pub bytes_used: u64,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Deserialize)]
|
|
pub struct AddCreditRequest {
|
|
pub bytes_to_add: u64,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Serialize)]
|
|
pub struct BalanceResponse {
|
|
pub ip: String,
|
|
pub balance_bytes: i64,
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
#[derive(Serialize)]
|
|
pub struct HealthResponse {
|
|
pub status: String,
|
|
pub timestamp: chrono::DateTime<chrono::Utc>,
|
|
}
|
|
|
|
impl Default for HealthResponse {
|
|
fn default() -> Self {
|
|
Self {
|
|
status: "OK".to_string(),
|
|
timestamp: chrono::Utc::now(),
|
|
}
|
|
}
|
|
}
|