Add a album auto-create command
This commit is contained in:
parent
998bfce68f
commit
0ac02c34c6
14 changed files with 323 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
use std::path::PathBuf;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::types::AssetResponseDto;
|
||||
|
@ -5,12 +6,14 @@ use crate::types::AssetResponseDto;
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct Asset {
|
||||
pub id: Uuid,
|
||||
pub original_path: PathBuf,
|
||||
}
|
||||
|
||||
impl From<AssetResponseDto> for Asset {
|
||||
fn from(value: AssetResponseDto) -> Self {
|
||||
Self {
|
||||
id: Uuid::parse_str(&value.id).expect("Unable to parse an asset's UUID"),
|
||||
original_path: PathBuf::from(value.original_path),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ pub struct Library {
|
|||
pub asset_count: i64,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub refreshed_at: Option<DateTime<Utc>>,
|
||||
pub import_paths: Vec<String>,
|
||||
}
|
||||
|
||||
impl From<LibraryResponseDto> for Library {
|
||||
|
@ -20,6 +21,7 @@ impl From<LibraryResponseDto> for Library {
|
|||
asset_count: value.asset_count,
|
||||
updated_at: value.updated_at,
|
||||
refreshed_at: value.refreshed_at,
|
||||
import_paths: value.import_paths,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +40,7 @@ mod tests {
|
|||
name: String::from("Christmas photos"),
|
||||
asset_count: 1246,
|
||||
exclusion_patterns: vec![],
|
||||
import_paths: vec![],
|
||||
import_paths: vec![String::from("/foo"), String::from("/mnt/bar")],
|
||||
owner_id: String::from("abc123"),
|
||||
updated_at: DateTime::<Utc>::from_str("2024-11-17T12:55:12Z").unwrap(),
|
||||
created_at: DateTime::<Utc>::from_str("2023-10-17T12:55:12Z").unwrap(),
|
||||
|
@ -61,6 +63,7 @@ mod tests {
|
|||
library.refreshed_at,
|
||||
Some(DateTime::<Utc>::from_str("2024-11-17T12:53:12Z").unwrap())
|
||||
);
|
||||
assert_eq!(library.import_paths, vec!["/foo", "/mnt/bar"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue