feat: Implement blog post management including database schema, models, handlers, and UI.

This commit is contained in:
2026-03-03 16:34:38 +00:00
parent aee36fa70d
commit ef068f7dfa
7 changed files with 415 additions and 0 deletions

View File

@@ -90,6 +90,28 @@ async fn main() {
.await
.expect("Failed to create sessions table");
sqlx::query(
r#"
CREATE TABLE IF NOT EXISTS posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
author_id INTEGER NOT NULL,
title TEXT NOT NULL,
content TEXT NOT NULL,
tags TEXT NOT NULL DEFAULT '',
categories TEXT NOT NULL DEFAULT '',
visibility TEXT NOT NULL DEFAULT 'public',
password TEXT,
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL,
FOREIGN KEY(author_id) REFERENCES users(id) ON DELETE CASCADE
);
"#,
)
.execute(&db_pool)
.await
.expect("Failed to create posts table");
let app_state = Arc::new(AppState { db: db_pool });
let app = Router::new()