45 lines
796 B
Rust
45 lines
796 B
Rust
use crate::db::*;
|
|
|
|
use serde::Serialize;
|
|
|
|
#[derive(Serialize)]
|
|
pub enum Error {
|
|
Antispam { timeout: Time },
|
|
IllegalContent,
|
|
Internal,
|
|
InvalidRequest,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct CommentsByTopic {
|
|
pub comments: Vec<CommentWithId>,
|
|
}
|
|
|
|
#[derive(Clone, Debug, Serialize)]
|
|
pub struct OriginalComment {
|
|
pub author: String,
|
|
pub editable: bool,
|
|
pub last_edit_time: Option<Time>,
|
|
pub post_time: Time,
|
|
pub text: String,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct CommentWithId {
|
|
pub addr: Option<String>,
|
|
pub author: String,
|
|
pub editable: bool,
|
|
pub id: String,
|
|
pub last_edit_time: Option<Time>,
|
|
pub status: Option<OriginalComment>,
|
|
pub post_time: Time,
|
|
pub text: String,
|
|
}
|
|
|
|
#[derive(Serialize)]
|
|
pub struct NewComment {
|
|
pub id: String,
|
|
pub mutation_token: String,
|
|
pub post_time: Time,
|
|
}
|