🧹 Remove unused legacy modules and functions

- Deleted quota.rs module (quota management not needed via HTTP)
- Removed legacy get_id_by_token GraphQL function
- Removed unused set_user_quota and increase_user_quota methods
- Cleaned up unused imports and legacy structs
- Simplified handlers/mod.rs to only expose universal_handler

Architecture now focused on core functionality:
- GET / (user info)
- GET /<filename> (file serving)
- POST / (file upload)
This commit is contained in:
2025-09-02 11:27:48 +03:00
parent 6c03863a86
commit d3bee5144f
9 changed files with 119 additions and 331 deletions

View File

@@ -179,42 +179,4 @@ impl AppState {
Ok(new_quota)
}
/// Устанавливает квоту пользователя в байтах (позволяет увеличить или уменьшить)
pub async fn set_user_quota(&self, user_id: &str, bytes: u64) -> Result<u64, actix_web::Error> {
let mut redis = self.redis.clone();
let quota_key = format!("quota:{}", user_id);
// Устанавливаем новое значение квоты
redis
.set::<_, u64, ()>(&quota_key, bytes)
.await
.map_err(|_| ErrorInternalServerError("Failed to set user quota in Redis"))?;
Ok(bytes)
}
/// Увеличивает квоту пользователя на указанное количество байт
pub async fn increase_user_quota(
&self,
user_id: &str,
additional_bytes: u64,
) -> Result<u64, actix_web::Error> {
let mut redis = self.redis.clone();
let quota_key = format!("quota:{}", user_id);
// Получаем текущую квоту
let current_quota: u64 = redis.get(&quota_key).await.unwrap_or(0);
// Вычисляем новую квоту
let new_quota = current_quota + additional_bytes;
// Устанавливаем новое значение
redis
.set::<_, u64, ()>(&quota_key, new_quota)
.await
.map_err(|_| ErrorInternalServerError("Failed to increase user quota in Redis"))?;
Ok(new_quota)
}
}