Files
telecom-platform/apps/charging-engine/src/models.rs
T
nutcas3 1ee156af75 feat: Add list_rating_plans error handling, dead_code attributes, and refactor monitoring/models
- 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
2026-04-25 02:14:10 +03:00

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(),
}
}
}