add: post drafts

fix: allow question sender to view question
This commit is contained in:
trisua 2025-05-17 19:57:09 -04:00
parent 24162573ee
commit f6cbeb9bd8
22 changed files with 642 additions and 100 deletions

View file

@ -349,3 +349,23 @@ pub struct QuestionContext {
#[serde(default)]
pub is_nsfw: bool,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PostDraft {
pub id: usize,
pub created: usize,
pub content: String,
pub owner: usize,
}
impl PostDraft {
/// Create a new [`PostDraft`].
pub fn new(content: String, owner: usize) -> Self {
Self {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
created: unix_epoch_timestamp() as usize,
content,
owner,
}
}
}