use crate::sensitive::Sensitive;
-use lemmy_db_schema::newtypes::{CommunityId, PersonId};
+use lemmy_db_schema::{
+ newtypes::{CommunityId, PersonId},
+ ListingType,
+ SearchType,
+ SortType,
+};
use lemmy_db_views::structs::{
CommentView,
LocalUserSettingsView,
};
use serde::{Deserialize, Serialize};
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct Search {
pub q: String,
pub community_id: Option<CommunityId>,
pub community_name: Option<String>,
pub creator_id: Option<PersonId>,
- pub type_: Option<String>,
- pub sort: Option<String>,
- pub listing_type: Option<String>,
+ pub type_: Option<SearchType>,
+ pub sort: Option<SortType>,
+ pub listing_type: Option<ListingType>,
pub page: Option<i64>,
pub limit: Option<i64>,
pub auth: Option<Sensitive<String>>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct SearchResponse {
pub type_: String,
pub comments: Vec<CommentView>,
pub users: Vec<PersonViewSafe>,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct ResolveObject {
pub q: String,
pub auth: Option<Sensitive<String>>,
pub person: Option<PersonViewSafe>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct GetModlog {
pub mod_person_id: Option<PersonId>,
pub community_id: Option<CommunityId>,
pub auth: Option<Sensitive<String>>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct GetModlogResponse {
pub removed_posts: Vec<ModRemovePostView>,
pub locked_posts: Vec<ModLockPostView>,
pub hidden_communities: Vec<ModHideCommunityView>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct CreateSite {
pub name: String,
pub sidebar: Option<String>,
pub auth: Sensitive<String>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct EditSite {
pub name: Option<String>,
pub sidebar: Option<String>,
pub auth: Sensitive<String>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct GetSite {
pub auth: Option<Sensitive<String>>,
}
pub site_view: SiteView,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct GetSiteResponse {
pub site_view: Option<SiteView>, // Because the site might not be set up yet
pub admins: Vec<PersonViewSafe>,
pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct MyUserInfo {
pub local_user_view: LocalUserSettingsView,
pub follows: Vec<CommunityFollowerView>,
pub person_blocks: Vec<PersonBlockView>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LeaveAdmin {
pub auth: Sensitive<String>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct GetSiteConfig {
pub auth: Sensitive<String>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct GetSiteConfigResponse {
pub config_hjson: String,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct SaveSiteConfig {
pub config_hjson: String,
pub auth: Sensitive<String>,
}
-#[derive(Debug, Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct FederatedInstances {
pub linked: Vec<String>,
pub allowed: Option<Vec<String>>,
pub blocked: Option<Vec<String>>,
}
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct ListRegistrationApplications {
/// Only shows the unread applications (IE those without an admin actor)
pub unread_only: Option<bool>,
pub auth: String,
}
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ListRegistrationApplicationsResponse {
pub registration_applications: Vec<RegistrationApplicationView>,
}
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub struct ApproveRegistrationApplication {
pub id: i32,
pub approve: bool,
pub auth: String,
}
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct RegistrationApplicationResponse {
pub registration_application: RegistrationApplicationView,
}
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct GetUnreadRegistrationApplicationCount {
pub auth: String,
}
-#[derive(Serialize, Deserialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct GetUnreadRegistrationApplicationCountResponse {
pub registration_applications: i64,
}