refactor
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SiteConfig {
|
||||
pub title: String,
|
||||
pub subtitle: String,
|
||||
pub welcome_title: String,
|
||||
pub welcome_subtitle: String,
|
||||
pub footer: String,
|
||||
pub favicon: String,
|
||||
pub theme: String,
|
||||
pub custom_css: String,
|
||||
}
|
||||
|
||||
impl Default for SiteConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
title: "Narlblog".to_string(),
|
||||
subtitle: "A clean, modern blog".to_string(),
|
||||
welcome_title: "Welcome to my blog".to_string(),
|
||||
welcome_subtitle: "Thoughts on software, design, and building things with Rust and Astro.".to_string(),
|
||||
footer: "Built with Rust & Astro".to_string(),
|
||||
favicon: "/favicon.svg".to_string(),
|
||||
theme: "mocha".to_string(),
|
||||
custom_css: "".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct PostInfo {
|
||||
pub slug: String,
|
||||
pub excerpt: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct PostDetail {
|
||||
pub slug: String,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct CreatePostRequest {
|
||||
pub slug: String,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct ErrorResponse {
|
||||
pub error: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub details: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct UploadResponse {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct FileInfo {
|
||||
pub name: String,
|
||||
pub url: String,
|
||||
}
|
||||
Reference in New Issue
Block a user