93 lines
2.1 KiB
Rust
93 lines
2.1 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct Album {
|
|
pub id: Uuid,
|
|
pub title: String,
|
|
pub description: Option<String>,
|
|
pub cover_image_id: Option<Uuid>,
|
|
pub created_at: String,
|
|
pub updated_at: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct Image {
|
|
pub id: Uuid,
|
|
pub album_id: Uuid,
|
|
pub filename: String,
|
|
pub original_url: Option<String>,
|
|
pub title: Option<String>,
|
|
pub description: Option<String>,
|
|
pub file_size: i64,
|
|
pub width: i32,
|
|
pub height: i32,
|
|
pub mime_type: String,
|
|
pub created_at: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct AlbumWithImages {
|
|
pub album: Album,
|
|
pub images: Vec<Image>,
|
|
pub image_count: i64,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct AlbumInfo {
|
|
pub id: Uuid,
|
|
pub title: String,
|
|
pub document: String,
|
|
pub description: Option<String>,
|
|
pub cover_image_id: Option<String>,
|
|
pub image_count: i64,
|
|
pub created_at: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct CreateAlbum {
|
|
pub title: String,
|
|
pub document: String,
|
|
pub description: Option<String>,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct CreateImage {
|
|
pub album_id: Uuid,
|
|
pub filename: String,
|
|
pub original_url: Option<String>,
|
|
pub title: Option<String>,
|
|
pub description: Option<String>,
|
|
pub file_size: i64,
|
|
pub width: i32,
|
|
pub height: i32,
|
|
pub mime_type: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct Favorite {
|
|
pub id: Uuid,
|
|
pub user_id: String,
|
|
pub image_id: Uuid,
|
|
pub album_id: Uuid,
|
|
pub created_at: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct CreateFavorite {
|
|
pub image_id: Uuid,
|
|
pub album_id: Uuid,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct FavoriteWithImage {
|
|
pub favorite: Favorite,
|
|
pub image: Image,
|
|
pub album_title: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct FavoriteStatus {
|
|
pub is_favorited: bool,
|
|
pub favorite_id: Option<Uuid>,
|
|
} |