This commit is contained in:
@@ -45,7 +45,10 @@ pub struct ImportRow {
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RowResult {
|
||||
Valid(ImportRow),
|
||||
Invalid { errors: Vec<String>, raw: Vec<(String, String)> },
|
||||
Invalid {
|
||||
errors: Vec<String>,
|
||||
raw: Vec<(String, String)>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use crate::{
|
||||
models::FieldMapping,
|
||||
value_objects::{ImportProfileId, UserId},
|
||||
};
|
||||
use chrono::NaiveDateTime;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ImportProfile {
|
||||
@@ -21,6 +21,12 @@ impl ImportProfile {
|
||||
field_mappings: Vec<FieldMapping>,
|
||||
created_at: NaiveDateTime,
|
||||
) -> Self {
|
||||
Self { id, user_id, name, field_mappings, created_at }
|
||||
Self {
|
||||
id,
|
||||
user_id,
|
||||
name,
|
||||
field_mappings,
|
||||
created_at,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use crate::{
|
||||
models::{AnnotatedRow, FieldMapping, ParsedFile},
|
||||
value_objects::{ImportSessionId, UserId},
|
||||
};
|
||||
use chrono::NaiveDateTime;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ImportSession {
|
||||
|
||||
@@ -10,8 +10,8 @@ use crate::{
|
||||
};
|
||||
pub mod collections;
|
||||
pub mod import;
|
||||
pub mod import_session;
|
||||
pub mod import_profile;
|
||||
pub mod import_session;
|
||||
pub mod person;
|
||||
pub mod search;
|
||||
pub mod watchlist;
|
||||
@@ -20,15 +20,15 @@ pub mod remote_watchlist;
|
||||
pub use remote_watchlist::RemoteWatchlistEntry;
|
||||
|
||||
pub use import::{
|
||||
AnnotatedRow, DomainField, FieldMapping, FileFormat, ImportError,
|
||||
ImportRow, ParsedFile, RowResult, Transform,
|
||||
AnnotatedRow, DomainField, FieldMapping, FileFormat, ImportError, ImportRow, ParsedFile,
|
||||
RowResult, Transform,
|
||||
};
|
||||
pub use import_session::ImportSession;
|
||||
pub use import_profile::ImportProfile;
|
||||
pub use import_session::ImportSession;
|
||||
pub use person::{CastCredit, CrewCredit, ExternalPersonId, Person, PersonCredits, PersonId};
|
||||
pub use search::{
|
||||
EntityType, IndexableDocument, MovieSearchHit, PersonSearchHit,
|
||||
SearchFilters, SearchQuery, SearchResults,
|
||||
EntityType, IndexableDocument, MovieSearchHit, PersonSearchHit, SearchFilters, SearchQuery,
|
||||
SearchResults,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
@@ -158,7 +158,9 @@ impl Movie {
|
||||
pub enum ReviewSource {
|
||||
#[default]
|
||||
Local,
|
||||
Remote { actor_url: String },
|
||||
Remote {
|
||||
actor_url: String,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -377,7 +379,13 @@ impl User {
|
||||
self.password_hash = new_hash;
|
||||
}
|
||||
|
||||
pub fn update_profile(&mut self, bio: Option<String>, avatar_path: Option<String>, banner_path: Option<String>, also_known_as: Option<String>) {
|
||||
pub fn update_profile(
|
||||
&mut self,
|
||||
bio: Option<String>,
|
||||
avatar_path: Option<String>,
|
||||
banner_path: Option<String>,
|
||||
also_known_as: Option<String>,
|
||||
) {
|
||||
self.bio = bio;
|
||||
self.avatar_path = avatar_path;
|
||||
self.banner_path = banner_path;
|
||||
|
||||
@@ -56,7 +56,13 @@ impl Person {
|
||||
known_for_department: Option<String>,
|
||||
profile_path: Option<String>,
|
||||
) -> Self {
|
||||
Self { id, external_id, name, known_for_department, profile_path }
|
||||
Self {
|
||||
id,
|
||||
external_id,
|
||||
name,
|
||||
known_for_department,
|
||||
profile_path,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn id(&self) -> &PersonId {
|
||||
|
||||
@@ -19,7 +19,12 @@ fn make_user() -> User {
|
||||
#[test]
|
||||
fn update_profile_sets_fields() {
|
||||
let mut user = make_user();
|
||||
user.update_profile(Some("My bio".to_string()), Some("avatars/abc".to_string()), None, None);
|
||||
user.update_profile(
|
||||
Some("My bio".to_string()),
|
||||
Some("avatars/abc".to_string()),
|
||||
None,
|
||||
None,
|
||||
);
|
||||
assert_eq!(user.bio(), Some("My bio"));
|
||||
assert_eq!(user.avatar_path(), Some("avatars/abc"));
|
||||
}
|
||||
@@ -27,7 +32,12 @@ fn update_profile_sets_fields() {
|
||||
#[test]
|
||||
fn update_profile_clears_with_none() {
|
||||
let mut user = make_user();
|
||||
user.update_profile(Some("bio".to_string()), Some("path".to_string()), None, None);
|
||||
user.update_profile(
|
||||
Some("bio".to_string()),
|
||||
Some("path".to_string()),
|
||||
None,
|
||||
None,
|
||||
);
|
||||
user.update_profile(None, None, None, None);
|
||||
assert_eq!(user.bio(), None);
|
||||
assert_eq!(user.avatar_path(), None);
|
||||
|
||||
Reference in New Issue
Block a user