Update dependencies and lints

This commit is contained in:
2026-09-07 22:31:04 -07:00
parent b518d762f1
commit 9c288d051c
79 changed files with 3473 additions and 2923 deletions
+40 -11
View File
@@ -1,3 +1,5 @@
//! TMDB movie model.
use core::time::Duration;
use chrono::NaiveDate;
@@ -5,33 +7,35 @@ use chrono::NaiveDate;
use super::duration_from_minutes;
use super::id::{CollectionId, MovieId};
/// A deserialized Movie from the TMDB API
/// A deserialized Movie from the TMDB API.
#[derive(Debug, Clone, serde::Deserialize)]
#[non_exhaustive]
pub struct Movie {
/// The movie's TMDB ID
/// The movie's TMDB ID.
pub id: MovieId,
/// The movie's collection, if it exists
/// The movie's collection, if it exists.
#[serde(rename = "belongs_to_collection")]
pub collection: Option<InCollection>,
/// The movie's title
/// The movie's title.
pub title: String,
/// The movie's tagline
/// The movie's tagline.
pub tagline: String,
/// The movie's overview
/// The movie's overview.
pub overview: String,
/// The movie's release date
/// The movie's release date.
pub release_date: NaiveDate,
/// The movie's runtime
/// The movie's runtime.
#[serde(deserialize_with = "duration_from_minutes")]
pub runtime: Duration,
}
/// A deserialized movie's collection from the TMDB API
/// A deserialized movie's collection from the TMDB API.
#[derive(Debug, Clone, serde::Deserialize)]
#[non_exhaustive]
pub struct InCollection {
/// The collection's TMDB ID
/// The collection's TMDB ID.
pub id: CollectionId,
/// The collection's title
/// The collection's title.
#[serde(rename = "name")]
pub title: String,
}
@@ -43,3 +47,28 @@ pub struct InCollection {
// TODO: Company
// pub companies: Vec<Company>
// where: struct Company { id, name }
#[cfg(test)]
mod tests {
use core::time::Duration;
use chrono::NaiveDate;
use super::{CollectionId, InCollection, Movie, MovieId};
#[test]
fn use_types() {
drop(Movie {
id: MovieId::from_raw(0),
collection: Some(InCollection {
id: CollectionId::from_raw(0),
title: String::new(),
}),
title: String::new(),
tagline: String::new(),
overview: String::new(),
release_date: NaiveDate::default(),
runtime: Duration::default(),
});
}
}