pinakes-server: split dto module into submodules
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1e9421d79010813992feb2b26c44d6796a6a6964
This commit is contained in:
parent
e66a2231b7
commit
d77e5b9f2f
21 changed files with 1530 additions and 1443 deletions
44
crates/pinakes-server/src/dto/subtitles.rs
Normal file
44
crates/pinakes-server/src/dto/subtitles.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct SubtitleResponse {
|
||||
pub id: String,
|
||||
pub media_id: String,
|
||||
pub language: Option<String>,
|
||||
pub format: String,
|
||||
pub is_embedded: bool,
|
||||
pub track_index: Option<usize>,
|
||||
pub offset_ms: i64,
|
||||
pub created_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
impl From<pinakes_core::subtitles::Subtitle> for SubtitleResponse {
|
||||
fn from(s: pinakes_core::subtitles::Subtitle) -> Self {
|
||||
Self {
|
||||
id: s.id.to_string(),
|
||||
media_id: s.media_id.0.to_string(),
|
||||
language: s.language,
|
||||
format: s.format.to_string(),
|
||||
is_embedded: s.is_embedded,
|
||||
track_index: s.track_index,
|
||||
offset_ms: s.offset_ms,
|
||||
created_at: s.created_at,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct AddSubtitleRequest {
|
||||
pub language: Option<String>,
|
||||
pub format: String,
|
||||
pub file_path: Option<String>,
|
||||
pub is_embedded: Option<bool>,
|
||||
pub track_index: Option<usize>,
|
||||
pub offset_ms: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct UpdateSubtitleOffsetRequest {
|
||||
pub offset_ms: i64,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue