1 use lemmy_db_schema::{CommunityId, PersonId};
3 comment_view::CommentView,
4 local_user_view::LocalUserSettingsView,
8 use lemmy_db_views_actor::{community_view::CommunityView, person_view::PersonViewSafe};
9 use lemmy_db_views_moderator::{
10 mod_add_community_view::ModAddCommunityView,
11 mod_add_view::ModAddView,
12 mod_ban_from_community_view::ModBanFromCommunityView,
13 mod_ban_view::ModBanView,
14 mod_lock_post_view::ModLockPostView,
15 mod_remove_comment_view::ModRemoveCommentView,
16 mod_remove_community_view::ModRemoveCommunityView,
17 mod_remove_post_view::ModRemovePostView,
18 mod_sticky_post_view::ModStickyPostView,
20 use serde::{Deserialize, Serialize};
22 #[derive(Deserialize, Debug)]
25 pub community_id: Option<CommunityId>,
26 pub community_name: Option<String>,
27 pub creator_id: Option<PersonId>,
28 pub type_: Option<String>,
29 pub sort: Option<String>,
30 pub listing_type: Option<String>,
31 pub page: Option<i64>,
32 pub limit: Option<i64>,
33 pub auth: Option<String>,
36 #[derive(Serialize, Debug)]
37 pub struct SearchResponse {
39 pub comments: Vec<CommentView>,
40 pub posts: Vec<PostView>,
41 pub communities: Vec<CommunityView>,
42 pub users: Vec<PersonViewSafe>,
45 #[derive(Deserialize)]
46 pub struct GetModlog {
47 pub mod_person_id: Option<PersonId>,
48 pub community_id: Option<CommunityId>,
49 pub page: Option<i64>,
50 pub limit: Option<i64>,
54 pub struct GetModlogResponse {
55 pub removed_posts: Vec<ModRemovePostView>,
56 pub locked_posts: Vec<ModLockPostView>,
57 pub stickied_posts: Vec<ModStickyPostView>,
58 pub removed_comments: Vec<ModRemoveCommentView>,
59 pub removed_communities: Vec<ModRemoveCommunityView>,
60 pub banned_from_community: Vec<ModBanFromCommunityView>,
61 pub banned: Vec<ModBanView>,
62 pub added_to_community: Vec<ModAddCommunityView>,
63 pub added: Vec<ModAddView>,
66 #[derive(Deserialize)]
67 pub struct CreateSite {
69 pub sidebar: Option<String>,
70 pub description: Option<String>,
71 pub icon: Option<String>,
72 pub banner: Option<String>,
73 pub enable_downvotes: Option<bool>,
74 pub open_registration: Option<bool>,
75 pub enable_nsfw: Option<bool>,
76 pub community_creation_admin_only: Option<bool>,
80 #[derive(Deserialize)]
82 pub name: Option<String>,
83 pub sidebar: Option<String>,
84 pub description: Option<String>,
85 pub icon: Option<String>,
86 pub banner: Option<String>,
87 pub enable_downvotes: Option<bool>,
88 pub open_registration: Option<bool>,
89 pub enable_nsfw: Option<bool>,
90 pub community_creation_admin_only: Option<bool>,
94 #[derive(Deserialize)]
96 pub auth: Option<String>,
99 #[derive(Serialize, Clone)]
100 pub struct SiteResponse {
101 pub site_view: SiteView,
105 pub struct GetSiteResponse {
106 pub site_view: Option<SiteView>, // Because the site might not be set up yet
107 pub admins: Vec<PersonViewSafe>,
108 pub banned: Vec<PersonViewSafe>,
111 pub my_user: Option<LocalUserSettingsView>,
112 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
115 #[derive(Deserialize)]
116 pub struct TransferSite {
117 pub person_id: PersonId,
121 #[derive(Deserialize)]
122 pub struct GetSiteConfig {
127 pub struct GetSiteConfigResponse {
128 pub config_hjson: String,
131 #[derive(Deserialize)]
132 pub struct SaveSiteConfig {
133 pub config_hjson: String,
138 pub struct FederatedInstances {
139 pub linked: Vec<String>,
140 pub allowed: Option<Vec<String>>,
141 pub blocked: Option<Vec<String>>,