1 use lemmy_db_schema::source::user::UserSafeSettings;
2 use lemmy_db_views::{comment_view::CommentView, post_view::PostView, site_view::SiteView};
3 use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
4 use lemmy_db_views_moderator::{
5 mod_add_community_view::ModAddCommunityView,
6 mod_add_view::ModAddView,
7 mod_ban_from_community_view::ModBanFromCommunityView,
8 mod_ban_view::ModBanView,
9 mod_lock_post_view::ModLockPostView,
10 mod_remove_comment_view::ModRemoveCommentView,
11 mod_remove_community_view::ModRemoveCommunityView,
12 mod_remove_post_view::ModRemovePostView,
13 mod_sticky_post_view::ModStickyPostView,
15 use serde::{Deserialize, Serialize};
17 #[derive(Deserialize, Debug)]
21 pub community_id: Option<i32>,
22 pub community_name: Option<String>,
24 pub page: Option<i64>,
25 pub limit: Option<i64>,
26 pub auth: Option<String>,
29 #[derive(Serialize, Debug)]
30 pub struct SearchResponse {
32 pub comments: Vec<CommentView>,
33 pub posts: Vec<PostView>,
34 pub communities: Vec<CommunityView>,
35 pub users: Vec<UserViewSafe>,
38 #[derive(Deserialize)]
39 pub struct GetModlog {
40 pub mod_user_id: Option<i32>,
41 pub community_id: Option<i32>,
42 pub page: Option<i64>,
43 pub limit: Option<i64>,
47 pub struct GetModlogResponse {
48 pub removed_posts: Vec<ModRemovePostView>,
49 pub locked_posts: Vec<ModLockPostView>,
50 pub stickied_posts: Vec<ModStickyPostView>,
51 pub removed_comments: Vec<ModRemoveCommentView>,
52 pub removed_communities: Vec<ModRemoveCommunityView>,
53 pub banned_from_community: Vec<ModBanFromCommunityView>,
54 pub banned: Vec<ModBanView>,
55 pub added_to_community: Vec<ModAddCommunityView>,
56 pub added: Vec<ModAddView>,
59 #[derive(Deserialize)]
60 pub struct CreateSite {
62 pub description: Option<String>,
63 pub icon: Option<String>,
64 pub banner: Option<String>,
65 pub enable_downvotes: bool,
66 pub open_registration: bool,
67 pub enable_nsfw: bool,
71 #[derive(Deserialize)]
74 pub description: Option<String>,
75 pub icon: Option<String>,
76 pub banner: Option<String>,
77 pub enable_downvotes: bool,
78 pub open_registration: bool,
79 pub enable_nsfw: bool,
83 #[derive(Deserialize)]
85 pub auth: Option<String>,
88 #[derive(Serialize, Clone)]
89 pub struct SiteResponse {
90 pub site_view: SiteView,
94 pub struct GetSiteResponse {
95 pub site_view: Option<SiteView>, // Because the site might not be set up yet
96 pub admins: Vec<UserViewSafe>,
97 pub banned: Vec<UserViewSafe>,
100 pub my_user: Option<UserSafeSettings>,
101 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
104 #[derive(Deserialize)]
105 pub struct TransferSite {
110 #[derive(Deserialize)]
111 pub struct GetSiteConfig {
116 pub struct GetSiteConfigResponse {
117 pub config_hjson: String,
120 #[derive(Deserialize)]
121 pub struct SaveSiteConfig {
122 pub config_hjson: String,
127 pub struct FederatedInstances {
128 pub linked: Vec<String>,
129 pub allowed: Vec<String>,
130 pub blocked: Vec<String>,