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};
23 #[derive(Deserialize, Debug)]
27 pub community_id: Option<CommunityId>,
28 pub community_name: Option<String>,
30 pub page: Option<i64>,
31 pub limit: Option<i64>,
32 pub auth: Option<String>,
35 #[derive(Serialize, Debug)]
36 pub struct SearchResponse {
38 pub comments: Vec<CommentView>,
39 pub posts: Vec<PostView>,
40 pub communities: Vec<CommunityView>,
41 pub users: Vec<PersonViewSafe>,
44 #[derive(Deserialize)]
45 pub struct GetModlog {
46 pub mod_person_id: Option<PersonId>,
47 pub community_id: Option<CommunityId>,
48 pub page: Option<i64>,
49 pub limit: Option<i64>,
53 pub struct GetModlogResponse {
54 pub removed_posts: Vec<ModRemovePostView>,
55 pub locked_posts: Vec<ModLockPostView>,
56 pub stickied_posts: Vec<ModStickyPostView>,
57 pub removed_comments: Vec<ModRemoveCommentView>,
58 pub removed_communities: Vec<ModRemoveCommunityView>,
59 pub banned_from_community: Vec<ModBanFromCommunityView>,
60 pub banned: Vec<ModBanView>,
61 pub added_to_community: Vec<ModAddCommunityView>,
62 pub added: Vec<ModAddView>,
65 #[derive(Deserialize)]
66 pub struct CreateSite {
68 pub description: Option<String>,
69 pub icon: Option<Url>,
70 pub banner: Option<Url>,
71 pub enable_downvotes: bool,
72 pub open_registration: bool,
73 pub enable_nsfw: bool,
77 #[derive(Deserialize)]
80 pub description: Option<String>,
81 pub icon: Option<String>,
82 pub banner: Option<String>,
83 pub enable_downvotes: bool,
84 pub open_registration: bool,
85 pub enable_nsfw: bool,
89 #[derive(Deserialize)]
91 pub auth: Option<String>,
94 #[derive(Serialize, Clone)]
95 pub struct SiteResponse {
96 pub site_view: SiteView,
100 pub struct GetSiteResponse {
101 pub site_view: Option<SiteView>, // Because the site might not be set up yet
102 pub admins: Vec<PersonViewSafe>,
103 pub banned: Vec<PersonViewSafe>,
106 pub my_user: Option<LocalUserSettingsView>,
107 pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
110 #[derive(Deserialize)]
111 pub struct TransferSite {
112 pub person_id: PersonId,
116 #[derive(Deserialize)]
117 pub struct GetSiteConfig {
122 pub struct GetSiteConfigResponse {
123 pub config_hjson: String,
126 #[derive(Deserialize)]
127 pub struct SaveSiteConfig {
128 pub config_hjson: String,
133 pub struct FederatedInstances {
134 pub linked: Vec<String>,
135 pub allowed: Option<Vec<String>>,
136 pub blocked: Option<Vec<String>>,