Skip to content

Commit

Permalink
chore(backend): remove useless part of query
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Nov 30, 2024
1 parent 27b1011 commit ed17df2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 124 deletions.
6 changes: 2 additions & 4 deletions crates/models/dependent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ use media_models::{
CreateOrUpdateCollectionInput, DailyUserActivitiesResponseGroupedBy, DailyUserActivityItem,
EntityWithLot, GenreListItem, GraphqlMediaAssets, ImportOrExportExerciseItem,
ImportOrExportMetadataGroupItem, ImportOrExportMetadataItem, ImportOrExportPersonItem,
MetadataCreatorGroupedByRole, PersonDetailsGroupedByRole, ProviderLanguageInformation,
ReviewItem, UserDetailsError, UserMediaNextEntry, UserMetadataDetailsEpisodeProgress,
UserMetadataDetailsShowSeasonProgress,
MetadataCreatorGroupedByRole, PersonDetailsGroupedByRole, ReviewItem, UserDetailsError,
UserMediaNextEntry, UserMetadataDetailsEpisodeProgress, UserMetadataDetailsShowSeasonProgress,
};
use rust_decimal::Decimal;
use schematic::Schematic;
Expand Down Expand Up @@ -166,7 +165,6 @@ pub struct CoreDetails {
pub local_auth_disabled: bool,
pub file_storage_enabled: bool,
pub backend_errors: Vec<BackendError>,
pub metadata_providers_mapping: Vec<ProviderLanguageInformation>,
}

#[derive(SimpleObject)]
Expand Down
7 changes: 0 additions & 7 deletions crates/models/media/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1031,13 +1031,6 @@ pub enum CreateCustomMediaErrorVariant {
LotDoesNotMatchSpecifics,
}

#[derive(Debug, SimpleObject, Serialize, Deserialize, Clone)]
pub struct ProviderLanguageInformation {
pub source: MediaSource,
pub supported: Vec<String>,
pub default: String,
}

#[derive(Enum, Clone, Debug, Copy, PartialEq, Eq)]
pub enum UserDetailsErrorVariant {
AuthTokenInvalid,
Expand Down
98 changes: 9 additions & 89 deletions crates/services/miscellaneous/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ use media_models::{
MetadataPartialDetails, MetadataSearchInput, MetadataSearchItemResponse, MetadataVideo,
MetadataVideoSource, PartialMetadata, PartialMetadataWithoutId, PeopleListInput,
PeopleSearchInput, PeopleSearchItem, PersonAndMetadataGroupsSortBy, PersonDetailsGroupedByRole,
PersonDetailsItemWithCharacter, PodcastSpecifics, ProgressUpdateInput,
ProviderLanguageInformation, ReviewPostedEvent, SeenAnimeExtraInformation,
SeenPodcastExtraInformation, SeenShowExtraInformation, ShowSpecifics, UpdateSeenItemInput,
UserCalendarEventInput, UserMediaNextEntry, UserMetadataDetailsEpisodeProgress,
UserMetadataDetailsShowSeasonProgress, UserUpcomingCalendarEventInput,
PersonDetailsItemWithCharacter, PodcastSpecifics, ProgressUpdateInput, ReviewPostedEvent,
SeenAnimeExtraInformation, SeenPodcastExtraInformation, SeenShowExtraInformation,
ShowSpecifics, UpdateSeenItemInput, UserCalendarEventInput, UserMediaNextEntry,
UserMetadataDetailsEpisodeProgress, UserMetadataDetailsShowSeasonProgress,
UserUpcomingCalendarEventInput,
};
use migrations::{
AliasedCalendarEvent, AliasedMetadata, AliasedMetadataToGenre, AliasedReview, AliasedSeen,
Expand All @@ -84,17 +84,9 @@ use migrations::{
use nanoid::nanoid;
use notification_service::send_notification;
use providers::{
anilist::{AnilistService, NonMediaAnilistService},
audible::AudibleService,
google_books::GoogleBooksService,
igdb::IgdbService,
itunes::ITunesService,
listennotes::ListennotesService,
mal::{MalService, NonMediaMalService},
manga_updates::MangaUpdatesService,
openlibrary::OpenlibraryService,
tmdb::TmdbService,
vndb::VndbService,
anilist::NonMediaAnilistService, audible::AudibleService, google_books::GoogleBooksService,
igdb::IgdbService, itunes::ITunesService, listennotes::ListennotesService,
mal::NonMediaMalService, manga_updates::MangaUpdatesService, vndb::VndbService,
};
use rust_decimal::Decimal;
use rust_decimal_macros::dec;
Expand All @@ -111,25 +103,12 @@ use sea_query::{
use serde::{Deserialize, Serialize};
use supporting_service::SupportingService;
use tokio::time::{sleep, Duration as TokioDuration};
use traits::{MediaProvider, MediaProviderLanguages, TraceOk};
use traits::{MediaProvider, TraceOk};
use user_models::{DashboardElementLot, UserReviewScale};
use uuid::Uuid;

type Provider = Box<(dyn MediaProvider + Send + Sync)>;

#[derive(Debug, Clone)]
struct CustomService {}

impl MediaProviderLanguages for CustomService {
fn supported_languages() -> Vec<String> {
["us"].into_iter().map(String::from).collect()
}

fn default_language() -> String {
"us".to_owned()
}
}

pub struct MiscellaneousService(pub Arc<SupportingService>);

impl MiscellaneousService {
Expand Down Expand Up @@ -262,65 +241,6 @@ ORDER BY RANDOM() LIMIT 10;
local_auth_disabled: self.0.config.users.disable_local_auth,
repository_link: "https://github.com/ignisda/ryot".to_owned(),
token_valid_for_days: self.0.config.users.token_valid_for_days,
metadata_providers_mapping: MediaSource::iter()
.map(|source| {
let (supported, default) = match source {
MediaSource::Itunes => (
ITunesService::supported_languages(),
ITunesService::default_language(),
),
MediaSource::Audible => (
AudibleService::supported_languages(),
AudibleService::default_language(),
),
MediaSource::Openlibrary => (
OpenlibraryService::supported_languages(),
OpenlibraryService::default_language(),
),
MediaSource::Tmdb => (
TmdbService::supported_languages(),
TmdbService::default_language(),
),
MediaSource::Listennotes => (
ListennotesService::supported_languages(),
ListennotesService::default_language(),
),
MediaSource::GoogleBooks => (
GoogleBooksService::supported_languages(),
GoogleBooksService::default_language(),
),
MediaSource::Igdb => (
IgdbService::supported_languages(),
IgdbService::default_language(),
),
MediaSource::MangaUpdates => (
MangaUpdatesService::supported_languages(),
MangaUpdatesService::default_language(),
),
MediaSource::Anilist => (
AnilistService::supported_languages(),
AnilistService::default_language(),
),
MediaSource::Mal => (
MalService::supported_languages(),
MalService::default_language(),
),
MediaSource::Custom => (
CustomService::supported_languages(),
CustomService::default_language(),
),
MediaSource::Vndb => (
VndbService::supported_languages(),
VndbService::default_language(),
),
};
ProviderLanguageInformation {
supported,
default,
source,
}
})
.collect(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/generated/src/graphql/backend/gql.ts

Large diffs are not rendered by default.

Loading

0 comments on commit ed17df2

Please sign in to comment.