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
42
crates/pinakes-server/src/dto/collections.rs
Normal file
42
crates/pinakes-server/src/dto/collections.rs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct CollectionResponse {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub description: Option<String>,
|
||||
pub kind: String,
|
||||
pub filter_query: Option<String>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct CreateCollectionRequest {
|
||||
pub name: String,
|
||||
pub kind: String,
|
||||
pub description: Option<String>,
|
||||
pub filter_query: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct AddMemberRequest {
|
||||
pub media_id: Uuid,
|
||||
pub position: Option<i32>,
|
||||
}
|
||||
|
||||
impl From<pinakes_core::model::Collection> for CollectionResponse {
|
||||
fn from(col: pinakes_core::model::Collection) -> Self {
|
||||
Self {
|
||||
id: col.id.to_string(),
|
||||
name: col.name,
|
||||
description: col.description,
|
||||
kind: col.kind.to_string(),
|
||||
filter_query: col.filter_query,
|
||||
created_at: col.created_at,
|
||||
updated_at: col.updated_at,
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue