1 use serde::{Deserialize, Serialize};
9 use db::comment_view::*;
11 use db::community_view::*;
13 use db::moderator_views::*;
15 use {has_slurs, remove_slurs, Settings, naive_now, naive_from_unix};
23 #[derive(EnumString,ToString,Debug)]
24 pub enum UserOperation {
25 Login, Register, CreateCommunity, CreatePost, ListCommunities, ListCategories, GetPost, GetCommunity, CreateComment, EditComment, SaveComment, CreateCommentLike, GetPosts, CreatePostLike, EditPost, SavePost, EditCommunity, FollowCommunity, GetFollowedCommunities, GetUserDetails, GetReplies, GetModlog, BanFromCommunity, AddModToCommunity, CreateSite, EditSite, GetSite, AddAdmin, BanUser, Search, MarkAllAsRead
28 #[derive(Fail, Debug)]
29 #[fail(display = "{{\"op\":\"{}\", \"error\":\"{}\"}}", op, message)]
36 pub fn err(op: UserOperation, msg: &str) -> Self {
39 message: msg.to_string(),
50 pub fn new(op: UserOperation, data: T) -> Oper<T> {
58 pub trait Perform<T> {
59 fn perform(&self) -> Result<T, Error> where T: Sized;