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)]
26 pub community_id: Option<CommunityId>,
27 pub community_name: Option<String>,
29 pub page: Option<i64>,
30 pub limit: Option<i64>,
31 pub auth: Option<String>,
34 #[derive(Serialize, Debug)]
35 pub struct SearchResponse {
37 pub comments: Vec<CommentView>,
38 pub posts: Vec<PostView>,
39 pub communities: Vec<CommunityView>,
40 pub users: Vec<PersonViewSafe>,
43 #[derive(Deserialize)]
44 pub struct GetModlog {
45 pub mod_person_id: Option<PersonId>,
46 pub community_id: Option<CommunityId>,
47 pub page: Option<i64>,
48 pub limit: Option<i64>,
52 pub struct GetModlogResponse {
53 pub removed_posts: Vec<ModRemovePostView>,
54 pub locked_posts: Vec<ModLockPostView>,
55 pub stickied_posts: Vec<ModStickyPostView>,
56 pub removed_comments: Vec<ModRemoveCommentView>,
57 pub removed_communities: Vec<ModRemoveCommunityView>,
58 pub banned_from_community: Vec<ModBanFromCommunityView>,
59 pub banned: Vec<ModBanView>,
60 pub added_to_community: Vec<ModAddCommunityView>,
61 pub added: Vec<ModAddView>,
64 #[derive(Deserialize)]
65 pub struct CreateSite {
67 pub sidebar: Option<String>,
68 pub description: Option<String>,
69 pub icon: Option<String>,
70 pub banner: Option<String>,
71 pub enable_downvotes: bool,
72 pub open_registration: bool,
73 pub enable_nsfw: bool,
77 #[derive(Deserialize)]
80 pub sidebar: Option<String>,
81 pub description: Option<String>,
82 pub icon: Option<String>,
83 pub banner: Option<String>,
84 pub enable_downvotes: bool,
85 pub open_registration: bool,
86 pub enable_nsfw: bool,
90 #[derive(Deserialize)]
92 pub auth: Option<String>,
95 #[derive(Serialize, Clone)]
96 pub struct SiteResponse {
97 pub site_view: SiteView,
101 pub struct GetSiteResponse {
102 pub site_view: Option<SiteView>, // Because the site might not be set up yet
103 pub admins: Vec<PersonViewSafe>,
104 pub banned: Vec<PersonViewSafe>,
107 pub my_user: Option<LocalUserSettingsView>,
108 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
111 #[derive(Deserialize)]
112 pub struct TransferSite {
113 pub person_id: PersonId,
117 #[derive(Deserialize)]
118 pub struct GetSiteConfig {
123 pub struct GetSiteConfigResponse {
124 pub config_hjson: String,
127 #[derive(Deserialize)]
128 pub struct SaveSiteConfig {
129 pub config_hjson: String,
134 pub struct FederatedInstances {
135 pub linked: Vec<String>,
136 pub allowed: Option<Vec<String>>,
137 pub blocked: Option<Vec<String>>,