]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/source/moderator.rs
Adding diesel enums for SortType and ListingType (#2808)
[lemmy.git] / crates / db_schema / src / source / moderator.rs
index 000e34868de12d0a089e5a08eb8af9c6d92d6e51..3c14fd0642457a12a8e3489cb0ce2279df885340 100644 (file)
@@ -9,12 +9,12 @@ use crate::schema::{
   mod_add_community,
   mod_ban,
   mod_ban_from_community,
+  mod_feature_post,
   mod_hide_community,
   mod_lock_post,
   mod_remove_comment,
   mod_remove_community,
   mod_remove_post,
-  mod_sticky_post,
   mod_transfer_community,
 };
 use serde::{Deserialize, Serialize};
@@ -27,7 +27,7 @@ pub struct ModRemovePost {
   pub mod_person_id: PersonId,
   pub post_id: PostId,
   pub reason: Option<String>,
-  pub removed: Option<bool>,
+  pub removed: bool,
   pub when_: chrono::NaiveDateTime,
 }
 
@@ -47,7 +47,7 @@ pub struct ModLockPost {
   pub id: i32,
   pub mod_person_id: PersonId,
   pub post_id: PostId,
-  pub locked: Option<bool>,
+  pub locked: bool,
   pub when_: chrono::NaiveDateTime,
 }
 
@@ -61,21 +61,23 @@ pub struct ModLockPostForm {
 
 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
 #[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
-#[cfg_attr(feature = "full", diesel(table_name = mod_sticky_post))]
-pub struct ModStickyPost {
+#[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
+pub struct ModFeaturePost {
   pub id: i32,
   pub mod_person_id: PersonId,
   pub post_id: PostId,
-  pub stickied: Option<bool>,
+  pub featured: bool,
   pub when_: chrono::NaiveDateTime,
+  pub is_featured_community: bool,
 }
 
 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
-#[cfg_attr(feature = "full", diesel(table_name = mod_sticky_post))]
-pub struct ModStickyPostForm {
+#[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
+pub struct ModFeaturePostForm {
   pub mod_person_id: PersonId,
   pub post_id: PostId,
-  pub stickied: Option<bool>,
+  pub featured: bool,
+  pub is_featured_community: bool,
 }
 
 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
@@ -86,7 +88,7 @@ pub struct ModRemoveComment {
   pub mod_person_id: PersonId,
   pub comment_id: CommentId,
   pub reason: Option<String>,
-  pub removed: Option<bool>,
+  pub removed: bool,
   pub when_: chrono::NaiveDateTime,
 }
 
@@ -107,7 +109,7 @@ pub struct ModRemoveCommunity {
   pub mod_person_id: PersonId,
   pub community_id: CommunityId,
   pub reason: Option<String>,
-  pub removed: Option<bool>,
+  pub removed: bool,
   pub expires: Option<chrono::NaiveDateTime>,
   pub when_: chrono::NaiveDateTime,
 }
@@ -131,7 +133,7 @@ pub struct ModBanFromCommunity {
   pub other_person_id: PersonId,
   pub community_id: CommunityId,
   pub reason: Option<String>,
-  pub banned: Option<bool>,
+  pub banned: bool,
   pub expires: Option<chrono::NaiveDateTime>,
   pub when_: chrono::NaiveDateTime,
 }
@@ -155,7 +157,7 @@ pub struct ModBan {
   pub mod_person_id: PersonId,
   pub other_person_id: PersonId,
   pub reason: Option<String>,
-  pub banned: Option<bool>,
+  pub banned: bool,
   pub expires: Option<chrono::NaiveDateTime>,
   pub when_: chrono::NaiveDateTime,
 }
@@ -175,9 +177,9 @@ pub struct ModHideCommunity {
   pub id: i32,
   pub community_id: CommunityId,
   pub mod_person_id: PersonId,
-  pub reason: Option<String>,
-  pub hidden: Option<bool>,
   pub when_: chrono::NaiveDateTime,
+  pub reason: Option<String>,
+  pub hidden: bool,
 }
 
 #[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
@@ -198,7 +200,7 @@ pub struct ModAddCommunity {
   pub mod_person_id: PersonId,
   pub other_person_id: PersonId,
   pub community_id: CommunityId,
-  pub removed: Option<bool>,
+  pub removed: bool,
   pub when_: chrono::NaiveDateTime,
 }
 
@@ -219,7 +221,6 @@ pub struct ModTransferCommunity {
   pub mod_person_id: PersonId,
   pub other_person_id: PersonId,
   pub community_id: CommunityId,
-  pub removed: Option<bool>,
   pub when_: chrono::NaiveDateTime,
 }
 
@@ -229,7 +230,6 @@ pub struct ModTransferCommunityForm {
   pub mod_person_id: PersonId,
   pub other_person_id: PersonId,
   pub community_id: CommunityId,
-  pub removed: Option<bool>,
 }
 
 #[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
@@ -239,7 +239,7 @@ pub struct ModAdd {
   pub id: i32,
   pub mod_person_id: PersonId,
   pub other_person_id: PersonId,
-  pub removed: Option<bool>,
+  pub removed: bool,
   pub when_: chrono::NaiveDateTime,
 }