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::password_reset_request::*;
9 use crate::db::post::*;
10 use crate::db::post_view::*;
11 use crate::db::site::*;
12 use crate::db::site_view::*;
13 use crate::db::user::*;
14 use crate::db::user_mention::*;
15 use crate::db::user_mention_view::*;
16 use crate::db::user_view::*;
18 use crate::{extract_usernames, has_slurs, naive_from_unix, naive_now, remove_slurs};
19 use diesel::PgConnection;
21 use serde::{Deserialize, Serialize};
29 #[derive(EnumString, ToString, Debug)]
30 pub enum UserOperation {
49 GetFollowedCommunities,
72 #[derive(Fail, Debug)]
73 #[fail(display = "{{\"op\":\"{}\", \"error\":\"{}\"}}", op, message)]
80 pub fn err(op: &UserOperation, msg: &str) -> Self {
83 message: msg.to_string(),
94 pub fn new(op: UserOperation, data: T) -> Oper<T> {
99 pub trait Perform<T> {
100 fn perform(&self, conn: &PgConnection) -> Result<T, Error>