add: post drafts
fix: allow question sender to view question
This commit is contained in:
parent
24162573ee
commit
f6cbeb9bd8
22 changed files with 642 additions and 100 deletions
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue