1 use lemmy_db_schema::source::{category::*, 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)]
18 pub struct ListCategories {}
21 pub struct ListCategoriesResponse {
22 pub categories: Vec<Category>,
25 #[derive(Deserialize, Debug)]
29 pub community_id: Option<i32>,
30 pub community_name: Option<String>,
32 pub page: Option<i64>,
33 pub limit: Option<i64>,
34 pub auth: Option<String>,
37 #[derive(Serialize, Debug)]
38 pub struct SearchResponse {
40 pub comments: Vec<CommentView>,
41 pub posts: Vec<PostView>,
42 pub communities: Vec<CommunityView>,
43 pub users: Vec<UserViewSafe>,
46 #[derive(Deserialize)]
47 pub struct GetModlog {
48 pub mod_user_id: Option<i32>,
49 pub community_id: Option<i32>,
50 pub page: Option<i64>,
51 pub limit: Option<i64>,
55 pub struct GetModlogResponse {
56 pub removed_posts: Vec<ModRemovePostView>,
57 pub locked_posts: Vec<ModLockPostView>,
58 pub stickied_posts: Vec<ModStickyPostView>,
59 pub removed_comments: Vec<ModRemoveCommentView>,
60 pub removed_communities: Vec<ModRemoveCommunityView>,
61 pub banned_from_community: Vec<ModBanFromCommunityView>,
62 pub banned: Vec<ModBanView>,
63 pub added_to_community: Vec<ModAddCommunityView>,
64 pub added: Vec<ModAddView>,
67 #[derive(Deserialize)]
68 pub struct CreateSite {
70 pub description: Option<String>,
71 pub icon: Option<String>,
72 pub banner: Option<String>,
73 pub enable_downvotes: bool,
74 pub open_registration: bool,
75 pub enable_nsfw: bool,
79 #[derive(Deserialize)]
82 pub description: Option<String>,
83 pub icon: Option<String>,
84 pub banner: Option<String>,
85 pub enable_downvotes: bool,
86 pub open_registration: bool,
87 pub enable_nsfw: bool,
91 #[derive(Deserialize)]
93 pub auth: Option<String>,
96 #[derive(Serialize, Clone)]
97 pub struct SiteResponse {
98 pub site_view: SiteView,
102 pub struct GetSiteResponse {
103 pub site_view: Option<SiteView>, // Because the site might not be set up yet
104 pub admins: Vec<UserViewSafe>,
105 pub banned: Vec<UserViewSafe>,
108 pub my_user: Option<UserSafeSettings>,
109 pub federated_instances: Vec<String>,
112 #[derive(Deserialize)]
113 pub struct TransferSite {
118 #[derive(Deserialize)]
119 pub struct GetSiteConfig {
124 pub struct GetSiteConfigResponse {
125 pub config_hjson: String,
128 #[derive(Deserialize)]
129 pub struct SaveSiteConfig {
130 pub config_hjson: String,