mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-18 19:12:54 +00:00
- Delete api.rs module containing 20+ handler functions (credit management, subscriber accounts, rating plans, user blocking, system stats, metrics, engine control, error stats, sync control, health checks) - Remove dead_code attributes from UsageEvent and UsageType in charging/types - Remove validate_imsi helper function and dead_code attribute from errors/helpers - Remove ConfigurationError logging case
49 lines
915 B
Rust
49 lines
915 B
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone)]
|
|
pub struct AppState {
|
|
pub charging_engine: std::sync::Arc<crate::charging::ChargingEngine>,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct CreditCheckRequest {
|
|
pub bytes_requested: u64,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct CreditCheckResponse {
|
|
pub allowed: bool,
|
|
pub remaining_bytes: i64,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct DeductRequest {
|
|
pub bytes_used: u64,
|
|
}
|
|
|
|
#[derive(Deserialize)]
|
|
pub struct AddCreditRequest {
|
|
pub bytes_to_add: u64,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct BalanceResponse {
|
|
pub ip: String,
|
|
pub balance_bytes: i64,
|
|
}
|
|
|
|
#[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(),
|
|
}
|
|
}
|
|
}
|