]> Untitled Git - lemmy.git/blob - lemmy_structs/src/site.rs
remove timing files added by accident
[lemmy.git] / lemmy_structs / src / site.rs
1 use lemmy_db::{
2   aggregates::site_aggregates::SiteAggregates,
3   views::{
4     comment_view::CommentView,
5     community::community_view::CommunityView,
6     moderator::{
7       mod_add_community_view::ModAddCommunityView,
8       mod_add_view::ModAddView,
9       mod_ban_from_community_view::ModBanFromCommunityView,
10       mod_ban_view::ModBanView,
11       mod_lock_post_view::ModLockPostView,
12       mod_remove_comment_view::ModRemoveCommentView,
13       mod_remove_community_view::ModRemoveCommunityView,
14       mod_remove_post_view::ModRemovePostView,
15       mod_sticky_post_view::ModStickyPostView,
16     },
17     post_view::PostView,
18     site_view::SiteView,
19     user_view::UserViewSafe,
20   },
21 };
22 use lemmy_db_schema::source::{category::*, user::User_};
23 use serde::{Deserialize, Serialize};
24
25 #[derive(Deserialize)]
26 pub struct ListCategories {}
27
28 #[derive(Serialize)]
29 pub struct ListCategoriesResponse {
30   pub categories: Vec<Category>,
31 }
32
33 #[derive(Deserialize, Debug)]
34 pub struct Search {
35   pub q: String,
36   pub type_: String,
37   pub community_id: Option<i32>,
38   pub community_name: Option<String>,
39   pub sort: String,
40   pub page: Option<i64>,
41   pub limit: Option<i64>,
42   pub auth: Option<String>,
43 }
44
45 #[derive(Serialize, Debug)]
46 pub struct SearchResponse {
47   pub type_: String,
48   pub comments: Vec<CommentView>,
49   pub posts: Vec<PostView>,
50   pub communities: Vec<CommunityView>,
51   pub users: Vec<UserViewSafe>,
52 }
53
54 #[derive(Deserialize)]
55 pub struct GetModlog {
56   pub mod_user_id: Option<i32>,
57   pub community_id: Option<i32>,
58   pub page: Option<i64>,
59   pub limit: Option<i64>,
60 }
61
62 #[derive(Serialize)]
63 pub struct GetModlogResponse {
64   pub removed_posts: Vec<ModRemovePostView>,
65   pub locked_posts: Vec<ModLockPostView>,
66   pub stickied_posts: Vec<ModStickyPostView>,
67   pub removed_comments: Vec<ModRemoveCommentView>,
68   pub removed_communities: Vec<ModRemoveCommunityView>,
69   pub banned_from_community: Vec<ModBanFromCommunityView>,
70   pub banned: Vec<ModBanView>,
71   pub added_to_community: Vec<ModAddCommunityView>,
72   pub added: Vec<ModAddView>,
73 }
74
75 #[derive(Deserialize)]
76 pub struct CreateSite {
77   pub name: String,
78   pub description: Option<String>,
79   pub icon: Option<String>,
80   pub banner: Option<String>,
81   pub enable_downvotes: bool,
82   pub open_registration: bool,
83   pub enable_nsfw: bool,
84   pub auth: String,
85 }
86
87 #[derive(Deserialize)]
88 pub struct EditSite {
89   pub name: String,
90   pub description: Option<String>,
91   pub icon: Option<String>,
92   pub banner: Option<String>,
93   pub enable_downvotes: bool,
94   pub open_registration: bool,
95   pub enable_nsfw: bool,
96   pub auth: String,
97 }
98
99 #[derive(Deserialize)]
100 pub struct GetSite {
101   pub auth: Option<String>,
102 }
103
104 // TODO combine siteresponse and getsiteresponse
105 #[derive(Serialize, Clone)]
106 pub struct SiteResponse {
107   pub site: SiteView,
108 }
109
110 #[derive(Serialize)]
111 pub struct GetSiteResponse {
112   pub site: Option<SiteView>, // Because the site might not be set up yet
113   pub counts: SiteAggregates,
114   pub admins: Vec<UserViewSafe>,
115   pub banned: Vec<UserViewSafe>,
116   pub online: usize,
117   pub version: String,
118   pub my_user: Option<User_>,
119   pub federated_instances: Vec<String>,
120 }
121
122 #[derive(Deserialize)]
123 pub struct TransferSite {
124   pub user_id: i32,
125   pub auth: String,
126 }
127
128 #[derive(Deserialize)]
129 pub struct GetSiteConfig {
130   pub auth: String,
131 }
132
133 #[derive(Serialize)]
134 pub struct GetSiteConfigResponse {
135   pub config_hjson: String,
136 }
137
138 #[derive(Deserialize)]
139 pub struct SaveSiteConfig {
140   pub config_hjson: String,
141   pub auth: String,
142 }