[#3] Split the tavern project into a workspace.
**tavern** - The blogging system library. **loremaster** - Creates the database from a blogging repository. **bard** - Dioxus components to display the blog.
This commit is contained in:
56
tavern/src/tale.rs
Normal file
56
tavern/src/tale.rs
Normal file
@ -0,0 +1,56 @@
|
||||
use chrono::NaiveDateTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
|
||||
/// A type alias representing the path to a Markdown file.
|
||||
/// This type is used to point to the location of the content of a `Tale`.
|
||||
#[cfg(feature = "publisher")]
|
||||
pub type Markdown = std::path::PathBuf;
|
||||
|
||||
|
||||
/// A type alias representing the HTML content of the tale.
|
||||
#[cfg(not(feature = "publisher"))]
|
||||
pub type Markdown = String;
|
||||
|
||||
|
||||
|
||||
/// Metadata describing a tale.
|
||||
///
|
||||
/// This includes details such as the title, author, summary, and
|
||||
/// associated tags.
|
||||
#[derive(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(Deserialize, Serialize)]
|
||||
pub struct Tale
|
||||
{
|
||||
/// Metadata of the post.
|
||||
#[serde(flatten)]
|
||||
pub lore: Lore,
|
||||
|
||||
/// The file path to the Markdown content of the tale.
|
||||
pub story: Markdown
|
||||
}
|
||||
Reference in New Issue
Block a user