#![allow(clippy::too_many_arguments)] use crate::{config::*, db::*, helpers, notify::Notification}; use crossbeam_channel::Sender; use log::{error, warn}; use serde::{Deserialize, Serialize}; enum ApiError { InvalidAdminPassword, } pub async fn init_routes(app: &mut tide::Server<()>, config: &'static Config, dbs: Dbs) { // TODO pagination app.at(&format!("{}api/comments_by_topic", config.root_url)) .post({ let dbs = dbs.clone(); move |req: tide::Request<()>| query_comments_by_topic(req, config, dbs.clone()) }); } #[derive(Serialize)] struct CommentWithId { pub addr: Option, pub author: String, pub editable: bool, pub id: String, pub last_edit_time: Option