feat: remove croxy proxy and image cache features

This commit is contained in:
asepharyana
2026-07-22 14:51:08 +07:00
parent 891064354b
commit 5c51ec895f
35 changed files with 42 additions and 2799 deletions
-111
View File
@@ -290,115 +290,4 @@ pub struct FilterAnimeItem {
pub anime_url: String,
}
// ============================================================================
// TRAITS
// ============================================================================
/// Trait for types that have a poster image URL
pub trait HasPoster {
fn poster(&self) -> &str;
fn set_poster(&mut self, url: String);
}
// ============================================================================
// TRAIT IMPLEMENTATIONS
// ============================================================================
impl HasPoster for OngoingAnimeItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for CompleteAnimeItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for CompleteAnimeListItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for OngoingAnimeListItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for LatestAnimeItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for SearchAnimeItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for GenreAnimeItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for Recommendation {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for Anime2Item {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for OngoingAnimeItemWithScore {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
impl HasPoster for FilterAnimeItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
-11
View File
@@ -3,8 +3,6 @@
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;
use crate::domain::entity::anime::HasPoster;
#[derive(Serialize, Deserialize, Debug, Clone, ToSchema)]
pub struct KomikGenre {
pub name: String,
@@ -53,12 +51,3 @@ pub struct KomikItem {
pub r#type: String,
pub komik_url: String,
}
impl HasPoster for KomikItem {
fn poster(&self) -> &str {
&self.poster
}
fn set_poster(&mut self, url: String) {
self.poster = url;
}
}
-19
View File
@@ -1,19 +0,0 @@
//! Repository trait for image cache (original → CDN mapping).
use async_trait::async_trait;
/// Repository for managing cached image URL mappings.
#[async_trait]
pub trait ImageCacheRepository: Send + Sync {
async fn get_from_redis(&self, key: &str) -> Option<String>;
async fn set_in_redis(&self, key: &str, value: &str, ttl: u64) -> Result<(), String>;
async fn get_from_db(&self, original_url: &str) -> Result<Option<String>, String>;
async fn save_to_db(&self, original_url: &str, cdn_url: &str) -> Result<(), String>;
async fn find_original_from_cdn(&self, cdn_url: &str) -> Result<Option<String>, String>;
async fn delete_from_db(&self, original_url: &str) -> Result<(), String>;
async fn delete_from_redis(&self, key: &str) -> Result<(), String>;
async fn get_lock(&self, key: &str) -> bool;
async fn set_lock(&self, key: &str, ttl: u64) -> Result<(), String>;
async fn release_lock(&self, key: &str) -> Result<(), String>;
async fn invalidate_api_caches(&self, patterns: Vec<&str>) -> Result<(), String>;
}
-2
View File
@@ -1,5 +1,3 @@
pub mod image_cache;
pub mod scraping;
pub use image_cache::ImageCacheRepository;
pub use scraping::ScrapingRepository;