add: post comments

add: user follow api, user block api
This commit is contained in:
trisua 2025-03-25 22:52:47 -04:00
parent 559ce19932
commit 8580e34be2
18 changed files with 296 additions and 49 deletions

View file

@ -1,6 +1,6 @@
pub const CREATE_TABLE_USERS: &str = include_str!("./sql/create_users.sql");
pub const CREATE_TABLE_PAGES: &str = include_str!("./sql/create_pages.sql");
pub const CREATE_TABLE_ENTRIES: &str = include_str!("./sql/create_entries.sql");
pub const CREATE_TABLE_JOURNALS: &str = include_str!("./sql/create_journals.sql");
pub const CREATE_TABLE_POSTS: &str = include_str!("./sql/create_posts.sql");
pub const CREATE_TABLE_MEMBERSHIPS: &str = include_str!("./sql/create_memberships.sql");
pub const CREATE_TABLE_REACTIONS: &str = include_str!("./sql/create_reactions.sql");
pub const CREATE_TABLE_NOTIFICATIONS: &str = include_str!("./sql/create_notifications.sql");

View file

@ -61,7 +61,7 @@ impl DataManager {
#[cfg(feature = "postgres")]
#[macro_export]
macro_rules! get {
($row:ident->$idx:literal($t:tt)) => {
($row:ident->$idx:literal($t:ty)) => {
$row.get::<usize, Option<$t>>($idx).unwrap()
};
}

View file

@ -1,4 +1,4 @@
CREATE TABLE IF NOT EXISTS pages (
CREATE TABLE IF NOT EXISTS journals (
id INTEGER NOT NULL PRIMARY KEY,
created INTEGER NOT NULL,
title TEXT NOT NULL,

View file

@ -1,11 +1,14 @@
CREATE TABLE IF NOT EXISTS entries (
CREATE TABLE IF NOT EXISTS posts (
id INTEGER NOT NULL PRIMARY KEY,
created INTEGER NOT NULL,
content TEXT NOT NULL,
owner INTEGER NOT NULL,
journal INTEGER NOT NULL,
context TEXT NOT NULL,
replying_to INTEGER, -- the ID of the post this is a comment on... NULL means it isn't a reply
-- likes
likes INTEGER NOT NULL,
dislikes INTEGER NOT NULL
dislikes INTEGER NOT NULL,
-- other counts
comment_count INTEGER NOT NULL
)

View file

@ -44,7 +44,7 @@ impl DataManager {
#[macro_export]
macro_rules! get {
($row:ident->$idx:literal($t:tt)) => {
($row:ident->$idx:literal($t:ty)) => {
$row.get::<usize, $t>($idx).unwrap()
};
}