add: global notes
This commit is contained in:
parent
59581f69c9
commit
2cd04b0db0
24 changed files with 371 additions and 608 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue