Model updates, bugfixes, and a new muxing cli tool

This commit is contained in:
2026-05-29 22:26:22 -06:00
parent cf4327389a
commit b6ad592951
32 changed files with 2246 additions and 453 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "flix-db"
version = "0.0.18"
version = "0.0.19"
license-file.workspace = true
description = "Types for storing persistent data about media"
+15 -5
View File
@@ -4,6 +4,7 @@
pub mod libraries {
use flix_model::id::LibraryId;
use seamantic::model::duration::Seconds;
use seamantic::model::path::PathBytes;
use chrono::{DateTime, Utc};
@@ -20,7 +21,9 @@ pub mod libraries {
/// The library's directory
pub directory: PathBytes,
/// The library's last scan data
pub last_scan: Option<DateTime<Utc>>,
pub last_scan_date: Option<DateTime<Utc>>,
/// The library's last scan duration
pub last_scan_duration: Option<Seconds>,
/// Collections that are part of this library
#[sea_orm(has_many)]
@@ -415,7 +418,8 @@ pub mod test {
$crate::entity::content::libraries::ActiveModel {
id: Set(::flix_model::id::LibraryId::from_raw($id)),
directory: Set(::std::path::PathBuf::new().into()),
last_scan: Set(None),
last_scan_date: Set(None),
last_scan_duration: Set(None),
}
.insert($db)
.await
@@ -522,10 +526,13 @@ pub mod test {
#[cfg(test)]
mod tests {
use core::time::Duration;
use std::path::Path;
use flix_model::id::{CollectionId, LibraryId, MovieId, ShowId};
use seamantic::model::duration::Seconds;
use chrono::NaiveDate;
use sea_orm::ActiveValue::{NotSet, Set};
use sea_orm::entity::prelude::*;
@@ -566,7 +573,8 @@ mod tests {
assert_eq!(model.id, LibraryId::from_raw($id));
assert_eq!(model.directory, Path::new(concat!("L Directory ", $id)).to_owned().into());
assert_eq!(model.last_scan, noneable!(last_scan, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?));
assert_eq!(model.last_scan_date, noneable!(last_scan_date, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?));
assert_eq!(model.last_scan_duration, noneable!(last_scan_duration, Seconds(Duration::from_secs($id)) $(, $($skip),+)?));
};
($db:expr, $id:literal, $error:ident $(; $($skip:ident),+)?) => {
let model = assert_library!(@insert, $db, $id $(; $($skip),+)?)
@@ -578,7 +586,8 @@ mod tests {
super::libraries::ActiveModel {
id: notsettable!(id, LibraryId::from_raw($id) $(, $($skip),+)?),
directory: notsettable!(directory, Path::new(concat!("L Directory ", $id)).to_owned().into() $(, $($skip),+)?),
last_scan: notsettable!(last_scan, Some(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc()) $(, $($skip),+)?),
last_scan_date: notsettable!(last_scan_date, Some(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc()) $(, $($skip),+)?),
last_scan_duration: notsettable!(last_scan_duration, Some(Seconds(Duration::from_secs($id))) $(, $($skip),+)?),
}.insert($db).await
};
}
@@ -588,7 +597,8 @@ mod tests {
assert_library!(&db, 2, Success);
assert_library!(&db, 3, Success; id);
assert_library!(&db, 4, NotNullViolation; directory);
assert_library!(&db, 5, Success; last_scan);
assert_library!(&db, 5, Success; last_scan_date);
assert_library!(&db, 6, Success; last_scan_duration);
}
#[tokio::test]