Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I928162008cb1ba02e1aa0e7aa971e8326a6a6964
60 lines
1.6 KiB
Rust
60 lines
1.6 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Serialize, utoipa::ToSchema)]
|
|
pub struct PlaylistResponse {
|
|
pub id: String,
|
|
pub owner_id: String,
|
|
pub name: String,
|
|
pub description: Option<String>,
|
|
pub is_public: bool,
|
|
pub is_smart: bool,
|
|
pub filter_query: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
pub updated_at: DateTime<Utc>,
|
|
}
|
|
|
|
impl From<pinakes_core::playlists::Playlist> for PlaylistResponse {
|
|
fn from(p: pinakes_core::playlists::Playlist) -> Self {
|
|
Self {
|
|
id: p.id.to_string(),
|
|
owner_id: p.owner_id.0.to_string(),
|
|
name: p.name,
|
|
description: p.description,
|
|
is_public: p.is_public,
|
|
is_smart: p.is_smart,
|
|
filter_query: p.filter_query,
|
|
created_at: p.created_at,
|
|
updated_at: p.updated_at,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, utoipa::ToSchema)]
|
|
pub struct CreatePlaylistRequest {
|
|
pub name: String,
|
|
pub description: Option<String>,
|
|
pub is_public: Option<bool>,
|
|
pub is_smart: Option<bool>,
|
|
pub filter_query: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, utoipa::ToSchema)]
|
|
pub struct UpdatePlaylistRequest {
|
|
pub name: Option<String>,
|
|
pub description: Option<String>,
|
|
pub is_public: Option<bool>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, utoipa::ToSchema)]
|
|
pub struct PlaylistItemRequest {
|
|
pub media_id: Uuid,
|
|
pub position: Option<i32>,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, utoipa::ToSchema)]
|
|
pub struct ReorderPlaylistRequest {
|
|
pub media_id: Uuid,
|
|
pub new_position: i32,
|
|
}
|