You've already forked flix
Improve date formats
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flix-cli"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
|
||||
categories = ["command-line-utilities"]
|
||||
description = "CLI for interacting with a flix database"
|
||||
|
||||
@@ -49,7 +49,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
entity::tmdb::collections::ActiveModel {
|
||||
tmdb_id: Set(id),
|
||||
flix_id: Set(flix.id),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
movie_count: Set(collection.movies.len().try_into().unwrap_or(0)),
|
||||
}
|
||||
.insert(txn)
|
||||
@@ -99,7 +99,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
entity::tmdb::movies::ActiveModel {
|
||||
tmdb_id: Set(id),
|
||||
flix_id: Set(flix.id),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
runtime: Set(movie.runtime.into()),
|
||||
collection_id: Set(movie.collection.map(|c| c.id)),
|
||||
}
|
||||
@@ -198,7 +198,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
entity::tmdb::shows::ActiveModel {
|
||||
tmdb_id: Set(id),
|
||||
flix_id: Set(flix.id),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
number_of_seasons: Set(show.number_of_seasons),
|
||||
}
|
||||
.insert(txn)
|
||||
@@ -220,7 +220,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
tmdb_season: Set(season.season_number),
|
||||
flix_show: Set(flix.id),
|
||||
flix_season: Set(season.season_number),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
}
|
||||
.insert(txn)
|
||||
.await?;
|
||||
@@ -246,7 +246,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
flix_show: Set(flix.id),
|
||||
flix_season: Set(season),
|
||||
flix_episode: Set(episode.episode_number),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
runtime: Set(episode.runtime.into()),
|
||||
}
|
||||
.insert(txn)
|
||||
@@ -338,7 +338,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
tmdb_season: Set(season_number),
|
||||
flix_show: Set(show.flix_id),
|
||||
flix_season: Set(season_number),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
}
|
||||
.insert(txn)
|
||||
.await?;
|
||||
@@ -362,7 +362,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
flix_show: Set(show.flix_id),
|
||||
flix_season: Set(season_number),
|
||||
flix_episode: Set(episode.episode_number),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
runtime: Set(episode.runtime.into()),
|
||||
}
|
||||
.insert(txn)
|
||||
@@ -453,7 +453,7 @@ pub async fn add(client: Client, db: &DatabaseConnection, command: Command) -> R
|
||||
flix_show: Set(flix_id),
|
||||
flix_season: Set(season),
|
||||
flix_episode: Set(episode_number),
|
||||
last_update: Set(Utc::now().naive_utc().date()),
|
||||
last_update: Set(Utc::now()),
|
||||
runtime: Set(episode.runtime.into()),
|
||||
}
|
||||
.insert(txn)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flix-db"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
|
||||
categories = []
|
||||
description = "Types for storing persistent data about media"
|
||||
|
||||
@@ -6,7 +6,7 @@ pub mod libraries {
|
||||
|
||||
use seamantic::model::path::PathBytes;
|
||||
|
||||
use chrono::NaiveDateTime;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
/// The database representation of a library media folder
|
||||
@@ -20,7 +20,7 @@ pub mod libraries {
|
||||
/// The library's directory
|
||||
pub directory: PathBytes,
|
||||
/// The library's last scan data
|
||||
pub last_scan: Option<NaiveDateTime>,
|
||||
pub last_scan: Option<DateTime<Utc>>,
|
||||
|
||||
/// Collections that are part of this library
|
||||
#[sea_orm(has_many, on_update = "Cascade", on_delete = "Cascade")]
|
||||
@@ -431,7 +431,7 @@ mod tests {
|
||||
|
||||
use flix_model::id::{CollectionId, LibraryId, MovieId, ShowId};
|
||||
|
||||
use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
|
||||
use chrono::NaiveDate;
|
||||
use sea_orm::ActiveValue::{NotSet, Set};
|
||||
use sea_orm::entity::prelude::*;
|
||||
use sea_orm::sqlx::error::ErrorKind;
|
||||
@@ -471,7 +471,7 @@ 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, NaiveDateTime::new(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt"), NaiveTime::from_hms_opt(1, 1, 1).expect("from_yo_opt")) $(, $($skip),+)?));
|
||||
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),+)?));
|
||||
};
|
||||
($db:expr, $id:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
let model = assert_library!(@insert, $db, $id $(; $($skip),+)?)
|
||||
@@ -483,7 +483,7 @@ 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(NaiveDateTime::new(NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt"), NaiveTime::from_hms_opt(1, 1, 1).expect("from_yo_opt"))) $(, $($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),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ pub mod collections {
|
||||
use flix_model::id::CollectionId as FlixId;
|
||||
use flix_tmdb::model::id::CollectionId;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -22,7 +22,7 @@ pub mod collections {
|
||||
#[sea_orm(unique)]
|
||||
pub flix_id: FlixId,
|
||||
/// The date of the last update
|
||||
pub last_update: NaiveDate,
|
||||
pub last_update: DateTime<Utc>,
|
||||
/// The number of movies in the collection
|
||||
pub movie_count: u16,
|
||||
|
||||
@@ -44,7 +44,7 @@ pub mod movies {
|
||||
|
||||
use seamantic::model::duration::Seconds;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -61,7 +61,7 @@ pub mod movies {
|
||||
#[sea_orm(unique)]
|
||||
pub flix_id: FlixId,
|
||||
/// The date of the last update
|
||||
pub last_update: NaiveDate,
|
||||
pub last_update: DateTime<Utc>,
|
||||
/// The movie's runtime in seconds
|
||||
pub runtime: Seconds,
|
||||
/// The TMDB ID of the collection this movie belongs to
|
||||
@@ -84,7 +84,7 @@ pub mod shows {
|
||||
use flix_model::id::ShowId as FlixId;
|
||||
use flix_tmdb::model::id::ShowId;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -101,7 +101,7 @@ pub mod shows {
|
||||
#[sea_orm(unique)]
|
||||
pub flix_id: FlixId,
|
||||
/// The movie's runtime in seconds
|
||||
pub last_update: NaiveDate,
|
||||
pub last_update: DateTime<Utc>,
|
||||
/// The number of seasons the show has
|
||||
pub number_of_seasons: u32,
|
||||
|
||||
@@ -125,7 +125,7 @@ pub mod seasons {
|
||||
use flix_model::numbers::SeasonNumber;
|
||||
use flix_tmdb::model::id::ShowId;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -148,7 +148,7 @@ pub mod seasons {
|
||||
#[sea_orm(unique_key = "flix")]
|
||||
pub flix_season: SeasonNumber,
|
||||
/// The date of the last update
|
||||
pub last_update: NaiveDate,
|
||||
pub last_update: DateTime<Utc>,
|
||||
|
||||
/// The show this season belongs to
|
||||
#[sea_orm(belongs_to, from = "tmdb_show", to = "tmdb_id")]
|
||||
@@ -172,7 +172,7 @@ pub mod episodes {
|
||||
use flix_tmdb::model::id::ShowId;
|
||||
use seamantic::model::duration::Seconds;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -201,7 +201,7 @@ pub mod episodes {
|
||||
#[sea_orm(unique_key = "flix")]
|
||||
pub flix_episode: EpisodeNumber,
|
||||
/// The date of the last update
|
||||
pub last_update: NaiveDate,
|
||||
pub last_update: DateTime<Utc>,
|
||||
/// The episode's runtime in seconds
|
||||
pub runtime: Seconds,
|
||||
|
||||
@@ -235,7 +235,7 @@ pub mod test {
|
||||
$crate::entity::tmdb::collections::ActiveModel {
|
||||
tmdb_id: Set(::flix_tmdb::model::id::CollectionId::from_raw($id)),
|
||||
flix_id: Set(::flix_model::id::CollectionId::from_raw($flix_id)),
|
||||
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
last_update: Set(::chrono::Utc::now()),
|
||||
movie_count: Set(::core::default::Default::default()),
|
||||
}
|
||||
.insert($db)
|
||||
@@ -250,7 +250,7 @@ pub mod test {
|
||||
$crate::entity::tmdb::movies::ActiveModel {
|
||||
tmdb_id: Set(::flix_tmdb::model::id::MovieId::from_raw($id)),
|
||||
flix_id: Set(::flix_model::id::MovieId::from_raw($flix_id)),
|
||||
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
last_update: Set(::chrono::Utc::now()),
|
||||
runtime: Set(::core::default::Default::default()),
|
||||
collection_id: Set(None),
|
||||
}
|
||||
@@ -266,7 +266,7 @@ pub mod test {
|
||||
$crate::entity::tmdb::shows::ActiveModel {
|
||||
tmdb_id: Set(::flix_tmdb::model::id::ShowId::from_raw($id)),
|
||||
flix_id: Set(::flix_model::id::ShowId::from_raw($flix_id)),
|
||||
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
last_update: Set(::chrono::Utc::now()),
|
||||
number_of_seasons: Set(::core::default::Default::default()),
|
||||
}
|
||||
.insert($db)
|
||||
@@ -283,7 +283,7 @@ pub mod test {
|
||||
tmdb_season: Set($season),
|
||||
flix_show: Set(::flix_model::id::ShowId::from_raw($flix_show)),
|
||||
flix_season: Set($flix_season),
|
||||
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
last_update: Set(::chrono::Utc::now()),
|
||||
}
|
||||
.insert($db)
|
||||
.await
|
||||
@@ -301,7 +301,7 @@ pub mod test {
|
||||
flix_show: Set(::flix_model::id::ShowId::from_raw($flix_show)),
|
||||
flix_season: Set($flix_season),
|
||||
flix_episode: Set($flix_episode),
|
||||
last_update: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
last_update: Set(::chrono::Utc::now()),
|
||||
runtime: Set(::core::default::Default::default()),
|
||||
}
|
||||
.insert($db)
|
||||
@@ -365,7 +365,7 @@ mod tests {
|
||||
|
||||
assert_eq!(model.tmdb_id, TmdbCollectionId::from_raw($tid));
|
||||
assert_eq!(model.flix_id, CollectionId::from_raw($id));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt"));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
assert_eq!(model.movie_count, $id);
|
||||
};
|
||||
($db:expr, $id:literal, $tid:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
@@ -378,7 +378,7 @@ mod tests {
|
||||
super::collections::ActiveModel {
|
||||
tmdb_id: notsettable!(tmdb_id, TmdbCollectionId::from_raw($tid) $(, $($skip),+)?),
|
||||
flix_id: notsettable!(flix_id, CollectionId::from_raw($id) $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt") $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
movie_count: notsettable!(movie_count, $id $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
@@ -412,7 +412,7 @@ mod tests {
|
||||
|
||||
assert_eq!(model.tmdb_id, TmdbMovieId::from_raw($tid));
|
||||
assert_eq!(model.flix_id, MovieId::from_raw($id));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt"));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
assert_eq!(model.runtime, Duration::from_secs($tid).into());
|
||||
assert_eq!(model.collection_id, $cid.map(TmdbCollectionId::from_raw));
|
||||
};
|
||||
@@ -426,7 +426,7 @@ mod tests {
|
||||
super::movies::ActiveModel {
|
||||
tmdb_id: notsettable!(tmdb_id, TmdbMovieId::from_raw($tid) $(, $($skip),+)?),
|
||||
flix_id: notsettable!(flix_id, MovieId::from_raw($id) $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt") $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($id, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
runtime: notsettable!(runtime, Duration::from_secs($tid).into() $(, $($skip),+)?),
|
||||
collection_id: notsettable!(collection_id, $cid.map(TmdbCollectionId::from_raw) $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
@@ -465,7 +465,7 @@ mod tests {
|
||||
|
||||
assert_eq!(model.tmdb_id, TmdbShowId::from_raw($tid));
|
||||
assert_eq!(model.flix_id, ShowId::from_raw($id));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt(2000, $tid).expect("NaiveDate::from_yo_opt"));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($tid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
assert_eq!(model.number_of_seasons, $id);
|
||||
};
|
||||
($db:expr, $id:literal, $tid:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
@@ -481,7 +481,7 @@ mod tests {
|
||||
super::shows::ActiveModel {
|
||||
tmdb_id: notsettable!(tmdb_id, TmdbShowId::from_raw($tid) $(, $($skip),+)?),
|
||||
flix_id: notsettable!(flix_id, ShowId::from_raw($id) $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt(2000, $tid).expect("NaiveDate::from_yo_opt") $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($tid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
number_of_seasons: notsettable!(number_of_seasons, $id $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
@@ -517,7 +517,7 @@ mod tests {
|
||||
assert_eq!(model.tmdb_season, $tseason);
|
||||
assert_eq!(model.flix_show, ShowId::from_raw($show));
|
||||
assert_eq!(model.flix_season, $season);
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt"));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
};
|
||||
($db:expr, $show:literal, $season:literal, $tshow:literal, $tseason:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
let model = assert_season!(@insert, $db, $show, $season, $tshow, $tseason $(; $($skip),+)?)
|
||||
@@ -534,7 +534,7 @@ mod tests {
|
||||
tmdb_season: notsettable!(tmdb_season, $tseason $(, $($skip),+)?),
|
||||
flix_show: notsettable!(flix_show, ShowId::from_raw($show) $(, $($skip),+)?),
|
||||
flix_season: notsettable!(flix_season, $season $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt") $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
}
|
||||
@@ -574,7 +574,7 @@ mod tests {
|
||||
assert_eq!(model.flix_show, ShowId::from_raw($show));
|
||||
assert_eq!(model.flix_season, $season);
|
||||
assert_eq!(model.flix_episode, $episode);
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt"));
|
||||
assert_eq!(model.last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
assert_eq!(model.runtime, Duration::from_secs($tshow).into());
|
||||
};
|
||||
($db:expr, $show:literal, $season:literal, $episode:literal, $tshow:literal, $tseason:literal, $tepisode:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
@@ -594,7 +594,7 @@ mod tests {
|
||||
flix_show: notsettable!(flix_show, ShowId::from_raw($show) $(, $($skip),+)?),
|
||||
flix_season: notsettable!(flix_season, $season $(, $($skip),+)?),
|
||||
flix_episode: notsettable!(flix_episode, $episode $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt(2000, $tshow).expect("NaiveDate::from_yo_opt") $(, $($skip),+)?),
|
||||
last_update: notsettable!(last_update, NaiveDate::from_yo_opt($tshow, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
runtime: notsettable!(runtime, Duration::from_secs($tshow).into() $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
pub mod collections {
|
||||
use flix_model::id::{CollectionId, RawId};
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -21,7 +21,7 @@ pub mod collections {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub user_id: RawId,
|
||||
/// The date this collection was watched
|
||||
pub watched_date: NaiveDate,
|
||||
pub watched_date: DateTime<Utc>,
|
||||
|
||||
/// The info for this collection
|
||||
#[sea_orm(belongs_to, relation_enum = "Info", from = "id", to = "id")]
|
||||
@@ -38,7 +38,7 @@ pub mod collections {
|
||||
pub mod movies {
|
||||
use flix_model::id::{MovieId, RawId};
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -55,7 +55,7 @@ pub mod movies {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub user_id: RawId,
|
||||
/// The date this movie was watched
|
||||
pub watched_date: NaiveDate,
|
||||
pub watched_date: DateTime<Utc>,
|
||||
|
||||
/// The info for this movie
|
||||
#[sea_orm(belongs_to, from = "id", to = "id")]
|
||||
@@ -72,7 +72,7 @@ pub mod movies {
|
||||
pub mod shows {
|
||||
use flix_model::id::{RawId, ShowId};
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -89,7 +89,7 @@ pub mod shows {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub user_id: RawId,
|
||||
/// The date this show was watched
|
||||
pub watched_date: NaiveDate,
|
||||
pub watched_date: DateTime<Utc>,
|
||||
|
||||
/// The info for this show
|
||||
#[sea_orm(belongs_to, relation_enum = "Info", from = "id", to = "id")]
|
||||
@@ -107,7 +107,7 @@ pub mod seasons {
|
||||
use flix_model::id::{RawId, ShowId};
|
||||
use flix_model::numbers::SeasonNumber;
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -127,7 +127,7 @@ pub mod seasons {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub user_id: RawId,
|
||||
/// The date this season was watched
|
||||
pub watched_date: NaiveDate,
|
||||
pub watched_date: DateTime<Utc>,
|
||||
|
||||
/// The info for this season
|
||||
#[sea_orm(
|
||||
@@ -156,7 +156,7 @@ pub mod episodes {
|
||||
use flix_model::id::{RawId, ShowId};
|
||||
use flix_model::numbers::{EpisodeNumber, SeasonNumber};
|
||||
|
||||
use chrono::NaiveDate;
|
||||
use chrono::{DateTime, Utc};
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
||||
use crate::entity;
|
||||
@@ -179,7 +179,7 @@ pub mod episodes {
|
||||
#[sea_orm(primary_key, auto_increment = false)]
|
||||
pub user_id: RawId,
|
||||
/// The date this episode was watched
|
||||
pub watched_date: NaiveDate,
|
||||
pub watched_date: DateTime<Utc>,
|
||||
|
||||
/// The info for this episode
|
||||
#[sea_orm(
|
||||
@@ -211,7 +211,7 @@ pub mod test {
|
||||
$crate::entity::watched::movies::ActiveModel {
|
||||
id: Set(::flix_model::id::MovieId::from_raw($id)),
|
||||
user_id: Set($user),
|
||||
watched_date: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
watched_date: Set(::chrono::Utc::now()),
|
||||
}
|
||||
.insert($db)
|
||||
.await
|
||||
@@ -227,7 +227,7 @@ pub mod test {
|
||||
season_number: Set($season),
|
||||
episode_number: Set($episode),
|
||||
user_id: Set($user),
|
||||
watched_date: Set(::chrono::NaiveDate::from_yo_opt(1, 1).expect("from_yo_opt")),
|
||||
watched_date: Set(::chrono::Utc::now()),
|
||||
}
|
||||
.insert($db)
|
||||
.await
|
||||
@@ -284,7 +284,7 @@ mod tests {
|
||||
|
||||
assert_eq!(model.id, MovieId::from_raw($id));
|
||||
assert_eq!(model.user_id, $uid);
|
||||
assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt"));
|
||||
assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
};
|
||||
($db:expr, $id:literal, $uid:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
let model = assert_movie!(@insert, $db, $id, $uid $(; $($skip),+)?)
|
||||
@@ -296,7 +296,7 @@ mod tests {
|
||||
super::movies::ActiveModel {
|
||||
id: notsettable!(id, MovieId::from_raw($id) $(, $($skip),+)?),
|
||||
user_id: notsettable!(user_id, $uid $(, $($skip),+)?),
|
||||
watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt") $(, $($skip),+)?),
|
||||
watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
}
|
||||
@@ -329,7 +329,7 @@ mod tests {
|
||||
assert_eq!(model.season_number, $season);
|
||||
assert_eq!(model.episode_number, $episode);
|
||||
assert_eq!(model.user_id, $uid);
|
||||
assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt"));
|
||||
assert_eq!(model.watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc());
|
||||
};
|
||||
($db:expr, $show:literal, $season:literal, $episode:literal, $uid:literal, $error:ident $(; $($skip:ident),+)?) => {
|
||||
let model = assert_episode!(@insert, $db, $show, $season, $episode, $uid $(; $($skip),+)?)
|
||||
@@ -343,7 +343,7 @@ mod tests {
|
||||
season_number: notsettable!(season_number, $season $(, $($skip),+)?),
|
||||
episode_number: notsettable!(episode_number, $episode $(, $($skip),+)?),
|
||||
user_id: notsettable!(user_id, $uid $(, $($skip),+)?),
|
||||
watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt") $(, $($skip),+)?),
|
||||
watched_date: notsettable!(watched_date, NaiveDate::from_yo_opt($uid, 1).expect("from_yo_opt").and_hms_opt(0, 0, 0).expect("and_hms_opt").and_utc() $(, $($skip),+)?),
|
||||
}.insert($db).await
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flix"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
|
||||
categories = []
|
||||
description = "Mechanisms for interacting with flix media"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flix-fs"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
|
||||
categories = []
|
||||
description = "Filesystem scanner for flix media"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flix-model"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
|
||||
categories = []
|
||||
description = "Core types for flix data"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "flix-tmdb"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
|
||||
categories = []
|
||||
description = "Clients and models for fetching data from TMDB"
|
||||
|
||||
Reference in New Issue
Block a user