add: user follows, user blocks, ip bans

TODO: implement user following API endpoints
TODO: implement user blocking API endpoints
TODO: don't allow blocked users to interact with the users who blocked them
This commit is contained in:
trisua 2025-03-25 21:19:55 -04:00
parent 81005a6e1c
commit 559ce19932
25 changed files with 628 additions and 127 deletions

View file

@ -4,3 +4,6 @@ pub const CREATE_TABLE_ENTRIES: &str = include_str!("./sql/create_entries.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");
pub const CREATE_TABLE_USERFOLLOWS: &str = include_str!("./sql/create_userfollows.sql");
pub const CREATE_TABLE_USERBLOCKS: &str = include_str!("./sql/create_userblocks.sql");
pub const CREATE_TABLE_IPBANS: &str = include_str!("./sql/create_ipbans.sql");

View file

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS ipbans (
ip TEXT NOT NULL,
created INTEGER NOT NULL PRIMARY KEY,
reason TEXT NOT NULL,
moderator TEXT NOT NULL
)

View file

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS userblocks (
id INTEGER NOT NULL PRIMARY KEY,
created INTEGER NOT NULL,
initiator INTEGER NOT NULL,
receiver INTEGER NOT NULL
)

View file

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS userfollows (
id INTEGER NOT NULL PRIMARY KEY,
created INTEGER NOT NULL,
initiator INTEGER NOT NULL,
receiver INTEGER NOT NULL
)

View file

@ -8,5 +8,7 @@ CREATE TABLE IF NOT EXISTS users (
tokens TEXT NOT NULL,
permissions INTEGER NOT NULL,
-- counts
notification_count INTEGER NOT NULL
notification_count INTEGER NOT NULL,
follower_count INTEGER NOT NULL,
following_count INTEGER NOT NULL
)