2022-10-27 09:24:07 +00:00
|
|
|
#![recursion_limit = "256"]
|
|
|
|
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
#[macro_use]
|
2020-12-18 16:17:21 +00:00
|
|
|
extern crate diesel;
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
2021-03-18 20:25:21 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate diesel_derive_newtype;
|
2023-04-17 19:19:51 +00:00
|
|
|
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate diesel_derive_enum;
|
|
|
|
|
2021-10-16 13:33:38 +00:00
|
|
|
// this is used in tests
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
2021-10-16 13:33:38 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate diesel_migrations;
|
2021-03-18 20:25:21 +00:00
|
|
|
|
2022-11-17 15:23:01 +00:00
|
|
|
#[cfg(feature = "full")]
|
2022-11-09 10:05:00 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate async_trait;
|
|
|
|
|
2021-10-16 13:33:38 +00:00
|
|
|
pub mod aggregates;
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
2021-10-16 13:33:38 +00:00
|
|
|
pub mod impls;
|
|
|
|
pub mod newtypes;
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
2023-04-17 19:19:51 +00:00
|
|
|
#[rustfmt::skip]
|
2021-10-16 13:33:38 +00:00
|
|
|
pub mod schema;
|
|
|
|
pub mod source;
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
2021-10-16 13:33:38 +00:00
|
|
|
pub mod traits;
|
2022-05-03 17:44:13 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
pub mod utils;
|
2022-05-06 20:55:07 +00:00
|
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use strum_macros::{Display, EnumString};
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2022-05-06 20:55:07 +00:00
|
|
|
|
2023-04-17 19:19:51 +00:00
|
|
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
2023-04-17 19:19:51 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "full",
|
|
|
|
ExistingTypePath = "crate::schema::sql_types::SortTypeEnum"
|
|
|
|
)]
|
|
|
|
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-05-06 20:55:07 +00:00
|
|
|
pub enum SortType {
|
|
|
|
Active,
|
|
|
|
Hot,
|
|
|
|
New,
|
2022-07-30 03:55:59 +00:00
|
|
|
Old,
|
2022-05-06 20:55:07 +00:00
|
|
|
TopDay,
|
|
|
|
TopWeek,
|
|
|
|
TopMonth,
|
|
|
|
TopYear,
|
|
|
|
TopAll,
|
|
|
|
MostComments,
|
|
|
|
NewComments,
|
|
|
|
}
|
|
|
|
|
2022-07-30 03:55:59 +00:00
|
|
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-07-30 03:55:59 +00:00
|
|
|
pub enum CommentSortType {
|
|
|
|
Hot,
|
|
|
|
Top,
|
|
|
|
New,
|
|
|
|
Old,
|
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
2023-04-17 19:19:51 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "full",
|
|
|
|
ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
|
|
|
|
)]
|
|
|
|
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-05-06 20:55:07 +00:00
|
|
|
pub enum ListingType {
|
|
|
|
All,
|
|
|
|
Local,
|
|
|
|
Subscribed,
|
|
|
|
}
|
|
|
|
|
2023-04-17 19:19:51 +00:00
|
|
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
2023-04-17 19:19:51 +00:00
|
|
|
#[cfg_attr(
|
|
|
|
feature = "full",
|
|
|
|
ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
|
|
|
|
)]
|
|
|
|
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-04-17 19:19:51 +00:00
|
|
|
pub enum RegistrationMode {
|
|
|
|
Closed,
|
|
|
|
RequireApplication,
|
|
|
|
Open,
|
|
|
|
}
|
|
|
|
|
2022-05-06 20:55:07 +00:00
|
|
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-05-06 20:55:07 +00:00
|
|
|
pub enum SearchType {
|
|
|
|
All,
|
|
|
|
Comments,
|
|
|
|
Posts,
|
|
|
|
Communities,
|
|
|
|
Users,
|
|
|
|
Url,
|
|
|
|
}
|
2022-06-22 12:05:41 +00:00
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(EnumString, Display, Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-06-22 12:05:41 +00:00
|
|
|
pub enum SubscribedType {
|
|
|
|
Subscribed,
|
|
|
|
NotSubscribed,
|
|
|
|
Pending,
|
|
|
|
}
|
2022-08-16 11:52:04 +00:00
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-08-16 11:52:04 +00:00
|
|
|
pub enum ModlogActionType {
|
|
|
|
All,
|
|
|
|
ModRemovePost,
|
|
|
|
ModLockPost,
|
2022-12-12 11:17:10 +00:00
|
|
|
ModFeaturePost,
|
2022-08-16 11:52:04 +00:00
|
|
|
ModRemoveComment,
|
|
|
|
ModRemoveCommunity,
|
|
|
|
ModBanFromCommunity,
|
|
|
|
ModAddCommunity,
|
|
|
|
ModTransferCommunity,
|
|
|
|
ModAdd,
|
|
|
|
ModBan,
|
|
|
|
ModHideCommunity,
|
|
|
|
AdminPurgePerson,
|
|
|
|
AdminPurgeCommunity,
|
|
|
|
AdminPurgePost,
|
|
|
|
AdminPurgeComment,
|
|
|
|
}
|
2022-12-12 11:17:10 +00:00
|
|
|
|
|
|
|
#[derive(
|
|
|
|
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq,
|
|
|
|
)]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2022-12-12 11:17:10 +00:00
|
|
|
pub enum PostFeatureType {
|
|
|
|
#[default]
|
|
|
|
Local,
|
|
|
|
Community,
|
|
|
|
}
|