Upgrading ts-rs, and adding feature flag (#5777)
* Upgrading ts-rs, and adding feature flag. - Lets us remove all the ts-optionals on every field. - Should speed up compilation, and this feature is only needed for lemmy-js-client. - Fixes #5741 * Removing ts_optional_fields from enums * Updating translations. * Fix tests * Fixing translations * Adding ts-rs feature to ts_bindings script * Consolidating optional fields and export to one line. * Dont export federation_queue_state
This commit is contained in:
parent
d9df8335ea
commit
42bd941f35
9
Cargo.lock
generated
9
Cargo.lock
generated
@ -6894,12 +6894,11 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
||||
|
||||
[[package]]
|
||||
name = "ts-rs"
|
||||
version = "10.1.0"
|
||||
version = "11.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e640d9b0964e9d39df633548591090ab92f7a4567bc31d3891af23471a3365c6"
|
||||
checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"lazy_static",
|
||||
"thiserror 2.0.12",
|
||||
"ts-rs-macros",
|
||||
"url",
|
||||
@ -6907,9 +6906,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ts-rs-macros"
|
||||
version = "10.1.0"
|
||||
version = "11.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e9d8656589772eeec2cf7a8264d9cda40fb28b9bc53118ceb9e8c07f8f38730"
|
||||
checksum = "e9d4ed7b4c18cc150a6a0a1e9ea1ecfa688791220781af6e119f9599a8502a0a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -202,7 +202,7 @@ futures = "0.3.31"
|
||||
futures-util = "0.3.31"
|
||||
http = "1.2"
|
||||
rosetta-i18n = "0.1.3"
|
||||
ts-rs = { version = "10.1.0", features = [
|
||||
ts-rs = { version = "11.0.1", features = [
|
||||
"chrono-impl",
|
||||
"no-serde-warnings",
|
||||
"url-impl",
|
||||
|
@ -94,7 +94,6 @@ pub async fn leave_admin(
|
||||
admin_oauth_providers: vec![],
|
||||
blocked_urls,
|
||||
tagline,
|
||||
my_user: None,
|
||||
image_upload_disabled: context.settings().pictrs()?.image_upload_disabled,
|
||||
active_plugins: vec![],
|
||||
}))
|
||||
|
@ -54,7 +54,6 @@ async fn read_site(context: &LemmyContext) -> LemmyResult<GetSiteResponse> {
|
||||
site_view,
|
||||
admins,
|
||||
version: VERSION.to_string(),
|
||||
my_user: None,
|
||||
all_languages,
|
||||
discussion_languages,
|
||||
blocked_urls,
|
||||
|
@ -30,7 +30,6 @@ full = [
|
||||
"diesel_ltree",
|
||||
"diesel-async",
|
||||
"deadpool",
|
||||
"ts-rs",
|
||||
"tokio",
|
||||
"tokio-postgres",
|
||||
"tokio-postgres-rustls",
|
||||
@ -40,6 +39,7 @@ full = [
|
||||
"moka",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
chrono = { workspace = true }
|
||||
|
@ -33,14 +33,13 @@ use strum::{Display, EnumString};
|
||||
use {
|
||||
diesel::query_source::AliasedField,
|
||||
lemmy_db_schema_file::schema::{community_actions, instance_actions, person},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// The search sort types.
|
||||
pub enum SearchSortType {
|
||||
#[default]
|
||||
@ -51,8 +50,8 @@ pub enum SearchSortType {
|
||||
|
||||
/// The community sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
pub enum CommunitySortType {
|
||||
ActiveSixMonths,
|
||||
#[default]
|
||||
@ -73,8 +72,8 @@ pub enum CommunitySortType {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// The type of content returned from a search.
|
||||
pub enum SearchType {
|
||||
#[default]
|
||||
@ -86,8 +85,8 @@ pub enum SearchType {
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// A list of possible types for the various modlog actions.
|
||||
pub enum ModlogActionType {
|
||||
All,
|
||||
@ -111,8 +110,8 @@ pub enum ModlogActionType {
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// A list of possible types for the inbox.
|
||||
pub enum InboxDataType {
|
||||
All,
|
||||
@ -123,8 +122,8 @@ pub enum InboxDataType {
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// A list of possible types for a person's content.
|
||||
pub enum PersonContentType {
|
||||
All,
|
||||
@ -133,8 +132,8 @@ pub enum PersonContentType {
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// A list of possible types for reports.
|
||||
pub enum ReportType {
|
||||
All,
|
||||
@ -147,8 +146,8 @@ pub enum ReportType {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// The feature type for a post.
|
||||
pub enum PostFeatureType {
|
||||
#[default]
|
||||
@ -161,8 +160,8 @@ pub enum PostFeatureType {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// The like_type for a persons liked content.
|
||||
pub enum LikeType {
|
||||
#[default]
|
||||
|
@ -22,12 +22,12 @@ use {
|
||||
},
|
||||
diesel_ltree::Ltree,
|
||||
lemmy_utils::error::{LemmyErrorType, LemmyResult},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post id.
|
||||
pub struct PostId(pub i32);
|
||||
|
||||
@ -38,14 +38,16 @@ impl fmt::Display for PostId {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The person id.
|
||||
pub struct PersonId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The comment id.
|
||||
pub struct CommentId(pub i32);
|
||||
|
||||
@ -61,20 +63,23 @@ pub enum PostOrCommentId {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The community id.
|
||||
pub struct CommunityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The local user id.
|
||||
pub struct LocalUserId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The private message id.
|
||||
pub struct PrivateMessageId(pub i32);
|
||||
|
||||
@ -85,101 +90,117 @@ impl fmt::Display for PrivateMessageId {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The person comment mention id.
|
||||
pub struct PersonCommentMentionId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The person post mention id.
|
||||
pub struct PersonPostMentionId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The comment report id.
|
||||
pub struct CommentReportId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The community report id.
|
||||
pub struct CommunityReportId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post report id.
|
||||
pub struct PostReportId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The private message report id.
|
||||
pub struct PrivateMessageReportId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The site id.
|
||||
pub struct SiteId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The language id.
|
||||
pub struct LanguageId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The comment reply id.
|
||||
pub struct CommentReplyId(pub i32);
|
||||
|
||||
#[derive(
|
||||
Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default, Ord, PartialOrd,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The instance id.
|
||||
pub struct InstanceId(pub i32);
|
||||
|
||||
#[derive(
|
||||
Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default, PartialOrd, Ord,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ActivityId(pub i64);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The local site id.
|
||||
pub struct LocalSiteId(i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The custom emoji id.
|
||||
pub struct CustomEmojiId(i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The tagline id.
|
||||
pub struct TaglineId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The registration application id.
|
||||
pub struct RegistrationApplicationId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The oauth provider id.
|
||||
pub struct OAuthProviderId(pub i32);
|
||||
|
||||
@ -191,9 +212,10 @@ pub struct LtreeDef(pub String);
|
||||
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow, TS))]
|
||||
#[cfg_attr(feature = "full", derive(AsExpression, FromSqlRow))]
|
||||
#[cfg_attr(feature = "full", diesel(sql_type = diesel::sql_types::Text))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct DbUrl(pub(crate) Box<Url>);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
@ -231,88 +253,105 @@ pub struct InboxCombinedId(i32);
|
||||
pub struct SearchCombinedId(i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminAllowInstanceId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminBlockInstanceId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminPurgePersonId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminPurgeCommunityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminPurgeCommentId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminPurgePostId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModRemovePostId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModRemoveCommentId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModRemoveCommunityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModLockPostId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModFeaturePostId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModBanFromCommunityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModBanId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModChangeCommunityVisibilityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModAddCommunityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModTransferCommunityId(pub i32);
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModAddId(pub i32);
|
||||
|
||||
impl DbUrl {
|
||||
@ -421,15 +460,16 @@ impl InstanceId {
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The internal tag id.
|
||||
pub struct TagId(pub i32);
|
||||
|
||||
/// A pagination cursor
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PaginationCursor(pub String);
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -1,12 +1,11 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt::Debug, ops::Deref};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
||||
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||
#[serde(transparent)]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct SensitiveString(String);
|
||||
|
||||
impl SensitiveString {
|
||||
|
@ -8,27 +8,20 @@ use {
|
||||
diesel_ltree::Ltree,
|
||||
i_love_jesus::CursorKeysModule,
|
||||
lemmy_db_schema_file::schema::{comment, comment_actions},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(
|
||||
Queryable,
|
||||
Selectable,
|
||||
Associations,
|
||||
Identifiable,
|
||||
TS,
|
||||
CursorKeysModule
|
||||
)
|
||||
derive(Queryable, Selectable, Associations, Identifiable, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = comment))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = comment_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment.
|
||||
pub struct Comment {
|
||||
pub id: CommentId,
|
||||
@ -38,7 +31,6 @@ pub struct Comment {
|
||||
/// Whether the comment has been removed.
|
||||
pub removed: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// Whether the comment has been deleted by its creator.
|
||||
pub deleted: bool,
|
||||
@ -48,7 +40,7 @@ pub struct Comment {
|
||||
pub local: bool,
|
||||
#[cfg(feature = "full")]
|
||||
#[cfg_attr(feature = "full", serde(with = "LtreeDef"))]
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
/// The path / tree location of a comment, separated by dots, ending with the comment's id. Ex:
|
||||
/// 0.24.27
|
||||
pub path: Ltree,
|
||||
@ -123,33 +115,24 @@ pub struct CommentUpdateForm {
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(
|
||||
Identifiable,
|
||||
Queryable,
|
||||
Selectable,
|
||||
Associations,
|
||||
TS,
|
||||
CursorKeysModule
|
||||
)
|
||||
derive(Identifiable, Queryable, Selectable, Associations, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = comment_actions))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = comment_actions_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct CommentActions {
|
||||
#[serde(skip)]
|
||||
pub person_id: PersonId,
|
||||
#[serde(skip)]
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The like / score for the comment.
|
||||
pub like_score: Option<i16>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the comment was liked.
|
||||
pub liked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the comment was saved.
|
||||
pub saved_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
@ -3,18 +3,17 @@ use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::comment_reply;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment reply.
|
||||
pub struct CommentReply {
|
||||
pub id: CommentReplyId,
|
||||
|
@ -4,19 +4,18 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::comment_report;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = comment_report))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment report.
|
||||
pub struct CommentReport {
|
||||
pub id: CommentReportId,
|
||||
@ -25,10 +24,8 @@ pub struct CommentReport {
|
||||
pub original_comment_text: String,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub violates_instance_rules: bool,
|
||||
}
|
||||
|
@ -11,19 +11,19 @@ use serde_with::skip_serializing_none;
|
||||
use {
|
||||
i_love_jesus::CursorKeysModule,
|
||||
lemmy_db_schema_file::schema::{community, community_actions},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Identifiable, CursorKeysModule, TS)
|
||||
derive(Queryable, Selectable, Identifiable, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = community_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A community.
|
||||
pub struct Community {
|
||||
pub id: CommunityId,
|
||||
@ -31,12 +31,10 @@ pub struct Community {
|
||||
/// A longer title, that can contain other characters, and doesn't have to be unique.
|
||||
pub title: String,
|
||||
/// A sidebar for the community in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// Whether the community is removed by a mod.
|
||||
pub removed: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// Whether the community has been deleted by its creator.
|
||||
pub deleted: bool,
|
||||
@ -53,15 +51,13 @@ pub struct Community {
|
||||
#[serde(skip)]
|
||||
pub last_refreshed_at: DateTime<Utc>,
|
||||
/// A URL for an icon.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<DbUrl>,
|
||||
/// A URL for a banner.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<DbUrl>,
|
||||
#[cfg_attr(feature = "full", ts(skip))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(skip))]
|
||||
#[serde(skip)]
|
||||
pub followers_url: Option<DbUrl>,
|
||||
#[cfg_attr(feature = "full", ts(skip))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(skip))]
|
||||
#[serde(skip, default = "placeholder_apub_url")]
|
||||
pub inbox_url: DbUrl,
|
||||
/// Whether posting is restricted to mods only.
|
||||
@ -75,7 +71,6 @@ pub struct Community {
|
||||
pub featured_url: Option<DbUrl>,
|
||||
pub visibility: CommunityVisibility,
|
||||
/// A shorter, one-line description of the site.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
#[serde(skip)]
|
||||
pub random_number: i16,
|
||||
@ -183,14 +178,7 @@ pub struct CommunityUpdateForm {
|
||||
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(
|
||||
Identifiable,
|
||||
Queryable,
|
||||
Selectable,
|
||||
Associations,
|
||||
TS,
|
||||
CursorKeysModule
|
||||
)
|
||||
derive(Identifiable, Queryable, Selectable, Associations, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -199,32 +187,27 @@ pub struct CommunityUpdateForm {
|
||||
#[cfg_attr(feature = "full", diesel(table_name = community_actions))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, community_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = community_actions_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct CommunityActions {
|
||||
#[serde(skip)]
|
||||
pub community_id: CommunityId,
|
||||
#[serde(skip)]
|
||||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the community was followed.
|
||||
pub followed_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The state of the community follow.
|
||||
pub follow_state: Option<CommunityFollowerState>,
|
||||
/// The approver of the community follow.
|
||||
#[serde(skip)]
|
||||
pub follow_approver_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the community was blocked.
|
||||
pub blocked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When this user became a moderator.
|
||||
pub became_moderator_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When this user received a ban.
|
||||
pub received_ban_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When their ban expires.
|
||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
@ -4,14 +4,12 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::community_report;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -19,7 +17,8 @@ use ts_rs::TS;
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = community_report))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment report.
|
||||
pub struct CommunityReport {
|
||||
pub id: CommunityReportId,
|
||||
@ -27,20 +26,14 @@ pub struct CommunityReport {
|
||||
pub community_id: CommunityId,
|
||||
pub original_community_name: String,
|
||||
pub original_community_title: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_community_description: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_community_sidebar: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_community_icon: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_community_banner: Option<String>,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -4,15 +4,14 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::custom_emoji;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A custom emoji.
|
||||
pub struct CustomEmoji {
|
||||
pub id: CustomEmojiId,
|
||||
@ -21,7 +20,6 @@ pub struct CustomEmoji {
|
||||
pub alt_text: String,
|
||||
pub category: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,11 @@ use crate::newtypes::CustomEmojiId;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::custom_emoji_keyword;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = custom_emoji_keyword))]
|
||||
#[cfg_attr(
|
||||
@ -17,7 +15,8 @@ use ts_rs::TS;
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(custom_emoji_id, keyword)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A custom keyword for an emoji.
|
||||
pub struct CustomEmojiKeyword {
|
||||
pub custom_emoji_id: CustomEmojiId,
|
||||
|
@ -1,14 +1,14 @@
|
||||
use crate::newtypes::InstanceId;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::federation_blocklist;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Debug;
|
||||
#[cfg(feature = "full")]
|
||||
use {lemmy_db_schema_file::schema::federation_blocklist, ts_rs::TS};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(TS, Queryable, Selectable, Associations, Identifiable)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -17,13 +17,12 @@ use {lemmy_db_schema_file::schema::federation_blocklist, ts_rs::TS};
|
||||
#[cfg_attr(feature = "full", diesel(table_name = federation_blocklist))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct FederationBlockList {
|
||||
pub instance_id: InstanceId,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,6 @@ use chrono::{DateTime, Utc};
|
||||
use diesel::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@ -13,19 +11,17 @@ use ts_rs::TS;
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Insertable, AsChangeset)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = lemmy_db_schema_file::schema::federation_queue_state))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields))]
|
||||
pub struct FederationQueueState {
|
||||
pub instance_id: InstanceId,
|
||||
/// the last successfully sent activity id
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_successful_id: Option<ActivityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_successful_published_time_at: Option<DateTime<Utc>>,
|
||||
/// how many failed attempts have been made to send the next activity
|
||||
pub fail_count: i32,
|
||||
/// timestamp of the last retry attempt (when the last failing activity was resent)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub last_retry_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
@ -7,33 +7,25 @@ use std::fmt::Debug;
|
||||
use {
|
||||
i_love_jesus::CursorKeysModule,
|
||||
lemmy_db_schema_file::schema::{image_details, local_image, remote_image},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(
|
||||
Queryable,
|
||||
Selectable,
|
||||
Identifiable,
|
||||
Associations,
|
||||
CursorKeysModule,
|
||||
TS
|
||||
)
|
||||
derive(Queryable, Selectable, Identifiable, Associations, CursorKeysModule,)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = local_image))]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = local_image_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct LocalImage {
|
||||
pub pictrs_alias: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// This means the image is an auto-generated thumbnail, for a post.
|
||||
pub thumbnail_for_post_id: Option<PostId>,
|
||||
}
|
||||
@ -62,17 +54,17 @@ pub struct RemoteImage {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = image_details))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(link)))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ImageDetails {
|
||||
pub link: DbUrl,
|
||||
pub width: i32,
|
||||
pub height: i32,
|
||||
pub content_type: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blurhash: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -5,28 +5,24 @@ use lemmy_db_schema_file::schema::{instance, instance_actions};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use std::fmt::Debug;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = instance))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Basic data about a Fediverse instance which is available for every known domain. Additional
|
||||
/// data may be available in [[Site]].
|
||||
pub struct Instance {
|
||||
pub id: InstanceId,
|
||||
pub domain: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the instance was updated.
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The software of the instance.
|
||||
pub software: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The version of the instance's software.
|
||||
pub version: Option<String>,
|
||||
}
|
||||
@ -47,7 +43,7 @@ pub struct InstanceForm {
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -56,19 +52,17 @@ pub struct InstanceForm {
|
||||
#[cfg_attr(feature = "full", diesel(table_name = instance_actions))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, instance_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct InstanceActions {
|
||||
#[serde(skip)]
|
||||
pub person_id: PersonId,
|
||||
#[serde(skip)]
|
||||
pub instance_id: InstanceId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the instance was blocked.
|
||||
pub blocked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When this user received a site ban.
|
||||
pub received_ban_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When their ban expires.
|
||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
@ -2,14 +2,13 @@ use crate::newtypes::LanguageId;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::language;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = language))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A language.
|
||||
pub struct Language {
|
||||
pub id: LanguageId,
|
||||
|
@ -12,16 +12,15 @@ use lemmy_db_schema_file::enums::{
|
||||
use lemmy_db_schema_file::schema::local_site;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = local_site))]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The local site.
|
||||
pub struct LocalSite {
|
||||
pub id: LocalSiteId,
|
||||
@ -33,7 +32,6 @@ pub struct LocalSite {
|
||||
/// Whether emails are required.
|
||||
pub require_email_verification: bool,
|
||||
/// An optional registration application questionnaire in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_question: Option<String>,
|
||||
/// Whether the instance is private or public.
|
||||
pub private_instance: bool,
|
||||
@ -41,12 +39,10 @@ pub struct LocalSite {
|
||||
pub default_theme: String,
|
||||
pub default_post_listing_type: ListingType,
|
||||
/// An optional legal disclaimer page.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub legal_information: Option<String>,
|
||||
/// Whether new applications email admins.
|
||||
pub application_email_admins: bool,
|
||||
/// An optional regex to filter words.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub slur_filter_regex: Option<String>,
|
||||
/// The max actor name length.
|
||||
pub actor_name_max_length: i32,
|
||||
@ -57,7 +53,6 @@ pub struct LocalSite {
|
||||
/// The captcha difficulty.
|
||||
pub captcha_difficulty: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub registration_mode: RegistrationMode,
|
||||
/// Whether to email admins on new reports.
|
||||
@ -81,7 +76,6 @@ pub struct LocalSite {
|
||||
pub comment_upvotes: FederationMode,
|
||||
/// What kind of comment downvotes your site allows.
|
||||
pub comment_downvotes: FederationMode,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// A default time range limit to apply to post sorts, in seconds.
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
/// Block NSFW content being created
|
||||
|
@ -4,12 +4,10 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::local_site_rate_limit;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = local_site_rate_limit))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(local_site_id)))]
|
||||
#[cfg_attr(
|
||||
@ -17,7 +15,8 @@ use ts_rs::TS;
|
||||
diesel(belongs_to(crate::source::local_site::LocalSite))
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Rate limits for your site. Given in count / length of time.
|
||||
pub struct LocalSiteRateLimit {
|
||||
pub local_site_id: LocalSiteId,
|
||||
@ -34,7 +33,6 @@ pub struct LocalSiteRateLimit {
|
||||
pub search: i32,
|
||||
pub search_per_second: i32,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub import_user_settings: i32,
|
||||
pub import_user_settings_per_second: i32,
|
||||
|
@ -3,20 +3,18 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::local_site_url_blocklist;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = local_site_url_blocklist))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct LocalSiteUrlBlocklist {
|
||||
pub id: i32,
|
||||
pub url: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -14,15 +14,14 @@ use lemmy_db_schema_file::enums::{
|
||||
use lemmy_db_schema_file::schema::local_user;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Default)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = local_user))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
#[serde(default)]
|
||||
/// A local user.
|
||||
pub struct LocalUser {
|
||||
@ -31,7 +30,6 @@ pub struct LocalUser {
|
||||
pub person_id: PersonId,
|
||||
#[serde(skip)]
|
||||
pub password_encrypted: Option<SensitiveString>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub email: Option<SensitiveString>,
|
||||
/// Whether to show NSFW content.
|
||||
pub show_nsfw: bool,
|
||||
@ -79,7 +77,6 @@ pub struct LocalUser {
|
||||
pub last_donation_notification_at: DateTime<Utc>,
|
||||
/// Whether to hide posts containing images/videos
|
||||
pub hide_media: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// A default time range limit to apply to post sorts, in seconds.
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
pub show_score: bool,
|
||||
|
@ -4,17 +4,16 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::login_token;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
/// Stores data related to a specific user login session.
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = login_token))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(token)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct LoginToken {
|
||||
/// Jwt token for this login
|
||||
#[serde(skip)]
|
||||
@ -24,9 +23,7 @@ pub struct LoginToken {
|
||||
pub published_at: DateTime<Utc>,
|
||||
/// IP address where login was made from, allows invalidating logins by IP address.
|
||||
/// Could be stored in truncated format, or store derived information for better privacy.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub ip: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub user_agent: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -22,20 +22,18 @@ use lemmy_db_schema_file::schema::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a person.
|
||||
pub struct AdminPurgePerson {
|
||||
pub id: AdminPurgePersonId,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
@ -49,15 +47,15 @@ pub struct AdminPurgePersonForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a community.
|
||||
pub struct AdminPurgeCommunity {
|
||||
pub id: AdminPurgeCommunityId,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
@ -71,16 +69,16 @@ pub struct AdminPurgeCommunityForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a post.
|
||||
pub struct AdminPurgePost {
|
||||
pub id: AdminPurgePostId,
|
||||
pub admin_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
@ -95,16 +93,16 @@ pub struct AdminPurgePostForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a comment.
|
||||
pub struct AdminPurgeComment {
|
||||
pub id: AdminPurgeCommentId,
|
||||
pub admin_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
@ -120,7 +118,7 @@ pub struct AdminPurgeCommentForm {
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(TS, Queryable, Selectable, Associations, Identifiable)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -129,13 +127,13 @@ pub struct AdminPurgeCommentForm {
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_allow_instance))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminAllowInstance {
|
||||
pub id: AdminAllowInstanceId,
|
||||
pub instance_id: InstanceId,
|
||||
pub admin_person_id: PersonId,
|
||||
pub allowed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
@ -153,7 +151,7 @@ pub struct AdminAllowInstanceForm {
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(TS, Queryable, Selectable, Associations, Identifiable)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -162,15 +160,14 @@ pub struct AdminAllowInstanceForm {
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_block_instance))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminBlockInstance {
|
||||
pub id: AdminBlockInstanceId,
|
||||
pub instance_id: InstanceId,
|
||||
pub admin_person_id: PersonId,
|
||||
pub blocked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
@ -34,21 +34,19 @@ use lemmy_db_schema_file::schema::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator removes a post.
|
||||
pub struct ModRemovePost {
|
||||
pub id: ModRemovePostId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
@ -64,10 +62,11 @@ pub struct ModRemovePostForm {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_lock_post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator locks a post (prevents new comments being made).
|
||||
pub struct ModLockPost {
|
||||
pub id: ModLockPostId,
|
||||
@ -75,7 +74,6 @@ pub struct ModLockPost {
|
||||
pub post_id: PostId,
|
||||
pub locked: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
@ -89,10 +87,11 @@ pub struct ModLockPostForm {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_feature_post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator features a post on a community (pins it to the top).
|
||||
pub struct ModFeaturePost {
|
||||
pub id: ModFeaturePostId,
|
||||
@ -114,16 +113,16 @@ pub struct ModFeaturePostForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_comment))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator removes a comment.
|
||||
pub struct ModRemoveComment {
|
||||
pub id: ModRemoveCommentId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
@ -140,16 +139,16 @@ pub struct ModRemoveCommentForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_remove_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator removes a community.
|
||||
pub struct ModRemoveCommunity {
|
||||
pub id: ModRemoveCommunityId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub removed: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
@ -166,20 +165,19 @@ pub struct ModRemoveCommunityForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_ban_from_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is banned from a community.
|
||||
pub struct ModBanFromCommunity {
|
||||
pub id: ModBanFromCommunityId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub other_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub banned: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
@ -197,19 +195,18 @@ pub struct ModBanFromCommunityForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_ban))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is banned from the site.
|
||||
pub struct ModBan {
|
||||
pub id: ModBanId,
|
||||
pub mod_person_id: PersonId,
|
||||
pub other_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub banned: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
pub instance_id: InstanceId,
|
||||
@ -225,10 +222,11 @@ pub struct ModChangeCommunityVisibilityForm {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_change_community_visibility))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ModChangeCommunityVisibility {
|
||||
pub id: ModChangeCommunityVisibilityId,
|
||||
pub community_id: CommunityId,
|
||||
@ -249,10 +247,11 @@ pub struct ModBanForm {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_add_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is added as a community moderator.
|
||||
pub struct ModAddCommunity {
|
||||
pub id: ModAddCommunityId,
|
||||
@ -273,10 +272,11 @@ pub struct ModAddCommunityForm {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_transfer_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator transfers a community to a new owner.
|
||||
pub struct ModTransferCommunity {
|
||||
pub id: ModTransferCommunityId,
|
||||
@ -295,10 +295,11 @@ pub struct ModTransferCommunityForm {
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = mod_add))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is added as a site moderator.
|
||||
pub struct ModAdd {
|
||||
pub id: ModAddId,
|
||||
|
@ -4,22 +4,20 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::oauth_account;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = oauth_account))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// An auth account method.
|
||||
pub struct OAuthAccount {
|
||||
pub local_user_id: LocalUserId,
|
||||
pub oauth_provider_id: OAuthProviderId,
|
||||
pub oauth_user_id: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -11,34 +11,33 @@ use serde::{
|
||||
Serialize,
|
||||
};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = oauth_provider))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// oauth provider with client_secret - should never be sent to the client
|
||||
pub struct OAuthProvider {
|
||||
pub id: OAuthProviderId,
|
||||
/// The OAuth 2.0 provider name displayed to the user on the Login page
|
||||
pub display_name: String,
|
||||
/// The issuer url of the OAUTH provider.
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
pub issuer: DbUrl,
|
||||
/// The authorization endpoint is used to interact with the resource owner and obtain an
|
||||
/// authorization grant. This is usually provided by the OAUTH provider.
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
pub authorization_endpoint: DbUrl,
|
||||
/// The token endpoint is used by the client to obtain an access token by presenting its
|
||||
/// authorization grant or refresh token. This is usually provided by the OAUTH provider.
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
pub token_endpoint: DbUrl,
|
||||
/// The UserInfo Endpoint is an OAuth 2.0 Protected Resource that returns Claims about the
|
||||
/// authenticated End-User. This is defined in the OIDC specification.
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
pub userinfo_endpoint: DbUrl,
|
||||
/// The OAuth 2.0 claim containing the unique user ID returned by the provider. Usually this
|
||||
/// should be set to "sub".
|
||||
@ -60,7 +59,6 @@ pub struct OAuthProvider {
|
||||
/// switch to enable or disable an oauth provider
|
||||
pub enabled: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// switch to enable or disable PKCE
|
||||
pub use_pkce: bool,
|
||||
@ -68,8 +66,8 @@ pub struct OAuthProvider {
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]
|
||||
#[serde(transparent)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
// A subset of OAuthProvider used for public requests, for example to display the OAUTH buttons on
|
||||
// the login page
|
||||
pub struct PublicOAuthProvider(pub OAuthProvider);
|
||||
|
@ -10,36 +10,31 @@ use i_love_jesus::CursorKeysModule;
|
||||
use lemmy_db_schema_file::schema::{person, person_actions};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Identifiable, TS, CursorKeysModule)
|
||||
derive(Queryable, Selectable, Identifiable, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = person))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = person_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person.
|
||||
pub struct Person {
|
||||
pub id: PersonId,
|
||||
pub name: String,
|
||||
/// A shorter display name.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub display_name: Option<String>,
|
||||
/// A URL for an avatar.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub avatar: Option<DbUrl>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// The federated ap_id.
|
||||
pub ap_id: DbUrl,
|
||||
/// An optional bio, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub bio: Option<String>,
|
||||
/// Whether the person is local to our site.
|
||||
pub local: bool,
|
||||
@ -50,15 +45,13 @@ pub struct Person {
|
||||
#[serde(skip)]
|
||||
pub last_refreshed_at: DateTime<Utc>,
|
||||
/// A URL for a banner.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<DbUrl>,
|
||||
/// Whether the person is deleted.
|
||||
pub deleted: bool,
|
||||
#[cfg_attr(feature = "full", ts(skip))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(skip))]
|
||||
#[serde(skip, default = "placeholder_apub_url")]
|
||||
pub inbox_url: DbUrl,
|
||||
/// A matrix id, usually given an @person:matrix.org
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub matrix_user_id: Option<String>,
|
||||
/// Whether the person is a bot account.
|
||||
pub bot_account: bool,
|
||||
@ -132,13 +125,14 @@ pub struct PersonUpdateForm {
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Identifiable, Queryable, Selectable, Associations, TS)
|
||||
derive(Identifiable, Queryable, Selectable, Associations)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::person::Person)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = person_actions))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, target_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PersonActions {
|
||||
#[serde(skip)]
|
||||
pub target_id: PersonId,
|
||||
@ -148,7 +142,6 @@ pub struct PersonActions {
|
||||
pub followed_at: Option<DateTime<Utc>>,
|
||||
#[serde(skip)]
|
||||
pub follow_pending: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the person was blocked.
|
||||
pub blocked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
|
@ -3,18 +3,17 @@ use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::person_comment_mention;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = person_comment_mention))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person mention.
|
||||
pub struct PersonCommentMention {
|
||||
pub id: PersonCommentMentionId,
|
||||
|
@ -3,18 +3,17 @@ use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::person_post_mention;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = person_post_mention))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person mention.
|
||||
pub struct PersonPostMention {
|
||||
pub id: PersonPostMentionId,
|
||||
|
@ -6,28 +6,26 @@ use serde_with::skip_serializing_none;
|
||||
use {
|
||||
i_love_jesus::CursorKeysModule,
|
||||
lemmy_db_schema_file::schema::{post, post_actions},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Identifiable, TS, CursorKeysModule)
|
||||
derive(Queryable, Selectable, Identifiable, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = post_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A post.
|
||||
pub struct Post {
|
||||
pub id: PostId,
|
||||
pub name: String,
|
||||
/// An optional link / url for the post.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url: Option<DbUrl>,
|
||||
/// An optional post body, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub body: Option<String>,
|
||||
pub creator_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
@ -36,40 +34,32 @@ pub struct Post {
|
||||
/// Whether the post is locked.
|
||||
pub locked: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// Whether the post is deleted.
|
||||
pub deleted: bool,
|
||||
/// Whether the post is NSFW.
|
||||
pub nsfw: bool,
|
||||
/// A title for the link.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_title: Option<String>,
|
||||
/// A description for the link.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_description: Option<String>,
|
||||
/// A thumbnail picture url.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub thumbnail_url: Option<DbUrl>,
|
||||
/// The federated activity id / ap_id.
|
||||
pub ap_id: DbUrl,
|
||||
/// Whether the post is local.
|
||||
pub local: bool,
|
||||
/// A video url for the link.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_video_url: Option<DbUrl>,
|
||||
pub language_id: LanguageId,
|
||||
/// Whether the post is featured to its community.
|
||||
pub featured_community: bool,
|
||||
/// Whether the post is featured to its site.
|
||||
pub featured_local: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url_content_type: Option<String>,
|
||||
/// An optional alt_text, usable for image posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub alt_text: Option<String>,
|
||||
/// Time at which the post will be published. None means publish immediately.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scheduled_publish_time_at: Option<DateTime<Utc>>,
|
||||
pub comments: i64,
|
||||
pub score: i64,
|
||||
@ -182,46 +172,33 @@ pub struct PostUpdateForm {
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(
|
||||
Identifiable,
|
||||
Queryable,
|
||||
Selectable,
|
||||
Associations,
|
||||
TS,
|
||||
CursorKeysModule
|
||||
)
|
||||
derive(Identifiable, Queryable, Selectable, Associations, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = post_actions))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = post_actions_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PostActions {
|
||||
#[serde(skip)]
|
||||
pub post_id: PostId,
|
||||
#[serde(skip)]
|
||||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was read.
|
||||
pub read_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When was the last time you read the comments.
|
||||
pub read_comments_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The number of comments you read last. Subtract this from total comments to get an unread
|
||||
/// count.
|
||||
pub read_comments_amount: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was saved.
|
||||
pub saved_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was liked.
|
||||
pub liked_at: Option<DateTime<Utc>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// The like / score of the post.
|
||||
pub like_score: Option<i16>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// When the post was hidden.
|
||||
pub hidden_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
@ -4,19 +4,18 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::post_report;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Identifiable, Queryable, Selectable, Associations, TS)
|
||||
derive(Identifiable, Queryable, Selectable, Associations)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))] // Is this the right assoc?
|
||||
#[cfg_attr(feature = "full", diesel(table_name = post_report))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A post report.
|
||||
pub struct PostReport {
|
||||
pub id: PostReportId,
|
||||
@ -25,17 +24,13 @@ pub struct PostReport {
|
||||
/// The original post title.
|
||||
pub original_post_name: String,
|
||||
/// The original post url.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_post_url: Option<DbUrl>,
|
||||
/// The original post body.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub original_post_body: Option<String>,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub violates_instance_rules: bool,
|
||||
}
|
||||
|
@ -4,14 +4,12 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::private_message;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -19,7 +17,8 @@ use ts_rs::TS;
|
||||
))] // Is this the right assoc?
|
||||
#[cfg_attr(feature = "full", diesel(table_name = private_message))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A private message.
|
||||
pub struct PrivateMessage {
|
||||
pub id: PrivateMessageId,
|
||||
@ -29,7 +28,6 @@ pub struct PrivateMessage {
|
||||
pub deleted: bool,
|
||||
pub read: bool,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub ap_id: DbUrl,
|
||||
pub local: bool,
|
||||
|
@ -4,14 +4,12 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::private_message_report;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
||||
derive(Queryable, Selectable, Associations, Identifiable)
|
||||
)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
@ -19,7 +17,8 @@ use ts_rs::TS;
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = private_message_report))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The private message report.
|
||||
pub struct PrivateMessageReport {
|
||||
pub id: PrivateMessageReportId,
|
||||
@ -29,10 +28,8 @@ pub struct PrivateMessageReport {
|
||||
pub original_pm_text: String,
|
||||
pub reason: String,
|
||||
pub resolved: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub resolver_id: Option<PersonId>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -4,23 +4,20 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::registration_application;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = registration_application))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A registration application.
|
||||
pub struct RegistrationApplication {
|
||||
pub id: RegistrationApplicationId,
|
||||
pub local_user_id: LocalUserId,
|
||||
pub answer: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub deny_reason: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
}
|
||||
|
@ -7,34 +7,28 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::schema::site;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = site))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Additional data for federated instances. This may be missing for other platforms which are not
|
||||
/// fully compatible. Basic data is guaranteed to be available via [[Instance]].
|
||||
pub struct Site {
|
||||
pub id: SiteId,
|
||||
pub name: String,
|
||||
/// A sidebar for the site in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
/// An icon URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<DbUrl>,
|
||||
/// A banner url.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<DbUrl>,
|
||||
/// A shorter, one-line description of the site.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// The federated ap_id.
|
||||
pub ap_id: DbUrl,
|
||||
@ -49,7 +43,6 @@ pub struct Site {
|
||||
pub instance_id: InstanceId,
|
||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||
/// when the site is first opened by a user.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_warning: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,15 @@ use serde_with::skip_serializing_none;
|
||||
use {
|
||||
diesel::{sql_types::Nullable, AsExpression, FromSqlRow},
|
||||
lemmy_db_schema_file::schema::tag,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = tag))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A tag that can be assigned to a post within a community.
|
||||
/// The tag object is created by the community moderators.
|
||||
/// The assignment happens by the post creator and can be updated by the community moderators.
|
||||
@ -34,7 +34,6 @@ pub struct Tag {
|
||||
/// the community that owns this tag
|
||||
pub community_id: CommunityId,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
pub deleted: bool,
|
||||
}
|
||||
@ -62,7 +61,9 @@ pub struct TagUpdateForm {
|
||||
|
||||
#[derive(Clone, serde::Serialize, serde::Deserialize, Debug, PartialEq, Default)]
|
||||
#[serde(transparent)]
|
||||
#[cfg_attr(feature = "full", derive(TS, FromSqlRow, AsExpression))]
|
||||
#[cfg_attr(feature = "full", derive(FromSqlRow, AsExpression))]
|
||||
#[cfg_attr(feature = "full", diesel(sql_type = Nullable<diesel::sql_types::Json>))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// we wrap this in a struct so we can implement FromSqlRow<Json> for it
|
||||
pub struct TagsView(pub Vec<Tag>);
|
||||
|
@ -3,24 +3,24 @@ use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use {i_love_jesus::CursorKeysModule, lemmy_db_schema_file::schema::tagline, ts_rs::TS};
|
||||
use {i_love_jesus::CursorKeysModule, lemmy_db_schema_file::schema::tagline};
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
derive(Queryable, Selectable, Identifiable, TS, CursorKeysModule)
|
||||
derive(Queryable, Selectable, Identifiable, CursorKeysModule)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = tagline))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", cursor_keys_module(name = tagline_keys))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A tagline, shown at the top of your site.
|
||||
pub struct Tagline {
|
||||
pub id: TaglineId,
|
||||
pub content: String,
|
||||
pub published_at: DateTime<Utc>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub updated_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,13 @@ full = [
|
||||
"diesel",
|
||||
"diesel_ltree",
|
||||
"diesel-derive-enum",
|
||||
"ts-rs",
|
||||
"lemmy_utils",
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"tracing",
|
||||
"diesel_migrations",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
@ -1,18 +1,19 @@
|
||||
#[cfg(feature = "full")]
|
||||
use diesel_derive_enum::DbEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, EnumString};
|
||||
#[cfg(feature = "full")]
|
||||
use {diesel_derive_enum::DbEnum, ts_rs::TS};
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::PostSortTypeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// TODO add the controversial and scaled rankings to the doc below
|
||||
/// The post sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||
pub enum PostSortType {
|
||||
@ -31,13 +32,14 @@ pub enum PostSortType {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::CommentSortTypeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", 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 {
|
||||
#[default]
|
||||
@ -51,13 +53,14 @@ pub enum CommentSortType {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", 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.
|
||||
@ -74,13 +77,14 @@ pub enum ListingType {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// The registration mode for your site. Determines what happens after a user signs up.
|
||||
pub enum RegistrationMode {
|
||||
/// Closed to public.
|
||||
@ -95,13 +99,14 @@ pub enum RegistrationMode {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::PostListingModeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// A post-view mode that changes how multiple post listings look.
|
||||
pub enum PostListingMode {
|
||||
/// A compact, list-type view.
|
||||
@ -116,13 +121,14 @@ pub enum PostListingMode {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::CommunityVisibility"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// Defines who can browse and interact with content in a community.
|
||||
pub enum CommunityVisibility {
|
||||
/// Public community, any local or federated user can interact.
|
||||
@ -153,13 +159,14 @@ impl CommunityVisibility {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::FederationModeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// The federation mode for an item
|
||||
pub enum FederationMode {
|
||||
#[default]
|
||||
@ -184,13 +191,14 @@ pub enum ActorType {
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::CommunityFollowerState"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
pub enum CommunityFollowerState {
|
||||
Accepted,
|
||||
Pending,
|
||||
@ -200,13 +208,14 @@ pub enum CommunityFollowerState {
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS, DbEnum))]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::VoteShowEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
/// Lets you show votes for others only, show all votes, or hide all votes.
|
||||
pub enum VoteShow {
|
||||
#[default]
|
||||
|
@ -25,8 +25,8 @@ full = [
|
||||
"lemmy_db_views_post/full",
|
||||
"extism",
|
||||
"extism-convert",
|
||||
"ts-rs",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema.workspace = true
|
||||
|
@ -21,12 +21,11 @@ use url::Url;
|
||||
use {
|
||||
extism::FromBytes,
|
||||
extism_convert::{encoding, Json},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A captcha response.
|
||||
pub struct CaptchaResponse {
|
||||
/// A Base64 encoded png
|
||||
@ -38,8 +37,8 @@ pub struct CaptchaResponse {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Changes your account password.
|
||||
pub struct ChangePassword {
|
||||
pub new_password: SensitiveString,
|
||||
@ -48,16 +47,16 @@ pub struct ChangePassword {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a tagline
|
||||
pub struct CreateTagline {
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete your account.
|
||||
pub struct DeleteAccount {
|
||||
pub password: SensitiveString,
|
||||
@ -66,89 +65,78 @@ pub struct DeleteAccount {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A wrapper for the captcha response.
|
||||
pub struct GetCaptchaResponse {
|
||||
/// Will be None if captchas are disabled.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub ok: Option<CaptchaResponse>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct GenerateTotpSecretResponse {
|
||||
pub totp_secret_url: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ListLoginsResponse {
|
||||
pub logins: Vec<LoginToken>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your hidden posts.
|
||||
pub struct ListPersonHidden {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// You hidden posts response.
|
||||
pub struct ListPersonHiddenResponse {
|
||||
pub hidden: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your read posts.
|
||||
pub struct ListPersonRead {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// You read posts response.
|
||||
pub struct ListPersonReadResponse {
|
||||
pub read: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Logging into lemmy.
|
||||
///
|
||||
/// Note: Banned users can still log in, to be able to do certain things like delete
|
||||
@ -157,19 +145,17 @@ pub struct Login {
|
||||
pub username_or_email: SensitiveString,
|
||||
pub password: SensitiveString,
|
||||
/// May be required, if totp is enabled for their account.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub totp_2fa_token: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for your login.
|
||||
pub struct LoginResponse {
|
||||
/// This is None in response to `Register` if email verification is enabled, or the server
|
||||
/// requires registration applications.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub jwt: Option<SensitiveString>,
|
||||
/// If registration applications are required, this will return true for a signup response.
|
||||
pub registration_created: bool,
|
||||
@ -189,8 +175,8 @@ pub struct NotePerson {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Your user info.
|
||||
pub struct MyUserInfo {
|
||||
pub local_user_view: LocalUserView,
|
||||
@ -204,8 +190,8 @@ pub struct MyUserInfo {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Change your password after receiving a reset request.
|
||||
pub struct PasswordChangeAfterReset {
|
||||
pub token: SensitiveString,
|
||||
@ -214,17 +200,18 @@ pub struct PasswordChangeAfterReset {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Reset your password via email.
|
||||
pub struct PasswordReset {
|
||||
pub email: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, FromBytes))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(FromBytes))]
|
||||
#[cfg_attr(feature = "full", encoding(Json))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PluginMetadata {
|
||||
name: String,
|
||||
url: Url,
|
||||
@ -232,16 +219,16 @@ pub struct PluginMetadata {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Make a request to resend your verification email.
|
||||
pub struct ResendVerificationEmail {
|
||||
pub email: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Does an apub fetch for an object.
|
||||
pub struct ResolveObject {
|
||||
/// Can be the full url, or a shortened version like: !fediverse@lemmy.ml
|
||||
@ -250,109 +237,77 @@ pub struct ResolveObject {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Saves settings for your user.
|
||||
pub struct SaveUserSettings {
|
||||
/// Show nsfw posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// Blur nsfw posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blur_nsfw: Option<bool>,
|
||||
/// Your user's theme.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub theme: Option<String>,
|
||||
/// The default post listing type, usually "local"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_listing_type: Option<ListingType>,
|
||||
/// A post-view mode that changes how multiple post listings look.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_listing_mode: Option<PostListingMode>,
|
||||
/// The default post sort, usually "active"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
/// A default time range limit to apply to post sorts, in seconds. 0 means none.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
/// The default comment sort, usually "hot"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
/// The language of the lemmy interface
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub interface_language: Option<String>,
|
||||
/// Your display name, which can contain strange characters, and does not need to be unique.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub display_name: Option<String>,
|
||||
/// Your email.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub email: Option<SensitiveString>,
|
||||
/// Your bio / info, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub bio: Option<String>,
|
||||
/// Your matrix user id. Ex: @my_user:matrix.org
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub matrix_user_id: Option<String>,
|
||||
/// Whether to show or hide avatars.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_avatars: Option<bool>,
|
||||
/// Sends notifications to your email.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub send_notifications_to_email: Option<bool>,
|
||||
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub bot_account: Option<bool>,
|
||||
/// Whether to show bot accounts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_bot_accounts: Option<bool>,
|
||||
/// Whether to show read posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_read_posts: Option<bool>,
|
||||
/// A list of languages you are able to see discussion in.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
// A list of keywords used for blocking posts having them in title,url or body.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blocking_keywords: Option<Vec<String>>,
|
||||
/// Open links in a new tab
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub open_links_in_new_tab: Option<bool>,
|
||||
/// Enable infinite scroll
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub infinite_scroll_enabled: Option<bool>,
|
||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enable_keyboard_navigation: Option<bool>,
|
||||
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
||||
/// should be paused
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enable_animated_images: Option<bool>,
|
||||
/// Whether a user can send / receive private messages
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enable_private_messages: Option<bool>,
|
||||
/// Whether to auto-collapse bot comments.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub collapse_bot_comments: Option<bool>,
|
||||
/// Some vote display mode settings
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_scores: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_upvotes: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_downvotes: Option<VoteShow>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_upvote_percentage: Option<bool>,
|
||||
/// Whether to automatically mark fetched posts as read.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
||||
/// Whether to hide posts containing images/videos.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub hide_media: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response that completes successfully.
|
||||
pub struct SuccessResponse {
|
||||
pub success: bool,
|
||||
@ -365,23 +320,23 @@ impl Default for SuccessResponse {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UpdateTotp {
|
||||
pub totp_token: String,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UpdateTotpResponse {
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Block an instance as user
|
||||
pub struct UserBlockInstanceParams {
|
||||
pub instance_id: InstanceId,
|
||||
@ -389,8 +344,8 @@ pub struct UserBlockInstanceParams {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Verify your email.
|
||||
pub struct VerifyEmail {
|
||||
pub token: String,
|
||||
|
@ -21,12 +21,12 @@ full = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"diesel_ltree",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_vote/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -11,13 +11,11 @@ use lemmy_db_schema_file::enums::{CommentSortType, ListingType};
|
||||
use lemmy_db_views_vote::VoteView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment response.
|
||||
pub struct CommentResponse {
|
||||
pub comment_view: CommentView,
|
||||
@ -26,21 +24,19 @@ pub struct CommentResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a comment.
|
||||
pub struct CreateComment {
|
||||
pub content: String,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub parent_id: Option<CommentId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Like a comment.
|
||||
pub struct CreateCommentLike {
|
||||
pub comment_id: CommentId,
|
||||
@ -50,8 +46,8 @@ pub struct CreateCommentLike {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete your own comment.
|
||||
pub struct DeleteComment {
|
||||
pub comment_id: CommentId,
|
||||
@ -60,8 +56,8 @@ pub struct DeleteComment {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Distinguish a comment (IE speak as moderator).
|
||||
pub struct DistinguishComment {
|
||||
pub comment_id: CommentId,
|
||||
@ -70,8 +66,8 @@ pub struct DistinguishComment {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetch an individual comment.
|
||||
pub struct GetComment {
|
||||
pub id: CommentId,
|
||||
@ -79,114 +75,92 @@ pub struct GetComment {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get a list of comments.
|
||||
pub struct GetComments {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<CommentSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// Filter to within a given time range, in seconds.
|
||||
/// IE 60 would give results for the past minute.
|
||||
pub time_range_seconds: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub max_depth: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub parent_id: Option<CommentId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The comment list response.
|
||||
pub struct GetCommentsResponse {
|
||||
pub comments: Vec<CommentView>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A slimmer comment list response, without the post or community.
|
||||
pub struct GetCommentsSlimResponse {
|
||||
pub comments: Vec<CommentSlimView>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// List comment likes. Admins-only.
|
||||
pub struct ListCommentLikes {
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The comment likes response
|
||||
pub struct ListCommentLikesResponse {
|
||||
pub comment_likes: Vec<VoteView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Purges a comment from the database. This will delete all content attached to that comment.
|
||||
pub struct PurgeComment {
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Remove a comment (only doable by mods).
|
||||
pub struct RemoveComment {
|
||||
pub comment_id: CommentId,
|
||||
pub removed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Save / bookmark a comment.
|
||||
pub struct SaveComment {
|
||||
pub comment_id: CommentId,
|
||||
@ -195,13 +169,11 @@ pub struct SaveComment {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edit a comment.
|
||||
pub struct EditComment {
|
||||
pub comment_id: CommentId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ use {
|
||||
CreatorHomeInstanceActionsAllColumnsTuple,
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -35,9 +34,10 @@ pub mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment view.
|
||||
pub struct CommentView {
|
||||
#[cfg_attr(feature = "full",
|
||||
@ -53,28 +53,21 @@ pub struct CommentView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_actions: Option<CommentActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_home_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_local_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
||||
@ -110,24 +103,19 @@ pub struct CommentView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A slimmer comment view, without the post, or community.
|
||||
pub struct CommentSlimView {
|
||||
pub comment: Comment,
|
||||
pub creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_actions: Option<CommentActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||
pub creator_is_admin: bool,
|
||||
pub can_mod: bool,
|
||||
|
@ -20,13 +20,13 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_community_moderator/full",
|
||||
"lemmy_db_views_person/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -9,12 +9,10 @@ use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Add a moderator to a community.
|
||||
pub struct AddModToCommunity {
|
||||
pub community_id: CommunityId,
|
||||
@ -23,16 +21,16 @@ pub struct AddModToCommunity {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response of adding a moderator to a community.
|
||||
pub struct AddModToCommunityResponse {
|
||||
pub moderators: Vec<CommunityModeratorView>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ApproveCommunityPendingFollower {
|
||||
pub community_id: CommunityId,
|
||||
pub follower_id: PersonId,
|
||||
@ -41,8 +39,8 @@ pub struct ApproveCommunityPendingFollower {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Ban a user from a community.
|
||||
pub struct BanFromCommunity {
|
||||
pub community_id: CommunityId,
|
||||
@ -50,20 +48,17 @@ pub struct BanFromCommunity {
|
||||
pub ban: bool,
|
||||
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
||||
/// If ban is true, then this means remove. If ban is false, it means restore.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub remove_or_restore_data: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
/// A time that the ban will expire, in unix epoch seconds.
|
||||
///
|
||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response for banning a user from a community.
|
||||
pub struct BanFromCommunityResponse {
|
||||
pub person_view: PersonView,
|
||||
@ -71,8 +66,8 @@ pub struct BanFromCommunityResponse {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Block a community.
|
||||
pub struct BlockCommunity {
|
||||
pub community_id: CommunityId,
|
||||
@ -81,8 +76,8 @@ pub struct BlockCommunity {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The block community response.
|
||||
pub struct BlockCommunityResponse {
|
||||
pub community_view: CommunityView,
|
||||
@ -92,15 +87,15 @@ pub struct BlockCommunityResponse {
|
||||
/// Parameter for setting community icon or banner. Can't use POST data here as it already contains
|
||||
/// the image data.
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct CommunityIdQuery {
|
||||
pub id: CommunityId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A simple community response.
|
||||
pub struct CommunityResponse {
|
||||
pub community_view: CommunityView,
|
||||
@ -108,8 +103,8 @@ pub struct CommunityResponse {
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
/// Create a community.
|
||||
pub struct CreateCommunity {
|
||||
@ -118,33 +113,25 @@ pub struct CreateCommunity {
|
||||
/// A longer title.
|
||||
pub title: String,
|
||||
/// A sidebar for the community in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// A shorter, one line description of your community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// An icon URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub icon: Option<String>,
|
||||
/// A banner URL.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banner: Option<String>,
|
||||
/// Whether its an NSFW community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
/// Whether to restrict posting only to moderators.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub posting_restricted_to_mods: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub visibility: Option<CommunityVisibility>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a tag for a community.
|
||||
pub struct CreateCommunityTag {
|
||||
pub community_id: CommunityId,
|
||||
@ -153,8 +140,8 @@ pub struct CreateCommunityTag {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete your own community.
|
||||
pub struct DeleteCommunity {
|
||||
pub community_id: CommunityId,
|
||||
@ -163,35 +150,28 @@ pub struct DeleteCommunity {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edit a community.
|
||||
pub struct EditCommunity {
|
||||
pub community_id: CommunityId,
|
||||
/// A longer title.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub title: Option<String>,
|
||||
/// A sidebar for the community in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// A shorter, one line description of your community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// Whether its an NSFW community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
/// Whether to restrict posting only to moderators.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub posting_restricted_to_mods: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub visibility: Option<CommunityVisibility>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Follow / subscribe to a community.
|
||||
pub struct FollowCommunity {
|
||||
pub community_id: CommunityId,
|
||||
@ -200,26 +180,23 @@ pub struct FollowCommunity {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
// TODO make this into a tagged enum
|
||||
/// Get a community. Must provide either an id, or a name.
|
||||
pub struct GetCommunity {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub id: Option<CommunityId>,
|
||||
/// Example: star_trek , or star_trek@xyz.tld
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub name: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The community response.
|
||||
pub struct GetCommunityResponse {
|
||||
pub community_view: CommunityView,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub site: Option<Site>,
|
||||
pub moderators: Vec<CommunityModeratorView>,
|
||||
pub discussion_languages: Vec<LanguageId>,
|
||||
@ -227,91 +204,77 @@ pub struct GetCommunityResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetches a random community
|
||||
pub struct GetRandomCommunity {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Hide a community from the main view.
|
||||
pub struct HideCommunity {
|
||||
pub community_id: CommunityId,
|
||||
pub hidden: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetches a list of communities.
|
||||
pub struct ListCommunities {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<CommunitySortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// Filter to within a given time range, in seconds.
|
||||
/// IE 60 would give results for the past minute.
|
||||
pub time_range_seconds: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response for listing communities.
|
||||
pub struct ListCommunitiesResponse {
|
||||
pub communities: Vec<CommunityView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Purges a community from the database. This will delete all content attached to that community.
|
||||
pub struct PurgeCommunity {
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Remove a community (only doable by moderators).
|
||||
pub struct RemoveCommunity {
|
||||
pub community_id: CommunityId,
|
||||
pub removed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Transfer a community to a new owner.
|
||||
pub struct TransferCommunity {
|
||||
pub community_id: CommunityId,
|
||||
@ -320,8 +283,8 @@ pub struct TransferCommunity {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Update a community tag.
|
||||
pub struct UpdateCommunityTag {
|
||||
pub tag_id: TagId,
|
||||
@ -330,8 +293,8 @@ pub struct UpdateCommunityTag {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a community tag.
|
||||
pub struct DeleteCommunityTag {
|
||||
pub tag_id: TagId,
|
||||
|
@ -9,7 +9,6 @@ use serde_with::skip_serializing_none;
|
||||
use {
|
||||
diesel::{Queryable, Selectable},
|
||||
lemmy_db_schema::utils::queries::{community_post_tags_fragment, local_user_community_can_mod},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -18,18 +17,17 @@ pub mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A community view.
|
||||
pub struct CommunityView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -2,50 +2,41 @@ use crate::PendingFollow;
|
||||
use lemmy_db_schema::newtypes::{CommunityId, PaginationCursor};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct GetCommunityPendingFollowsCount {
|
||||
pub community_id: CommunityId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct GetCommunityPendingFollowsCountResponse {
|
||||
pub count: i64,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ListCommunityPendingFollows {
|
||||
/// Only shows the unapproved applications
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub pending_only: Option<bool>,
|
||||
// Only for admins, show pending follows for communities which you dont moderate
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub all_communities: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ListCommunityPendingFollowsResponse {
|
||||
pub items: Vec<PendingFollow>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -1,21 +1,19 @@
|
||||
#[cfg(feature = "full")]
|
||||
use diesel::{Queryable, Selectable};
|
||||
use lemmy_db_schema::source::{community::Community, person::Person};
|
||||
use lemmy_db_schema_file::enums::CommunityFollowerState;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use {
|
||||
diesel::{Queryable, Selectable},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
#[cfg(feature = "full")]
|
||||
pub mod impls;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A community follower.
|
||||
pub struct CommunityFollowerView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -26,13 +24,13 @@ pub struct CommunityFollowerView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PendingFollow {
|
||||
pub person: Person,
|
||||
pub community: Community,
|
||||
pub is_new_instance: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub follow_state: Option<CommunityFollowerState>,
|
||||
}
|
||||
|
@ -20,10 +20,10 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -1,18 +1,16 @@
|
||||
#[cfg(feature = "full")]
|
||||
use diesel::{Queryable, Selectable};
|
||||
use lemmy_db_schema::source::{community::Community, person::Person};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use {
|
||||
diesel::{Queryable, Selectable},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
pub mod impls;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A community moderator.
|
||||
pub struct CommunityModeratorView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
|
@ -20,10 +20,10 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -2,47 +2,45 @@ use crate::CustomEmojiView;
|
||||
use lemmy_db_schema::newtypes::CustomEmojiId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a custom emoji.
|
||||
pub struct CreateCustomEmoji {
|
||||
pub category: String,
|
||||
pub shortcode: String,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
pub image_url: Url,
|
||||
pub alt_text: String,
|
||||
pub keywords: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for a custom emoji.
|
||||
pub struct CustomEmojiResponse {
|
||||
pub custom_emoji: CustomEmojiView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a custom emoji.
|
||||
pub struct DeleteCustomEmoji {
|
||||
pub id: CustomEmojiId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edit a custom emoji.
|
||||
pub struct EditCustomEmoji {
|
||||
pub id: CustomEmojiId,
|
||||
pub category: String,
|
||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||
pub image_url: Url,
|
||||
pub alt_text: String,
|
||||
pub keywords: Vec<String>,
|
||||
@ -50,17 +48,16 @@ pub struct EditCustomEmoji {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetches a list of custom emojis.
|
||||
pub struct ListCustomEmojis {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub category: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for custom emojis.
|
||||
pub struct ListCustomEmojisResponse {
|
||||
pub custom_emojis: Vec<CustomEmojiView>,
|
||||
|
@ -1,19 +1,20 @@
|
||||
#[cfg(feature = "full")]
|
||||
use diesel::Queryable;
|
||||
use lemmy_db_schema::source::{
|
||||
custom_emoji::CustomEmoji,
|
||||
custom_emoji_keyword::CustomEmojiKeyword,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use {diesel::Queryable, ts_rs::TS};
|
||||
|
||||
pub mod api;
|
||||
#[cfg(feature = "full")]
|
||||
pub mod impls;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A custom emoji view.
|
||||
pub struct CustomEmojiView {
|
||||
pub custom_emoji: CustomEmoji,
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_private_message = { workspace = true }
|
||||
|
@ -5,28 +5,26 @@ use lemmy_db_schema::newtypes::{
|
||||
PrivateMessageId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response containing a count of unread notifications.
|
||||
pub struct GetUnreadCountResponse {
|
||||
pub count: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The count of unread registration applications.
|
||||
pub struct GetUnreadRegistrationApplicationCountResponse {
|
||||
pub registration_applications: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Mark a comment reply as read.
|
||||
pub struct MarkCommentReplyAsRead {
|
||||
pub comment_reply_id: CommentReplyId,
|
||||
@ -34,8 +32,8 @@ pub struct MarkCommentReplyAsRead {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Mark a person mention as read.
|
||||
pub struct MarkPersonCommentMentionAsRead {
|
||||
pub person_comment_mention_id: PersonCommentMentionId,
|
||||
@ -43,8 +41,8 @@ pub struct MarkPersonCommentMentionAsRead {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Mark a person mention as read.
|
||||
pub struct MarkPersonPostMentionAsRead {
|
||||
pub person_post_mention_id: PersonPostMentionId,
|
||||
@ -52,8 +50,8 @@ pub struct MarkPersonPostMentionAsRead {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Mark a private message as read.
|
||||
pub struct MarkPrivateMessageAsRead {
|
||||
pub private_message_id: PrivateMessageId,
|
||||
|
@ -38,7 +38,6 @@ use {
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
Person1AliasAllColumnsTuple,
|
||||
},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -129,8 +128,8 @@ pub struct InboxCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum InboxCombinedView {
|
||||
@ -141,9 +140,10 @@ pub enum InboxCombinedView {
|
||||
}
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person comment mention view.
|
||||
pub struct PersonCommentMentionView {
|
||||
pub person_comment_mention: PersonCommentMention,
|
||||
@ -152,19 +152,12 @@ pub struct PersonCommentMentionView {
|
||||
pub creator: Person,
|
||||
pub post: Post,
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_actions: Option<CommentActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_community_actions: Option<CommunityActions>,
|
||||
pub creator_is_admin: bool,
|
||||
pub can_mod: bool,
|
||||
@ -173,9 +166,10 @@ pub struct PersonCommentMentionView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person post mention view.
|
||||
pub struct PersonPostMentionView {
|
||||
pub person_post_mention: PersonPostMention,
|
||||
@ -183,21 +177,13 @@ pub struct PersonPostMentionView {
|
||||
pub post: Post,
|
||||
pub creator: Person,
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub image_details: Option<ImageDetails>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_actions: Option<PostActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_community_actions: Option<CommunityActions>,
|
||||
pub post_tags: TagsView,
|
||||
pub creator_is_admin: bool,
|
||||
@ -207,9 +193,10 @@ pub struct PersonPostMentionView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment reply view.
|
||||
pub struct CommentReplyView {
|
||||
pub comment_reply: CommentReply,
|
||||
@ -218,20 +205,13 @@ pub struct CommentReplyView {
|
||||
pub creator: Person,
|
||||
pub post: Post,
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_actions: Option<CommentActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_community_actions: Option<CommunityActions>,
|
||||
pub creator_is_admin: bool,
|
||||
pub post_tags: TagsView,
|
||||
@ -241,31 +221,24 @@ pub struct CommentReplyView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get your inbox (replies, comment mentions, post mentions, and messages)
|
||||
pub struct ListInbox {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<InboxDataType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unread_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get your inbox (replies, comment mentions, post mentions, and messages)
|
||||
pub struct ListInboxResponse {
|
||||
pub inbox: Vec<InboxCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -2,70 +2,59 @@ use crate::LocalImageView;
|
||||
use lemmy_db_schema::newtypes::PaginationCursor;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct DeleteImageParams {
|
||||
pub filename: String,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ImageGetParams {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub file_type: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub max_size: Option<i32>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ImageProxyParams {
|
||||
pub url: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub file_type: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub max_size: Option<i32>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get your user's image / media uploads.
|
||||
pub struct ListMedia {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ListMediaResponse {
|
||||
pub images: Vec<LocalImageView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UploadImageResponse {
|
||||
pub image_url: Url,
|
||||
pub filename: String,
|
||||
|
@ -1,11 +1,8 @@
|
||||
#[cfg(feature = "full")]
|
||||
use diesel::{Queryable, Selectable};
|
||||
use lemmy_db_schema::source::{images::LocalImage, person::Person, post::Post};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use {
|
||||
diesel::{Queryable, Selectable},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
#[cfg(feature = "full")]
|
||||
@ -13,9 +10,10 @@ pub mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A local image view.
|
||||
pub struct LocalImageView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -23,6 +21,5 @@ pub struct LocalImageView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
pub person: Person,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post: Option<Post>,
|
||||
}
|
||||
|
@ -20,12 +20,12 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"actix-web",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"i-love-jesus",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -2,32 +2,24 @@ use crate::LocalUserView;
|
||||
use lemmy_db_schema::newtypes::PaginationCursor;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminListUsers {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub banned_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminListUsersResponse {
|
||||
pub users: Vec<LocalUserView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use {
|
||||
utils::queries::creator_home_instance_actions_select,
|
||||
CreatorHomeInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -15,9 +14,10 @@ pub mod api;
|
||||
pub mod impls;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A local user view.
|
||||
pub struct LocalUserView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -27,6 +27,5 @@ pub struct LocalUserView {
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_home_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -6,54 +6,40 @@ use lemmy_db_schema::{
|
||||
use lemmy_db_schema_file::enums::ListingType;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetches the modlog.
|
||||
pub struct GetModlog {
|
||||
/// Filter by the moderator.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub mod_person_id: Option<PersonId>,
|
||||
/// Filter by the community.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
/// Filter by the modlog action type.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ModlogActionType>,
|
||||
/// Filter by listing type. When not using All, it will remove the non-community modlog entries,
|
||||
/// such as site bans, instance blocks, adding an admin, etc.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub listing_type: Option<ListingType>,
|
||||
/// Filter by the other / modded person.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub other_person_id: Option<PersonId>,
|
||||
/// Filter by post. Will include comments of that post.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
/// Filter by comment.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_id: Option<CommentId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The modlog fetch response.
|
||||
pub struct GetModlogResponse {
|
||||
pub modlog: Vec<ModlogCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ use serde_with::skip_serializing_none;
|
||||
use {
|
||||
diesel::{dsl::Nullable, NullableExpressionMethods, Queryable, Selectable},
|
||||
lemmy_db_schema::{utils::queries::person1_select, Person1AliasAllColumnsTuple},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -43,13 +42,13 @@ pub mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is added as a community moderator.
|
||||
pub struct ModAddCommunityView {
|
||||
pub mod_add_community: ModAddCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
pub other_person: Person,
|
||||
@ -57,26 +56,26 @@ pub struct ModAddCommunityView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is added as a site moderator.
|
||||
pub struct ModAddView {
|
||||
pub mod_add: ModAdd,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub other_person: Person,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is banned from a community.
|
||||
pub struct ModBanFromCommunityView {
|
||||
pub mod_ban_from_community: ModBanFromCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
pub other_person: Person,
|
||||
@ -84,39 +83,39 @@ pub struct ModBanFromCommunityView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When someone is banned from the site.
|
||||
pub struct ModBanView {
|
||||
pub mod_ban: ModBan,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub other_person: Person,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When the visibility of a community is changed
|
||||
pub struct ModChangeCommunityVisibilityView {
|
||||
pub mod_change_community_visibility: ModChangeCommunityVisibility,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator locks a post (prevents new comments being made).
|
||||
pub struct ModLockPostView {
|
||||
pub mod_lock_post: ModLockPost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub other_person: Person,
|
||||
pub post: Post,
|
||||
@ -125,13 +124,13 @@ pub struct ModLockPostView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator removes a comment.
|
||||
pub struct ModRemoveCommentView {
|
||||
pub mod_remove_comment: ModRemoveComment,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub other_person: Person,
|
||||
pub comment: Comment,
|
||||
@ -141,26 +140,26 @@ pub struct ModRemoveCommentView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator removes a community.
|
||||
pub struct ModRemoveCommunityView {
|
||||
pub mod_remove_community: ModRemoveCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator removes a post.
|
||||
pub struct ModRemovePostView {
|
||||
pub mod_remove_post: ModRemovePost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub other_person: Person,
|
||||
pub post: Post,
|
||||
@ -169,13 +168,13 @@ pub struct ModRemovePostView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator features a post on a community (pins it to the top).
|
||||
pub struct ModFeaturePostView {
|
||||
pub mod_feature_post: ModFeaturePost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub other_person: Person,
|
||||
pub post: Post,
|
||||
@ -184,13 +183,13 @@ pub struct ModFeaturePostView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When a moderator transfers a community to a new owner.
|
||||
pub struct ModTransferCommunityView {
|
||||
pub mod_transfer_community: ModTransferCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub moderator: Option<Person>,
|
||||
pub community: Community,
|
||||
pub other_person: Person,
|
||||
@ -198,77 +197,77 @@ pub struct ModTransferCommunityView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a comment.
|
||||
pub struct AdminPurgeCommentView {
|
||||
pub admin_purge_comment: AdminPurgeComment,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
pub post: Post,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a community.
|
||||
pub struct AdminPurgeCommunityView {
|
||||
pub admin_purge_community: AdminPurgeCommunity,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a person.
|
||||
pub struct AdminPurgePersonView {
|
||||
pub admin_purge_person: AdminPurgePerson,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a post.
|
||||
pub struct AdminPurgePostView {
|
||||
pub admin_purge_post: AdminPurgePost,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
pub community: Community,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a post.
|
||||
pub struct AdminBlockInstanceView {
|
||||
pub admin_block_instance: AdminBlockInstance,
|
||||
pub instance: Instance,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// When an admin purges a post.
|
||||
pub struct AdminAllowInstanceView {
|
||||
pub admin_allow_instance: AdminAllowInstance,
|
||||
pub instance: Instance,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub admin: Option<Person>,
|
||||
}
|
||||
|
||||
@ -335,8 +334,8 @@ pub(crate) struct ModlogCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum ModlogCombinedView {
|
||||
|
@ -20,12 +20,12 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_community_moderator/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -3,12 +3,10 @@ use lemmy_db_schema::{newtypes::PersonId, source::site::Site};
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Adds an admin to a site.
|
||||
pub struct AddAdmin {
|
||||
pub person_id: PersonId,
|
||||
@ -16,8 +14,8 @@ pub struct AddAdmin {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response of current admins.
|
||||
pub struct AddAdminResponse {
|
||||
pub admins: Vec<PersonView>,
|
||||
@ -25,28 +23,25 @@ pub struct AddAdminResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Ban a person from the site.
|
||||
pub struct BanPerson {
|
||||
pub person_id: PersonId,
|
||||
pub ban: bool,
|
||||
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
||||
/// If ban is true, then this means remove. If ban is false, it means restore.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub remove_or_restore_data: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
/// A time that the ban will expire, in unix epoch seconds.
|
||||
///
|
||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for a banned person.
|
||||
pub struct BanPersonResponse {
|
||||
pub person_view: PersonView,
|
||||
@ -54,8 +49,8 @@ pub struct BanPersonResponse {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Block a person.
|
||||
pub struct BlockPerson {
|
||||
pub person_id: PersonId,
|
||||
@ -63,8 +58,8 @@ pub struct BlockPerson {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response for a person block.
|
||||
pub struct BlockPersonResponse {
|
||||
pub person_view: PersonView,
|
||||
@ -73,38 +68,34 @@ pub struct BlockPersonResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets a person's details.
|
||||
///
|
||||
/// Either person_id, or username are required.
|
||||
pub struct GetPersonDetails {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_id: Option<PersonId>,
|
||||
/// Example: dessalines , or dessalines@xyz.tld
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub username: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person's details response.
|
||||
pub struct GetPersonDetailsResponse {
|
||||
pub person_view: PersonView,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub site: Option<Site>,
|
||||
pub moderates: Vec<CommunityModeratorView>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Purges a person from the database. This will delete all content attached to that person.
|
||||
pub struct PurgePerson {
|
||||
pub person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ use {
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
lemmy_db_schema_file::schema::local_user,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -27,9 +26,10 @@ pub mod api;
|
||||
pub mod impls;
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person view.
|
||||
pub struct PersonView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -47,12 +47,10 @@ pub struct PersonView {
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_home_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_local_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub local_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
@ -34,7 +34,6 @@ use {
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
lemmy_db_views_local_user::LocalUserView,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
@ -109,8 +108,8 @@ pub(crate) struct PersonContentCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum PersonContentCombinedView {
|
||||
@ -120,37 +119,29 @@ pub enum PersonContentCombinedView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets a person's content (posts and comments)
|
||||
///
|
||||
/// Either person_id, or username are required.
|
||||
pub struct ListPersonContent {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<PersonContentType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_id: Option<PersonId>,
|
||||
/// Example: dessalines , or dessalines@xyz.tld
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub username: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person's content response.
|
||||
pub struct ListPersonContentResponse {
|
||||
pub content: Vec<PersonContentCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_comment/full",
|
||||
"lemmy_db_views_post/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
@ -35,7 +35,6 @@ use {
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
lemmy_db_views_local_user::LocalUserView,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
@ -110,8 +109,8 @@ pub(crate) struct PersonLikedCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum PersonLikedCombinedView {
|
||||
@ -121,32 +120,25 @@ pub enum PersonLikedCombinedView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your liked / disliked posts
|
||||
pub struct ListPersonLiked {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<PersonContentType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub like_type: Option<LikeType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Your liked posts response.
|
||||
pub struct ListPersonLikedResponse {
|
||||
pub liked: Vec<PersonLikedCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_post/full",
|
||||
"lemmy_db_views_comment/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
@ -34,7 +34,6 @@ use {
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
lemmy_db_views_local_user::LocalUserView,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
@ -109,8 +108,8 @@ pub(crate) struct PersonSavedCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum PersonSavedCombinedView {
|
||||
@ -120,30 +119,24 @@ pub enum PersonSavedCombinedView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your saved posts and comments
|
||||
pub struct ListPersonSaved {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<PersonContentType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A person's saved content response.
|
||||
pub struct ListPersonSavedResponse {
|
||||
pub saved: Vec<PersonSavedCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_community/full",
|
||||
"lemmy_db_views_vote/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -8,45 +8,34 @@ use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_vote::VoteView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a post.
|
||||
pub struct CreatePost {
|
||||
pub name: String,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url: Option<String>,
|
||||
/// An optional body for the post in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub body: Option<String>,
|
||||
/// An optional alt_text, usable for image posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub alt_text: Option<String>,
|
||||
/// A honeypot to catch bots. Should be None.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub honeypot: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
/// Instead of fetching a thumbnail, use a custom one.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub custom_thumbnail: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub tags: Option<Vec<TagId>>,
|
||||
/// Time when this post should be scheduled. Null means publish immediately.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scheduled_publish_time_at: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Like a post.
|
||||
pub struct CreatePostLike {
|
||||
pub post_id: PostId,
|
||||
@ -55,8 +44,8 @@ pub struct CreatePostLike {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a post.
|
||||
pub struct DeletePost {
|
||||
pub post_id: PostId,
|
||||
@ -65,38 +54,29 @@ pub struct DeletePost {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edit a post.
|
||||
pub struct EditPost {
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub url: Option<String>,
|
||||
/// An optional body for the post in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub body: Option<String>,
|
||||
/// An optional alt_text, usable for image posts.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub alt_text: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub language_id: Option<LanguageId>,
|
||||
/// Instead of fetching a thumbnail, use a custom one.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub custom_thumbnail: Option<String>,
|
||||
/// Time when this post should be scheduled. Null means publish immediately.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scheduled_publish_time_at: Option<i64>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub tags: Option<Vec<TagId>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Feature a post (stickies / pins to the top).
|
||||
pub struct FeaturePost {
|
||||
pub post_id: PostId,
|
||||
@ -106,21 +86,19 @@ pub struct FeaturePost {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
// TODO this should be made into a tagged enum
|
||||
/// Get a post. Needs either the post id, or comment_id.
|
||||
pub struct GetPost {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub id: Option<PostId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_id: Option<CommentId>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post response.
|
||||
pub struct GetPostResponse {
|
||||
pub post_view: PostView,
|
||||
@ -131,73 +109,57 @@ pub struct GetPostResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get a list of posts.
|
||||
pub struct GetPosts {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<PostSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// Filter to within a given time range, in seconds.
|
||||
/// IE 60 would give results for the past minute.
|
||||
/// Use Zero to override the local_site and local_user time_range.
|
||||
pub time_range_seconds: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_hidden: Option<bool>,
|
||||
/// If true, then show the read posts (even if your user setting is to hide them)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_read: Option<bool>,
|
||||
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// If false, then show posts with media attached (even if your user setting is to hide them)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub hide_media: Option<bool>,
|
||||
/// Whether to automatically mark fetched posts as read.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub mark_as_read: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// If true, then only show posts with no comments
|
||||
pub no_comments_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post list response.
|
||||
pub struct GetPostsResponse {
|
||||
pub posts: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get metadata for a given site.
|
||||
pub struct GetSiteMetadata {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The site metadata response.
|
||||
pub struct GetSiteMetadataResponse {
|
||||
pub metadata: LinkMetadata,
|
||||
@ -205,20 +167,19 @@ pub struct GetSiteMetadataResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Site metadata, from its opengraph tags.
|
||||
pub struct LinkMetadata {
|
||||
#[serde(flatten)]
|
||||
pub opengraph_data: OpenGraphData,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_type: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Hide a post from list views
|
||||
pub struct HidePost {
|
||||
pub post_id: PostId,
|
||||
@ -227,47 +188,41 @@ pub struct HidePost {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// List post likes. Admins-only.
|
||||
pub struct ListPostLikes {
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post likes response
|
||||
pub struct ListPostLikesResponse {
|
||||
pub post_likes: Vec<VoteView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Lock a post (prevent new comments).
|
||||
pub struct LockPost {
|
||||
pub post_id: PostId,
|
||||
pub locked: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Mark a post as read.
|
||||
pub struct MarkPostAsRead {
|
||||
pub post_id: PostId,
|
||||
@ -276,53 +231,47 @@ pub struct MarkPostAsRead {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Site metadata, from its opengraph tags.
|
||||
pub struct OpenGraphData {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub title: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub image: Option<DbUrl>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub embed_video_url: Option<DbUrl>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PostResponse {
|
||||
pub post_view: PostView,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Purges a post from the database. This will delete all content attached to that post.
|
||||
pub struct PurgePost {
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Remove a post (only doable by mods).
|
||||
pub struct RemovePost {
|
||||
pub post_id: PostId,
|
||||
pub removed: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Save / bookmark a post.
|
||||
pub struct SavePost {
|
||||
pub post_id: PostId,
|
||||
@ -331,8 +280,8 @@ pub struct SavePost {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Mark several posts as read.
|
||||
pub struct MarkManyPostsAsRead {
|
||||
pub post_ids: Vec<PostId>,
|
||||
|
@ -25,7 +25,6 @@ use {
|
||||
CreatorHomeInstanceActionsAllColumnsTuple,
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -34,9 +33,9 @@ pub mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A post view.
|
||||
pub struct PostView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -46,31 +45,23 @@ pub struct PostView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub image_details: Option<ImageDetails>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_actions: Option<PostActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_home_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", diesel(
|
||||
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
||||
select_expression = creator_local_instance_actions_select()))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
||||
|
@ -20,10 +20,10 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -1,12 +1,10 @@
|
||||
use crate::PrivateMessageView;
|
||||
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a private message.
|
||||
pub struct CreatePrivateMessage {
|
||||
pub content: String,
|
||||
@ -14,8 +12,8 @@ pub struct CreatePrivateMessage {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a private message.
|
||||
pub struct DeletePrivateMessage {
|
||||
pub private_message_id: PrivateMessageId,
|
||||
@ -23,8 +21,8 @@ pub struct DeletePrivateMessage {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edit a private message.
|
||||
pub struct EditPrivateMessage {
|
||||
pub private_message_id: PrivateMessageId,
|
||||
@ -32,8 +30,8 @@ pub struct EditPrivateMessage {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A single private message response.
|
||||
pub struct PrivateMessageResponse {
|
||||
pub private_message_view: PrivateMessageView,
|
||||
|
@ -5,7 +5,6 @@ use {
|
||||
diesel::{Queryable, Selectable},
|
||||
lemmy_db_schema::utils::queries::person1_select,
|
||||
lemmy_db_schema::Person1AliasAllColumnsTuple,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -13,9 +12,10 @@ pub mod api;
|
||||
pub mod impls;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A private message view.
|
||||
pub struct PrivateMessageView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
|
@ -15,7 +15,8 @@ doctest = false
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
full = ["ts-rs", "lemmy_db_schema/full", "lemmy_utils/full"]
|
||||
full = ["lemmy_db_schema/full", "lemmy_utils/full"]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -2,19 +2,16 @@ use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema::source::federation_queue_state::FederationQueueState;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ReadableFederationState {
|
||||
#[serde(flatten)]
|
||||
internal_state: FederationQueueState,
|
||||
/// timestamp of the next retry attempt (null if fail count is 0)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
next_retry: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -5,25 +5,22 @@ use lemmy_db_schema::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Approves a registration application.
|
||||
pub struct ApproveRegistrationApplication {
|
||||
pub id: RegistrationApplicationId,
|
||||
pub approve: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub deny_reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets a registration application for a person
|
||||
pub struct GetRegistrationApplication {
|
||||
pub person_id: PersonId,
|
||||
@ -31,65 +28,53 @@ pub struct GetRegistrationApplication {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetches a list of registration applications.
|
||||
pub struct ListRegistrationApplications {
|
||||
/// Only shows the unread applications (IE those without an admin actor)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unread_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The list of registration applications.
|
||||
pub struct ListRegistrationApplicationsResponse {
|
||||
pub registration_applications: Vec<RegistrationApplicationView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Register / Sign up to lemmy.
|
||||
pub struct Register {
|
||||
pub username: String,
|
||||
pub password: SensitiveString,
|
||||
pub password_verify: SensitiveString,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// email is mandatory if email verification is enabled on the server
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub email: Option<SensitiveString>,
|
||||
/// The UUID of the captcha item.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_uuid: Option<String>,
|
||||
/// Your captcha answer.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_answer: Option<String>,
|
||||
/// A form field to trick signup bots. Should be None.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub honeypot: Option<String>,
|
||||
/// An answer is mandatory if require application is enabled on the server
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub answer: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response of an action done to a registration application.
|
||||
pub struct RegistrationApplicationResponse {
|
||||
pub registration_application: RegistrationApplicationView,
|
||||
|
@ -9,7 +9,6 @@ use serde_with::skip_serializing_none;
|
||||
use {
|
||||
diesel::{helper_types::Nullable, NullableExpressionMethods, Queryable, Selectable},
|
||||
lemmy_db_schema::{utils::queries::person1_select, Person1AliasAllColumnsTuple},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -18,9 +17,10 @@ pub mod impls;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A registration application view.
|
||||
pub struct RegistrationApplicationView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -29,7 +29,6 @@ pub struct RegistrationApplicationView {
|
||||
pub creator_local_user: LocalUser,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
pub creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<Person1AliasAllColumnsTuple>,
|
||||
|
@ -20,11 +20,11 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_reports = { workspace = true }
|
||||
|
@ -5,50 +5,37 @@ use lemmy_db_schema::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// List reports.
|
||||
pub struct ListReports {
|
||||
/// Only shows the unresolved reports
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub unresolved_only: Option<bool>,
|
||||
/// Filter the type of report.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<ReportType>,
|
||||
/// Filter by the post id. Can return either comment or post reports.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_id: Option<PostId>,
|
||||
/// if no community is given, it returns reports for all communities moderated by the auth user
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
/// Only for admins: also show reports with `violates_instance_rules=false`
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_community_rule_violations: Option<bool>,
|
||||
/// If true, view all your created reports. Works for non-admins/mods also.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub my_reports_only: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post reports response.
|
||||
pub struct ListReportsResponse {
|
||||
pub reports: Vec<ReportCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ use {
|
||||
Person2AliasAllColumnsTuple,
|
||||
},
|
||||
lemmy_db_views_local_user::LocalUserView,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -102,8 +101,8 @@ pub struct ReportCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum ReportCombinedView {
|
||||
|
@ -20,10 +20,10 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -11,39 +11,36 @@ use lemmy_db_schema::newtypes::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The comment report response.
|
||||
pub struct CommentReportResponse {
|
||||
pub comment_report_view: CommentReportView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A community report response.
|
||||
pub struct CommunityReportResponse {
|
||||
pub community_report_view: CommunityReportView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Report a comment.
|
||||
pub struct CreateCommentReport {
|
||||
pub comment_id: CommentId,
|
||||
pub reason: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub violates_instance_rules: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a report for a community.
|
||||
pub struct CreateCommunityReport {
|
||||
pub community_id: CommunityId,
|
||||
@ -51,38 +48,36 @@ pub struct CreateCommunityReport {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a post report.
|
||||
pub struct CreatePostReport {
|
||||
pub post_id: PostId,
|
||||
pub reason: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub violates_instance_rules: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Get a count of the number of reports.
|
||||
pub struct GetReportCount {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for the number of reports.
|
||||
pub struct GetReportCountResponse {
|
||||
pub count: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Resolve a comment report (only doable by mods).
|
||||
pub struct ResolveCommentReport {
|
||||
pub report_id: CommentReportId,
|
||||
@ -90,8 +85,8 @@ pub struct ResolveCommentReport {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Resolve a community report.
|
||||
pub struct ResolveCommunityReport {
|
||||
pub report_id: CommunityReportId,
|
||||
@ -99,8 +94,8 @@ pub struct ResolveCommunityReport {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Resolve a post report (mods only).
|
||||
pub struct ResolvePostReport {
|
||||
pub report_id: PostReportId,
|
||||
@ -108,8 +103,8 @@ pub struct ResolvePostReport {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Resolve a private message report.
|
||||
pub struct ResolvePrivateMessageReport {
|
||||
pub report_id: PrivateMessageReportId,
|
||||
@ -117,8 +112,8 @@ pub struct ResolvePrivateMessageReport {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a report for a private message.
|
||||
pub struct CreatePrivateMessageReport {
|
||||
pub private_message_id: PrivateMessageId,
|
||||
@ -126,16 +121,16 @@ pub struct CreatePrivateMessageReport {
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A private message report response.
|
||||
pub struct PrivateMessageReportResponse {
|
||||
pub private_message_report_view: PrivateMessageReportView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The post report response.
|
||||
pub struct PostReportResponse {
|
||||
pub post_report_view: PostReportView,
|
||||
|
@ -26,7 +26,6 @@ use {
|
||||
Person1AliasAllColumnsTuple,
|
||||
Person2AliasAllColumnsTuple,
|
||||
},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
pub mod api;
|
||||
@ -44,9 +43,10 @@ pub mod private_message_report_view;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A private message report view.
|
||||
pub struct PrivateMessageReportView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -62,7 +62,6 @@ pub struct PrivateMessageReportView {
|
||||
)
|
||||
)]
|
||||
pub private_message_creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||
@ -74,9 +73,10 @@ pub struct PrivateMessageReportView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A comment report view.
|
||||
pub struct CommentReportView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -97,9 +97,7 @@ pub struct CommentReportView {
|
||||
)]
|
||||
pub comment_creator: Person,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_actions: Option<CommentActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||
@ -107,7 +105,6 @@ pub struct CommentReportView {
|
||||
)
|
||||
)]
|
||||
pub resolver: Option<Person>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
@ -117,10 +114,8 @@ pub struct CommentReportView {
|
||||
)]
|
||||
pub creator_community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
@ -132,9 +127,10 @@ pub struct CommentReportView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A community report view.
|
||||
pub struct CommunityReportView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -143,7 +139,6 @@ pub struct CommunityReportView {
|
||||
pub community: Community,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
pub creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||
@ -152,11 +147,13 @@ pub struct CommunityReportView {
|
||||
)]
|
||||
pub resolver: Option<Person>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A post report view.
|
||||
pub struct PostReportView {
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
@ -174,7 +171,6 @@ pub struct PostReportView {
|
||||
)
|
||||
)]
|
||||
pub post_creator: Person,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
||||
@ -183,15 +179,11 @@ pub struct PostReportView {
|
||||
)]
|
||||
pub creator_community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_actions: Option<CommunityActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_actions: Option<PostActions>,
|
||||
#[cfg_attr(feature = "full", diesel(embed))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub person_actions: Option<PersonActions>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full",
|
||||
diesel(
|
||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||
|
@ -20,7 +20,6 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
@ -29,6 +28,7 @@ full = [
|
||||
"lemmy_db_views_community/full",
|
||||
"lemmy_db_views_person/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
@ -39,7 +39,6 @@ use {
|
||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||
},
|
||||
lemmy_db_views_local_user::LocalUserView,
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
@ -122,8 +121,8 @@ pub(crate) struct SearchCombinedViewInternal {
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||
// Use serde's internal tagging, to work easier with javascript libraries
|
||||
#[serde(tag = "type_")]
|
||||
pub enum SearchCombinedView {
|
||||
@ -135,55 +134,38 @@ pub enum SearchCombinedView {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Searches the site, given a search term, and some optional filters.
|
||||
pub struct Search {
|
||||
pub q: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_id: Option<CommunityId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub creator_id: Option<PersonId>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub type_: Option<SearchType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sort: Option<SearchSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
/// Filter to within a given time range, in seconds.
|
||||
/// IE 60 would give results for the past minute.
|
||||
pub time_range_seconds: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub listing_type: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub title_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_url_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub liked_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disliked_only: Option<bool>,
|
||||
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The search response, containing lists of the return type possibilities
|
||||
pub struct SearchResponse {
|
||||
pub results: Vec<SearchCombinedView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ full = [
|
||||
"lemmy_utils",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"ts-rs",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_api_misc/full",
|
||||
"lemmy_db_views_person/full",
|
||||
"lemmy_db_views_readable_federation_state/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
@ -18,62 +18,53 @@ use lemmy_db_schema_file::enums::{
|
||||
PostSortType,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_views_api_misc::{MyUserInfo, PluginMetadata};
|
||||
use lemmy_db_views_api_misc::PluginMetadata;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_db_views_readable_federation_state::ReadableFederationState;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
use url::Url;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminAllowInstanceParams {
|
||||
pub instance: String,
|
||||
pub allow: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct AdminBlockInstanceParams {
|
||||
pub instance: String,
|
||||
pub block: bool,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub expires_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Logging in with an OAuth 2.0 authorization
|
||||
pub struct AuthenticateWithOauth {
|
||||
pub code: String,
|
||||
pub oauth_provider_id: OAuthProviderId,
|
||||
pub redirect_uri: Url,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// Username is mandatory at registration time
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub username: Option<String>,
|
||||
/// An answer is mandatory if require application is enabled on the server
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub answer: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub pkce_code_verifier: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create an external auth method.
|
||||
pub struct CreateOAuthProvider {
|
||||
pub display_name: String,
|
||||
@ -85,119 +76,73 @@ pub struct CreateOAuthProvider {
|
||||
pub client_id: String,
|
||||
pub client_secret: String,
|
||||
pub scopes: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub auto_verify_email: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub account_linking_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub use_pkce: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Creates a site. Should be done after first running lemmy.
|
||||
pub struct CreateSite {
|
||||
pub name: String,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_creation_admin_only: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub require_email_verification: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_question: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub private_instance: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_theme: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_type: Option<ListingType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub legal_information: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_email_admins: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub slur_filter_regex: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub actor_name_max_length: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search_per_second: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_difficulty: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub registration_mode: Option<RegistrationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub oauth_registration: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_warning: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_upvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_downvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_upvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_downvotes: Option<FederationMode>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disallow_nsfw_content: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disable_email_notifications: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete an external auth method.
|
||||
pub struct DeleteOAuthProvider {
|
||||
pub id: OAuthProviderId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a tagline
|
||||
pub struct DeleteTagline {
|
||||
pub id: TaglineId,
|
||||
@ -205,171 +150,116 @@ pub struct DeleteTagline {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edit an external auth method.
|
||||
pub struct EditOAuthProvider {
|
||||
pub id: OAuthProviderId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub display_name: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub authorization_endpoint: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub token_endpoint: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub userinfo_endpoint: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub id_claim: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub client_secret: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub scopes: Option<String>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub auto_verify_email: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub account_linking_enabled: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub use_pkce: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Edits a site.
|
||||
pub struct EditSite {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub name: Option<String>,
|
||||
/// A sidebar for the site, in markdown.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub sidebar: Option<String>,
|
||||
/// A shorter, one line description of your site.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub description: Option<String>,
|
||||
/// Limits community creation to admins only.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub community_creation_admin_only: Option<bool>,
|
||||
/// Whether to require email verification.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub require_email_verification: Option<bool>,
|
||||
/// Your application question form. This is in markdown, and can be many questions.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_question: Option<String>,
|
||||
/// Whether your instance is public, or private.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub private_instance: Option<bool>,
|
||||
/// The default theme. Usually "browser"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_theme: Option<String>,
|
||||
/// The default post listing type, usually "local"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_type: Option<ListingType>,
|
||||
/// Default value for listing mode, usually "list"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_listing_mode: Option<PostListingMode>,
|
||||
/// The default post sort, usually "active"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
/// A default time range limit to apply to post sorts, in seconds. 0 means none.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
/// The default comment sort, usually "hot"
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
/// An optional page of legal information
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub legal_information: Option<String>,
|
||||
/// Whether to email admins when receiving a new application.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub application_email_admins: Option<bool>,
|
||||
/// A list of allowed discussion languages.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
/// A regex string of items to filter.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub slur_filter_regex: Option<String>,
|
||||
/// The max length of actor names.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub actor_name_max_length: Option<i32>,
|
||||
/// The number of messages allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_message_per_second: Option<i32>,
|
||||
/// The number of posts allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_post_per_second: Option<i32>,
|
||||
/// The number of registrations allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_register_per_second: Option<i32>,
|
||||
/// The number of image uploads allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_image_per_second: Option<i32>,
|
||||
/// The number of comments allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_comment_per_second: Option<i32>,
|
||||
/// The number of searches allowed in a given time frame.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search: Option<i32>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub rate_limit_search_per_second: Option<i32>,
|
||||
/// Whether to enable federation.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_enabled: Option<bool>,
|
||||
/// Whether to enable captchas for signups.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_enabled: Option<bool>,
|
||||
/// The captcha difficulty. Can be easy, medium, or hard
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub captcha_difficulty: Option<String>,
|
||||
/// A list of blocked URLs
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub blocked_urls: Option<Vec<String>>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub registration_mode: Option<RegistrationMode>,
|
||||
/// Whether to email admins for new reports.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reports_email_admins: Option<bool>,
|
||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||
/// when the site is first opened by a user.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub content_warning: Option<String>,
|
||||
/// Whether or not external auth methods can auto-register users.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub oauth_registration: Option<bool>,
|
||||
/// What kind of post upvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_upvotes: Option<FederationMode>,
|
||||
/// What kind of post downvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub post_downvotes: Option<FederationMode>,
|
||||
/// What kind of comment upvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_upvotes: Option<FederationMode>,
|
||||
/// What kind of comment downvotes your site allows.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub comment_downvotes: Option<FederationMode>,
|
||||
/// Block NSFW content being created
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disallow_nsfw_content: Option<bool>,
|
||||
/// Dont send email notifications to users for new replies, mentions etc
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub disable_email_notifications: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A list of federated instances.
|
||||
pub struct FederatedInstances {
|
||||
pub linked: Vec<InstanceWithFederationState>,
|
||||
@ -379,30 +269,26 @@ pub struct FederatedInstances {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response of federated instances.
|
||||
pub struct GetFederatedInstancesResponse {
|
||||
/// Optional, because federation may be disabled.
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federated_instances: Option<FederatedInstances>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// An expanded response for a site.
|
||||
pub struct GetSiteResponse {
|
||||
pub site_view: SiteView,
|
||||
pub admins: Vec<PersonView>,
|
||||
pub version: String,
|
||||
#[cfg_attr(feature = "full", ts(skip))]
|
||||
pub my_user: Option<MyUserInfo>,
|
||||
pub all_languages: Vec<Language>,
|
||||
pub discussion_languages: Vec<LanguageId>,
|
||||
/// If the site has any taglines, a random one is included here for displaying
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub tagline: Option<Tagline>,
|
||||
/// A list of external auth methods your site supports.
|
||||
pub oauth_providers: Vec<PublicOAuthProvider>,
|
||||
@ -416,62 +302,56 @@ pub struct GetSiteResponse {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct InstanceWithFederationState {
|
||||
#[serde(flatten)]
|
||||
pub instance: Instance,
|
||||
/// if federation to this instance is or was active, show state of outgoing federation to this
|
||||
/// instance
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub federation_state: Option<ReadableFederationState>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Fetches a list of taglines.
|
||||
pub struct ListTaglines {
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub page_back: Option<bool>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for taglines.
|
||||
pub struct ListTaglinesResponse {
|
||||
pub taglines: Vec<Tagline>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response for a site.
|
||||
pub struct SiteResponse {
|
||||
pub site_view: SiteView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct TaglineResponse {
|
||||
pub tagline: Tagline,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Update a tagline
|
||||
pub struct UpdateTagline {
|
||||
pub id: TaglineId,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user