add: global notes

This commit is contained in:
trisua 2025-06-26 02:56:22 -04:00
parent 59581f69c9
commit 2cd04b0db0
24 changed files with 371 additions and 608 deletions

View file

@ -60,6 +60,7 @@ pub struct Note {
pub dir: usize,
/// An array of tags associated with the note.
pub tags: Vec<String>,
pub is_global: bool,
}
impl Note {
@ -77,6 +78,7 @@ impl Note {
edited: created,
dir: 0,
tags: Vec::new(),
is_global: false,
}
}
}

View file

@ -1,41 +0,0 @@
use serde::{Serialize, Deserialize};
use tetratto_shared::{snow::Snowflake, unix_epoch_timestamp};
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct Link {
pub id: usize,
pub created: usize,
/// Links should be selected by their owner, not their link list ID.
/// This is why we do not store link list ID.
pub owner: usize,
pub label: String,
pub href: String,
/// As link icons are optional, `upload_id` is allowed to be 0.
pub upload_id: usize,
/// Clicks are tracked for supporters only.
///
/// When a user clicks on a link through the UI, they'll be redirect to
/// `/links/{id}`. If the link's owner is a supporter, the link's clicks will
/// be incremented.
///
/// The page should just serve a simple HTML document with a meta tag to redirect.
/// We only really care about knowing they clicked it, so an automatic redirect will do.
pub clicks: usize,
pub position: usize,
}
impl Link {
/// Create a new [`Link`].
pub fn new(owner: usize, label: String, href: String, position: usize) -> Self {
Self {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
created: unix_epoch_timestamp(),
owner,
label,
href,
upload_id: 0,
clicks: 0,
position,
}
}
}

View file

@ -6,7 +6,6 @@ pub mod channels;
pub mod communities;
pub mod communities_permissions;
pub mod journals;
pub mod links;
pub mod moderation;
pub mod oauth;
pub mod permissions;