Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I28cf5b7b7cff8e90e123d624d97cf9656a6a6964
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Serialize, utoipa::ToSchema)]
|
|
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, utoipa::ToSchema)]
|
|
pub struct CreateCollectionRequest {
|
|
pub name: String,
|
|
pub kind: String,
|
|
pub description: Option<String>,
|
|
pub filter_query: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, utoipa::ToSchema)]
|
|
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,
|
|
}
|
|
}
|
|
}
|