Add serialize

This commit is contained in:
Leon Grünewald 2024-01-01 21:50:57 +01:00
parent 5673373a7f
commit f950fa5476

View file

@ -2,7 +2,7 @@ pub type Id = u64;
pub type FileSize = u64; pub type FileSize = u64;
pub type ImageDimension = u64; pub type ImageDimension = u64;
#[derive(serde::Deserialize, Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub struct Posts { pub struct Posts {
#[serde(alias = "posts")] #[serde(alias = "posts")]
inner: Vec<Post> inner: Vec<Post>
@ -15,7 +15,7 @@ impl Into<Vec<Post>> for Posts {
} }
#[derive(serde::Deserialize, Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub struct Post { pub struct Post {
pub id: Id, pub id: Id,
pub created_at: String, pub created_at: String,
@ -35,7 +35,7 @@ pub struct Post {
pub relationships: PostRelationships pub relationships: PostRelationships
} }
#[derive(serde::Deserialize, Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub struct PostTags { pub struct PostTags {
pub general: Vec<String>, pub general: Vec<String>,
pub artist: Vec<String>, pub artist: Vec<String>,
@ -46,7 +46,7 @@ pub struct PostTags {
pub lore: Vec<String> pub lore: Vec<String>
} }
#[derive(serde::Deserialize, Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub struct PostFile { pub struct PostFile {
pub width: ImageDimension, pub width: ImageDimension,
pub height: ImageDimension, pub height: ImageDimension,
@ -56,7 +56,7 @@ pub struct PostFile {
pub url: String pub url: String
} }
#[derive(serde::Deserialize, Clone, Debug)] #[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
pub struct PostRelationships { pub struct PostRelationships {
pub parent_id: Option<Id>, pub parent_id: Option<Id>,
pub has_children: bool, pub has_children: bool,