1 use crate::db::category::*;
2 use crate::db::comment::*;
3 use crate::db::comment_view::*;
4 use crate::db::community::*;
5 use crate::db::community_view::*;
6 use crate::db::moderator::*;
7 use crate::db::moderator_views::*;
8 use crate::db::post::*;
9 use crate::db::post_view::*;
10 use crate::db::user::*;
11 use crate::db::user_mention::*;
12 use crate::db::user_mention_view::*;
13 use crate::db::user_view::*;
14 use crate::db::password_reset_request::*;
16 use crate::{extract_usernames, has_slurs, naive_from_unix, naive_now, remove_slurs, Settings};
18 use serde::{Deserialize, Serialize};
26 #[derive(EnumString, ToString, Debug)]
27 pub enum UserOperation {
46 GetFollowedCommunities,
69 #[derive(Fail, Debug)]
70 #[fail(display = "{{\"op\":\"{}\", \"error\":\"{}\"}}", op, message)]
77 pub fn err(op: &UserOperation, msg: &str) -> Self {
80 message: msg.to_string(),
91 pub fn new(op: UserOperation, data: T) -> Oper<T> {
92 Oper { op: op, data: data }
96 pub trait Perform<T> {
97 fn perform(&self) -> Result<T, Error>