Files
tavernworks/tavern/src/tale.rs

56 lines
1.2 KiB
Rust

use chrono::NaiveDateTime;
use serde::{Deserialize, Serialize};
#[derive(Clone, PartialEq, Deserialize, Serialize)]
pub enum Story
{
File(std::path::PathBuf),
Html(String)
}
/// Metadata describing a tale.
///
/// This includes details such as the title, author, summary, and
/// associated tags.
#[derive(Clone, PartialEq, Deserialize, Serialize)]
pub struct Lore
{
/// The title of the tale.
pub title: String,
/// A URL-friendly version of the title, used for routing and linking.
pub slug: String,
/// The name of the author who wrote the tale.
pub author: String,
/// A short summary or description of the tale.
pub summary: String,
/// A list of tags associated with the tale for categorization and
/// searching.
pub tags: Vec<String>,
/// The Date and Time that must elapse before this tale can be told.
pub publish_date: NaiveDateTime
}
/// Represents a post or story in the application.
#[derive(Clone, PartialEq, Deserialize, Serialize)]
pub struct Tale
{
/// Metadata of the post.
#[serde(flatten)]
pub lore: Lore,
/// The story content for this tale..
#[serde(flatten)]
pub story: Story
}