]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/lib.rs
Moving settings to Database. (#2492)
[lemmy.git] / crates / db_schema / src / lib.rs
index 981ecba27f0e0e217f59c2e35f7f8e280cf28246..a859b2aabbed01055c835a18407d1333155180ad 100644 (file)
@@ -1,12 +1,95 @@
+#![recursion_limit = "256"]
+
+#[cfg(feature = "full")]
 #[macro_use]
 extern crate diesel;
+#[cfg(feature = "full")]
+#[macro_use]
+extern crate diesel_derive_newtype;
+// this is used in tests
+#[cfg(feature = "full")]
+#[allow(unused_imports)]
+#[macro_use]
+extern crate diesel_migrations;
 
-use chrono::NaiveDateTime;
-
+pub mod aggregates;
+#[cfg(feature = "full")]
+pub mod impls;
+pub mod newtypes;
+#[cfg(feature = "full")]
 pub mod schema;
 pub mod source;
+#[cfg(feature = "full")]
+pub mod traits;
+#[cfg(feature = "full")]
+pub mod utils;
+
+use serde::{Deserialize, Serialize};
+use strum_macros::{Display, EnumString};
+
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+pub enum SortType {
+  Active,
+  Hot,
+  New,
+  Old,
+  TopDay,
+  TopWeek,
+  TopMonth,
+  TopYear,
+  TopAll,
+  MostComments,
+  NewComments,
+}
+
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+pub enum CommentSortType {
+  Hot,
+  Top,
+  New,
+  Old,
+}
+
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
+pub enum ListingType {
+  All,
+  Local,
+  Subscribed,
+}
+
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
+pub enum SearchType {
+  All,
+  Comments,
+  Posts,
+  Communities,
+  Users,
+  Url,
+}
+
+#[derive(EnumString, Display, Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
+pub enum SubscribedType {
+  Subscribed,
+  NotSubscribed,
+  Pending,
+}
 
-// TODO: can probably move this back to lemmy_db_queries
-pub fn naive_now() -> NaiveDateTime {
-  chrono::prelude::Utc::now().naive_utc()
+#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
+pub enum ModlogActionType {
+  All,
+  ModRemovePost,
+  ModLockPost,
+  ModStickyPost,
+  ModRemoveComment,
+  ModRemoveCommunity,
+  ModBanFromCommunity,
+  ModAddCommunity,
+  ModTransferCommunity,
+  ModAdd,
+  ModBan,
+  ModHideCommunity,
+  AdminPurgePerson,
+  AdminPurgeCommunity,
+  AdminPurgePost,
+  AdminPurgeComment,
 }