[#2] Refactored and added SQLX schema files.

This commit is contained in:
2025-08-29 19:09:05 -04:00
parent 0a16667b76
commit 7b5c69cc50
17 changed files with 242 additions and 54 deletions

View File

@ -1,24 +1,28 @@
use std::path::{Path, PathBuf};
use chrono::NaiveDate;
use tavern::{Adventurer, Database, FrontMatter, Tale, Tavern};
use tavern::{Adventurer, Database, Legend, Lore, Tale, Tavern};
#[cfg(feature = "publisher")]
fn generate_tavern() -> Tavern
{
let author: Adventurer =
Adventurer { name: String::from("Jason Smith"),
handle: String::from("myrddin"),
let legend: Legend = Legend
{
profile:
String::from("https://cybermages.tech/about/myrddin"),
image:
String::from("https://cybermages.tech/about/myrddin/pic"),
blurb: String::from("I love code!") };
let fm: FrontMatter =
FrontMatter { title: String::from("Test post"),
let author: Adventurer =
Adventurer { name: String::from("Jason Smith"),
handle: String::from("myrddin"),
legend };
let lore: Lore =
Lore { title: String::from("Test post"),
slug: String::from("test_post"),
author: author.handle.clone(),
summary: String::from("The Moon is made of cheese!"),
@ -30,8 +34,8 @@ fn generate_tavern() -> Tavern
10, 41)
.unwrap() };
let tale: Tale = Tale { front_matter: fm,
content: PathBuf::from("posts/test_post.md") };
let tale: Tale = Tale { lore,
story: PathBuf::from("posts/test_post.md") };
// Create a dummy posts directory and file for this example to work