]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/lib.rs
Feature add three six and nine months options backend (#3226)
[lemmy.git] / crates / db_schema / src / lib.rs
index 055c68e06ded3d5292ba9bff70e3ce51f07bea49..acb069ca7d3711a585b647f32f84c8de46bc37e1 100644 (file)
@@ -26,6 +26,7 @@ pub mod impls;
 pub mod newtypes;
 #[cfg(feature = "full")]
 #[rustfmt::skip]
+#[allow(clippy::wildcard_imports)]
 pub mod schema;
 pub mod source;
 #[cfg(feature = "full")]
@@ -35,14 +36,18 @@ pub mod utils;
 
 use serde::{Deserialize, Serialize};
 use strum_macros::{Display, EnumString};
+#[cfg(feature = "full")]
+use ts_rs::TS;
 
 #[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
-#[cfg_attr(feature = "full", derive(DbEnum))]
+#[cfg_attr(feature = "full", derive(DbEnum, TS))]
 #[cfg_attr(
   feature = "full",
   ExistingTypePath = "crate::schema::sql_types::SortTypeEnum"
 )]
 #[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
+#[cfg_attr(feature = "full", ts(export))]
+/// The post sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
 pub enum SortType {
   Active,
   Hot,
@@ -55,9 +60,18 @@ pub enum SortType {
   TopAll,
   MostComments,
   NewComments,
+  TopHour,
+  TopSixHour,
+  TopTwelveHour,
+  TopThreeMonths,
+  TopSixMonths,
+  TopNineMonths,
 }
 
 #[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
+/// The comment sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
 pub enum CommentSortType {
   Hot,
   Top,
@@ -66,32 +80,45 @@ pub enum CommentSortType {
 }
 
 #[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
-#[cfg_attr(feature = "full", derive(DbEnum))]
+#[cfg_attr(feature = "full", derive(DbEnum, TS))]
 #[cfg_attr(
   feature = "full",
   ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
 )]
 #[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
+#[cfg_attr(feature = "full", ts(export))]
+/// A listing type for post and comment list fetches.
 pub enum ListingType {
+  /// Content from your own site, as well as all connected / federated sites.
   All,
+  /// Content from your site only.
   Local,
+  /// Content only from communities you've subscribed to.
   Subscribed,
 }
 
 #[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
-#[cfg_attr(feature = "full", derive(DbEnum))]
+#[cfg_attr(feature = "full", derive(DbEnum, TS))]
 #[cfg_attr(
   feature = "full",
   ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
 )]
 #[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
+#[cfg_attr(feature = "full", ts(export))]
+/// The registration mode for your site. Determines what happens after a user signs up.
 pub enum RegistrationMode {
+  /// Closed to public.
   Closed,
+  /// Open, but pending approval of a registration application.
   RequireApplication,
+  /// Open to all.
   Open,
 }
 
 #[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
+/// The type of content returned from a search.
 pub enum SearchType {
   All,
   Comments,
@@ -102,6 +129,9 @@ pub enum SearchType {
 }
 
 #[derive(EnumString, Display, Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
+/// A type / status for a community subscribe.
 pub enum SubscribedType {
   Subscribed,
   NotSubscribed,
@@ -109,6 +139,9 @@ pub enum SubscribedType {
 }
 
 #[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
+/// A list of possible types for the various modlog actions.
 pub enum ModlogActionType {
   All,
   ModRemovePost,
@@ -131,8 +164,13 @@ pub enum ModlogActionType {
 #[derive(
   EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq,
 )]
+#[cfg_attr(feature = "full", derive(TS))]
+#[cfg_attr(feature = "full", ts(export))]
+/// The feature type for a post.
 pub enum PostFeatureType {
   #[default]
+  /// Features to the top of your site.
   Local,
+  /// Features to the top of the community.
   Community,
 }