mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-23 22:09:22 +00:00
34 lines
732 B
Rust
34 lines
732 B
Rust
|
//! # Movie API information
|
||
|
//!
|
||
|
//! @author Pierre Hubert
|
||
|
use serde::Serialize;
|
||
|
|
||
|
use crate::data::movie::Movie;
|
||
|
use crate::utils::user_data_utils::user_data_url;
|
||
|
|
||
|
#[derive(Serialize)]
|
||
|
#[allow(non_snake_case)]
|
||
|
pub struct MovieAPI {
|
||
|
id: u64,
|
||
|
uri: String,
|
||
|
url: String,
|
||
|
userID: u64,
|
||
|
name: String,
|
||
|
file_type: String,
|
||
|
size: usize,
|
||
|
}
|
||
|
|
||
|
impl MovieAPI {
|
||
|
/// Construct a new instance of movie
|
||
|
pub fn new(m: &Movie) -> MovieAPI {
|
||
|
MovieAPI {
|
||
|
id: m.id,
|
||
|
uri: m.uri.clone(),
|
||
|
url: user_data_url(m.uri.as_str()),
|
||
|
userID: m.user_id.id(),
|
||
|
name: m.name.clone(),
|
||
|
file_type: m.file_type.clone(),
|
||
|
size: m.size,
|
||
|
}
|
||
|
}
|
||
|
}
|