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]]
|
[[package]]
|
||||||
name = "ts-rs"
|
name = "ts-rs"
|
||||||
version = "10.1.0"
|
version = "11.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e640d9b0964e9d39df633548591090ab92f7a4567bc31d3891af23471a3365c6"
|
checksum = "6ef1b7a6d914a34127ed8e1fa927eb7088903787bcded4fa3eef8f85ee1568be"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"lazy_static",
|
|
||||||
"thiserror 2.0.12",
|
"thiserror 2.0.12",
|
||||||
"ts-rs-macros",
|
"ts-rs-macros",
|
||||||
"url",
|
"url",
|
||||||
@ -6907,9 +6906,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ts-rs-macros"
|
name = "ts-rs-macros"
|
||||||
version = "10.1.0"
|
version = "11.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e9d8656589772eeec2cf7a8264d9cda40fb28b9bc53118ceb9e8c07f8f38730"
|
checksum = "e9d4ed7b4c18cc150a6a0a1e9ea1ecfa688791220781af6e119f9599a8502a0a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -202,7 +202,7 @@ futures = "0.3.31"
|
|||||||
futures-util = "0.3.31"
|
futures-util = "0.3.31"
|
||||||
http = "1.2"
|
http = "1.2"
|
||||||
rosetta-i18n = "0.1.3"
|
rosetta-i18n = "0.1.3"
|
||||||
ts-rs = { version = "10.1.0", features = [
|
ts-rs = { version = "11.0.1", features = [
|
||||||
"chrono-impl",
|
"chrono-impl",
|
||||||
"no-serde-warnings",
|
"no-serde-warnings",
|
||||||
"url-impl",
|
"url-impl",
|
||||||
|
@ -94,7 +94,6 @@ pub async fn leave_admin(
|
|||||||
admin_oauth_providers: vec![],
|
admin_oauth_providers: vec![],
|
||||||
blocked_urls,
|
blocked_urls,
|
||||||
tagline,
|
tagline,
|
||||||
my_user: None,
|
|
||||||
image_upload_disabled: context.settings().pictrs()?.image_upload_disabled,
|
image_upload_disabled: context.settings().pictrs()?.image_upload_disabled,
|
||||||
active_plugins: vec![],
|
active_plugins: vec![],
|
||||||
}))
|
}))
|
||||||
|
@ -54,7 +54,6 @@ async fn read_site(context: &LemmyContext) -> LemmyResult<GetSiteResponse> {
|
|||||||
site_view,
|
site_view,
|
||||||
admins,
|
admins,
|
||||||
version: VERSION.to_string(),
|
version: VERSION.to_string(),
|
||||||
my_user: None,
|
|
||||||
all_languages,
|
all_languages,
|
||||||
discussion_languages,
|
discussion_languages,
|
||||||
blocked_urls,
|
blocked_urls,
|
||||||
|
@ -30,7 +30,6 @@ full = [
|
|||||||
"diesel_ltree",
|
"diesel_ltree",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"deadpool",
|
"deadpool",
|
||||||
"ts-rs",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-postgres",
|
"tokio-postgres",
|
||||||
"tokio-postgres-rustls",
|
"tokio-postgres-rustls",
|
||||||
@ -40,6 +39,7 @@ full = [
|
|||||||
"moka",
|
"moka",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = { workspace = true }
|
chrono = { workspace = true }
|
||||||
|
@ -33,14 +33,13 @@ use strum::{Display, EnumString};
|
|||||||
use {
|
use {
|
||||||
diesel::query_source::AliasedField,
|
diesel::query_source::AliasedField,
|
||||||
lemmy_db_schema_file::schema::{community_actions, instance_actions, person},
|
lemmy_db_schema_file::schema::{community_actions, instance_actions, person},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// The search sort types.
|
/// The search sort types.
|
||||||
pub enum SearchSortType {
|
pub enum SearchSortType {
|
||||||
#[default]
|
#[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
|
/// 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)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
pub enum CommunitySortType {
|
pub enum CommunitySortType {
|
||||||
ActiveSixMonths,
|
ActiveSixMonths,
|
||||||
#[default]
|
#[default]
|
||||||
@ -73,8 +72,8 @@ pub enum CommunitySortType {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// The type of content returned from a search.
|
/// The type of content returned from a search.
|
||||||
pub enum SearchType {
|
pub enum SearchType {
|
||||||
#[default]
|
#[default]
|
||||||
@ -86,8 +85,8 @@ pub enum SearchType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// A list of possible types for the various modlog actions.
|
/// A list of possible types for the various modlog actions.
|
||||||
pub enum ModlogActionType {
|
pub enum ModlogActionType {
|
||||||
All,
|
All,
|
||||||
@ -111,8 +110,8 @@ pub enum ModlogActionType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// A list of possible types for the inbox.
|
/// A list of possible types for the inbox.
|
||||||
pub enum InboxDataType {
|
pub enum InboxDataType {
|
||||||
All,
|
All,
|
||||||
@ -123,8 +122,8 @@ pub enum InboxDataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// A list of possible types for a person's content.
|
/// A list of possible types for a person's content.
|
||||||
pub enum PersonContentType {
|
pub enum PersonContentType {
|
||||||
All,
|
All,
|
||||||
@ -133,8 +132,8 @@ pub enum PersonContentType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// A list of possible types for reports.
|
/// A list of possible types for reports.
|
||||||
pub enum ReportType {
|
pub enum ReportType {
|
||||||
All,
|
All,
|
||||||
@ -147,8 +146,8 @@ pub enum ReportType {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// The feature type for a post.
|
/// The feature type for a post.
|
||||||
pub enum PostFeatureType {
|
pub enum PostFeatureType {
|
||||||
#[default]
|
#[default]
|
||||||
@ -161,8 +160,8 @@ pub enum PostFeatureType {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
/// The like_type for a persons liked content.
|
/// The like_type for a persons liked content.
|
||||||
pub enum LikeType {
|
pub enum LikeType {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -22,12 +22,12 @@ use {
|
|||||||
},
|
},
|
||||||
diesel_ltree::Ltree,
|
diesel_ltree::Ltree,
|
||||||
lemmy_utils::error::{LemmyErrorType, LemmyResult},
|
lemmy_utils::error::{LemmyErrorType, LemmyResult},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The post id.
|
||||||
pub struct PostId(pub i32);
|
pub struct PostId(pub i32);
|
||||||
|
|
||||||
@ -38,14 +38,16 @@ impl fmt::Display for PostId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 person id.
|
/// The person id.
|
||||||
pub struct PersonId(pub i32);
|
pub struct PersonId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The comment id.
|
||||||
pub struct CommentId(pub i32);
|
pub struct CommentId(pub i32);
|
||||||
|
|
||||||
@ -61,20 +63,23 @@ pub enum PostOrCommentId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The community id.
|
||||||
pub struct CommunityId(pub i32);
|
pub struct CommunityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 user id.
|
/// The local user id.
|
||||||
pub struct LocalUserId(pub i32);
|
pub struct LocalUserId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The private message id.
|
||||||
pub struct PrivateMessageId(pub i32);
|
pub struct PrivateMessageId(pub i32);
|
||||||
|
|
||||||
@ -85,101 +90,117 @@ impl fmt::Display for PrivateMessageId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 person comment mention id.
|
/// The person comment mention id.
|
||||||
pub struct PersonCommentMentionId(pub i32);
|
pub struct PersonCommentMentionId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 person post mention id.
|
/// The person post mention id.
|
||||||
pub struct PersonPostMentionId(pub i32);
|
pub struct PersonPostMentionId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The comment report id.
|
||||||
pub struct CommentReportId(pub i32);
|
pub struct CommentReportId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 report id.
|
/// The community report id.
|
||||||
pub struct CommunityReportId(pub i32);
|
pub struct CommunityReportId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The post report id.
|
||||||
pub struct PostReportId(pub i32);
|
pub struct PostReportId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The private message report id.
|
||||||
pub struct PrivateMessageReportId(pub i32);
|
pub struct PrivateMessageReportId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The site id.
|
||||||
pub struct SiteId(pub i32);
|
pub struct SiteId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 language id.
|
/// The language id.
|
||||||
pub struct LanguageId(pub i32);
|
pub struct LanguageId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 reply id.
|
/// The comment reply id.
|
||||||
pub struct CommentReplyId(pub i32);
|
pub struct CommentReplyId(pub i32);
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default, Ord, PartialOrd,
|
Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default, Ord, PartialOrd,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 instance id.
|
/// The instance id.
|
||||||
pub struct InstanceId(pub i32);
|
pub struct InstanceId(pub i32);
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default, PartialOrd, Ord,
|
Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default, PartialOrd, Ord,
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ActivityId(pub i64);
|
pub struct ActivityId(pub i64);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 id.
|
/// The local site id.
|
||||||
pub struct LocalSiteId(i32);
|
pub struct LocalSiteId(i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 custom emoji id.
|
/// The custom emoji id.
|
||||||
pub struct CustomEmojiId(i32);
|
pub struct CustomEmojiId(i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 tagline id.
|
/// The tagline id.
|
||||||
pub struct TaglineId(pub i32);
|
pub struct TaglineId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 registration application id.
|
/// The registration application id.
|
||||||
pub struct RegistrationApplicationId(pub i32);
|
pub struct RegistrationApplicationId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 oauth provider id.
|
/// The oauth provider id.
|
||||||
pub struct OAuthProviderId(pub i32);
|
pub struct OAuthProviderId(pub i32);
|
||||||
|
|
||||||
@ -191,9 +212,10 @@ pub struct LtreeDef(pub String);
|
|||||||
|
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
|
#[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", 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>);
|
pub struct DbUrl(pub(crate) Box<Url>);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
@ -231,88 +253,105 @@ pub struct InboxCombinedId(i32);
|
|||||||
pub struct SearchCombinedId(i32);
|
pub struct SearchCombinedId(i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 AdminAllowInstanceId(pub i32);
|
pub struct AdminAllowInstanceId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 AdminBlockInstanceId(pub i32);
|
pub struct AdminBlockInstanceId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 AdminPurgePersonId(pub i32);
|
pub struct AdminPurgePersonId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 AdminPurgeCommunityId(pub i32);
|
pub struct AdminPurgeCommunityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 AdminPurgeCommentId(pub i32);
|
pub struct AdminPurgeCommentId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 AdminPurgePostId(pub i32);
|
pub struct AdminPurgePostId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModRemovePostId(pub i32);
|
pub struct ModRemovePostId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModRemoveCommentId(pub i32);
|
pub struct ModRemoveCommentId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModRemoveCommunityId(pub i32);
|
pub struct ModRemoveCommunityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModLockPostId(pub i32);
|
pub struct ModLockPostId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModFeaturePostId(pub i32);
|
pub struct ModFeaturePostId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModBanFromCommunityId(pub i32);
|
pub struct ModBanFromCommunityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModBanId(pub i32);
|
pub struct ModBanId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModChangeCommunityVisibilityId(pub i32);
|
pub struct ModChangeCommunityVisibilityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModAddCommunityId(pub i32);
|
pub struct ModAddCommunityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModTransferCommunityId(pub i32);
|
pub struct ModTransferCommunityId(pub i32);
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 ModAddId(pub i32);
|
pub struct ModAddId(pub i32);
|
||||||
|
|
||||||
impl DbUrl {
|
impl DbUrl {
|
||||||
@ -421,15 +460,16 @@ impl InstanceId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize)]
|
||||||
#[cfg_attr(feature = "full", derive(DieselNewType, TS))]
|
#[cfg_attr(feature = "full", derive(DieselNewType))]
|
||||||
#[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 internal tag id.
|
/// The internal tag id.
|
||||||
pub struct TagId(pub i32);
|
pub struct TagId(pub i32);
|
||||||
|
|
||||||
/// A pagination cursor
|
/// A pagination cursor
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct PaginationCursor(pub String);
|
pub struct PaginationCursor(pub String);
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{fmt::Debug, ops::Deref};
|
use std::{fmt::Debug, ops::Deref};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize, Serialize, Default)]
|
#[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)]
|
#[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);
|
pub struct SensitiveString(String);
|
||||||
|
|
||||||
impl SensitiveString {
|
impl SensitiveString {
|
||||||
|
@ -8,27 +8,20 @@ use {
|
|||||||
diesel_ltree::Ltree,
|
diesel_ltree::Ltree,
|
||||||
i_love_jesus::CursorKeysModule,
|
i_love_jesus::CursorKeysModule,
|
||||||
lemmy_db_schema_file::schema::{comment, comment_actions},
|
lemmy_db_schema_file::schema::{comment, comment_actions},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(
|
derive(Queryable, Selectable, Associations, Identifiable, CursorKeysModule)
|
||||||
Queryable,
|
|
||||||
Selectable,
|
|
||||||
Associations,
|
|
||||||
Identifiable,
|
|
||||||
TS,
|
|
||||||
CursorKeysModule
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
|
||||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
|
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = comment))]
|
#[cfg_attr(feature = "full", diesel(table_name = comment))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", cursor_keys_module(name = comment_keys))]
|
#[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.
|
/// A comment.
|
||||||
pub struct Comment {
|
pub struct Comment {
|
||||||
pub id: CommentId,
|
pub id: CommentId,
|
||||||
@ -38,7 +31,6 @@ pub struct Comment {
|
|||||||
/// Whether the comment has been removed.
|
/// Whether the comment has been removed.
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
/// Whether the comment has been deleted by its creator.
|
/// Whether the comment has been deleted by its creator.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
@ -48,7 +40,7 @@ pub struct Comment {
|
|||||||
pub local: bool,
|
pub local: bool,
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
#[cfg_attr(feature = "full", serde(with = "LtreeDef"))]
|
#[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:
|
/// The path / tree location of a comment, separated by dots, ending with the comment's id. Ex:
|
||||||
/// 0.24.27
|
/// 0.24.27
|
||||||
pub path: Ltree,
|
pub path: Ltree,
|
||||||
@ -123,33 +115,24 @@ pub struct CommentUpdateForm {
|
|||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(
|
derive(Identifiable, Queryable, Selectable, Associations, CursorKeysModule)
|
||||||
Identifiable,
|
|
||||||
Queryable,
|
|
||||||
Selectable,
|
|
||||||
Associations,
|
|
||||||
TS,
|
|
||||||
CursorKeysModule
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::comment::Comment)))]
|
#[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(table_name = comment_actions))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, comment_id)))]
|
#[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", 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 = "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 {
|
pub struct CommentActions {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// The like / score for the comment.
|
/// The like / score for the comment.
|
||||||
pub like_score: Option<i16>,
|
pub like_score: Option<i16>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the comment was liked.
|
/// When the comment was liked.
|
||||||
pub liked_at: Option<DateTime<Utc>>,
|
pub liked_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the comment was saved.
|
/// When the comment was saved.
|
||||||
pub saved_at: Option<DateTime<Utc>>,
|
pub saved_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,17 @@ use chrono::{DateTime, Utc};
|
|||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use lemmy_db_schema_file::schema::comment_reply;
|
use lemmy_db_schema_file::schema::comment_reply;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(belongs_to(crate::source::comment::Comment)))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
|
#[cfg_attr(feature = "full", diesel(table_name = comment_reply))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A comment reply.
|
||||||
pub struct CommentReply {
|
pub struct CommentReply {
|
||||||
pub id: CommentReplyId,
|
pub id: CommentReplyId,
|
||||||
|
@ -4,19 +4,18 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::comment_report;
|
use lemmy_db_schema_file::schema::comment_report;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(belongs_to(crate::source::comment::Comment)))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = comment_report))]
|
#[cfg_attr(feature = "full", diesel(table_name = comment_report))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A comment report.
|
||||||
pub struct CommentReport {
|
pub struct CommentReport {
|
||||||
pub id: CommentReportId,
|
pub id: CommentReportId,
|
||||||
@ -25,10 +24,8 @@ pub struct CommentReport {
|
|||||||
pub original_comment_text: String,
|
pub original_comment_text: String,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
pub violates_instance_rules: bool,
|
pub violates_instance_rules: bool,
|
||||||
}
|
}
|
||||||
|
@ -11,19 +11,19 @@ use serde_with::skip_serializing_none;
|
|||||||
use {
|
use {
|
||||||
i_love_jesus::CursorKeysModule,
|
i_love_jesus::CursorKeysModule,
|
||||||
lemmy_db_schema_file::schema::{community, community_actions},
|
lemmy_db_schema_file::schema::{community, community_actions},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(table_name = community))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 = "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.
|
/// A community.
|
||||||
pub struct Community {
|
pub struct Community {
|
||||||
pub id: CommunityId,
|
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.
|
/// A longer title, that can contain other characters, and doesn't have to be unique.
|
||||||
pub title: String,
|
pub title: String,
|
||||||
/// A sidebar for the community in markdown.
|
/// A sidebar for the community in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// Whether the community is removed by a mod.
|
/// Whether the community is removed by a mod.
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
/// Whether the community has been deleted by its creator.
|
/// Whether the community has been deleted by its creator.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
@ -53,15 +51,13 @@ pub struct Community {
|
|||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub last_refreshed_at: DateTime<Utc>,
|
pub last_refreshed_at: DateTime<Utc>,
|
||||||
/// A URL for an icon.
|
/// A URL for an icon.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub icon: Option<DbUrl>,
|
pub icon: Option<DbUrl>,
|
||||||
/// A URL for a banner.
|
/// A URL for a banner.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub banner: Option<DbUrl>,
|
pub banner: Option<DbUrl>,
|
||||||
#[cfg_attr(feature = "full", ts(skip))]
|
#[cfg_attr(feature = "ts-rs", ts(skip))]
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub followers_url: Option<DbUrl>,
|
pub followers_url: Option<DbUrl>,
|
||||||
#[cfg_attr(feature = "full", ts(skip))]
|
#[cfg_attr(feature = "ts-rs", ts(skip))]
|
||||||
#[serde(skip, default = "placeholder_apub_url")]
|
#[serde(skip, default = "placeholder_apub_url")]
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
/// Whether posting is restricted to mods only.
|
/// Whether posting is restricted to mods only.
|
||||||
@ -75,7 +71,6 @@ pub struct Community {
|
|||||||
pub featured_url: Option<DbUrl>,
|
pub featured_url: Option<DbUrl>,
|
||||||
pub visibility: CommunityVisibility,
|
pub visibility: CommunityVisibility,
|
||||||
/// A shorter, one-line description of the site.
|
/// A shorter, one-line description of the site.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub random_number: i16,
|
pub random_number: i16,
|
||||||
@ -183,14 +178,7 @@ pub struct CommunityUpdateForm {
|
|||||||
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(
|
derive(Identifiable, Queryable, Selectable, Associations, CursorKeysModule)
|
||||||
Identifiable,
|
|
||||||
Queryable,
|
|
||||||
Selectable,
|
|
||||||
Associations,
|
|
||||||
TS,
|
|
||||||
CursorKeysModule
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
@ -199,32 +187,27 @@ pub struct CommunityUpdateForm {
|
|||||||
#[cfg_attr(feature = "full", diesel(table_name = community_actions))]
|
#[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(primary_key(person_id, community_id)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 = "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 {
|
pub struct CommunityActions {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the community was followed.
|
/// When the community was followed.
|
||||||
pub followed_at: Option<DateTime<Utc>>,
|
pub followed_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// The state of the community follow.
|
/// The state of the community follow.
|
||||||
pub follow_state: Option<CommunityFollowerState>,
|
pub follow_state: Option<CommunityFollowerState>,
|
||||||
/// The approver of the community follow.
|
/// The approver of the community follow.
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub follow_approver_id: Option<PersonId>,
|
pub follow_approver_id: Option<PersonId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the community was blocked.
|
/// When the community was blocked.
|
||||||
pub blocked_at: Option<DateTime<Utc>>,
|
pub blocked_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When this user became a moderator.
|
/// When this user became a moderator.
|
||||||
pub became_moderator_at: Option<DateTime<Utc>>,
|
pub became_moderator_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When this user received a ban.
|
/// When this user received a ban.
|
||||||
pub received_ban_at: Option<DateTime<Utc>>,
|
pub received_ban_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When their ban expires.
|
/// When their ban expires.
|
||||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,12 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::community_report;
|
use lemmy_db_schema_file::schema::community_report;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
@ -19,7 +17,8 @@ use ts_rs::TS;
|
|||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = community_report))]
|
#[cfg_attr(feature = "full", diesel(table_name = community_report))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A comment report.
|
||||||
pub struct CommunityReport {
|
pub struct CommunityReport {
|
||||||
pub id: CommunityReportId,
|
pub id: CommunityReportId,
|
||||||
@ -27,20 +26,14 @@ pub struct CommunityReport {
|
|||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub original_community_name: String,
|
pub original_community_name: String,
|
||||||
pub original_community_title: String,
|
pub original_community_title: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub original_community_description: Option<String>,
|
pub original_community_description: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub original_community_sidebar: Option<String>,
|
pub original_community_sidebar: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub original_community_icon: Option<String>,
|
pub original_community_icon: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub original_community_banner: Option<String>,
|
pub original_community_banner: Option<String>,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,15 +4,14 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::custom_emoji;
|
use lemmy_db_schema_file::schema::custom_emoji;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
#[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(table_name = custom_emoji))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A custom emoji.
|
||||||
pub struct CustomEmoji {
|
pub struct CustomEmoji {
|
||||||
pub id: CustomEmojiId,
|
pub id: CustomEmojiId,
|
||||||
@ -21,7 +20,6 @@ pub struct CustomEmoji {
|
|||||||
pub alt_text: String,
|
pub alt_text: String,
|
||||||
pub category: String,
|
pub category: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,13 +2,11 @@ use crate::newtypes::CustomEmojiId;
|
|||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use lemmy_db_schema_file::schema::custom_emoji_keyword;
|
use lemmy_db_schema_file::schema::custom_emoji_keyword;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(feature = "full", diesel(table_name = custom_emoji_keyword))]
|
||||||
#[cfg_attr(
|
#[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(primary_key(custom_emoji_id, keyword)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A custom keyword for an emoji.
|
||||||
pub struct CustomEmojiKeyword {
|
pub struct CustomEmojiKeyword {
|
||||||
pub custom_emoji_id: CustomEmojiId,
|
pub custom_emoji_id: CustomEmojiId,
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
use crate::newtypes::InstanceId;
|
use crate::newtypes::InstanceId;
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
|
#[cfg(feature = "full")]
|
||||||
|
use lemmy_db_schema_file::schema::federation_blocklist;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt::Debug;
|
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)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(TS, Queryable, Selectable, Associations, Identifiable)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(table_name = federation_blocklist))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 struct FederationBlockList {
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<DateTime<Utc>>,
|
pub expires_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ use chrono::{DateTime, Utc};
|
|||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
@ -13,19 +11,17 @@ use ts_rs::TS;
|
|||||||
feature = "full",
|
feature = "full",
|
||||||
derive(Queryable, Selectable, Insertable, AsChangeset)
|
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(table_name = lemmy_db_schema_file::schema::federation_queue_state))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 struct FederationQueueState {
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
/// the last successfully sent activity id
|
/// the last successfully sent activity id
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub last_successful_id: Option<ActivityId>,
|
pub last_successful_id: Option<ActivityId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub last_successful_published_time_at: Option<DateTime<Utc>>,
|
pub last_successful_published_time_at: Option<DateTime<Utc>>,
|
||||||
/// how many failed attempts have been made to send the next activity
|
/// how many failed attempts have been made to send the next activity
|
||||||
pub fail_count: i32,
|
pub fail_count: i32,
|
||||||
/// timestamp of the last retry attempt (when the last failing activity was resent)
|
/// 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>>,
|
pub last_retry_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
@ -7,33 +7,25 @@ use std::fmt::Debug;
|
|||||||
use {
|
use {
|
||||||
i_love_jesus::CursorKeysModule,
|
i_love_jesus::CursorKeysModule,
|
||||||
lemmy_db_schema_file::schema::{image_details, local_image, remote_image},
|
lemmy_db_schema_file::schema::{image_details, local_image, remote_image},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(
|
derive(Queryable, Selectable, Identifiable, Associations, CursorKeysModule,)
|
||||||
Queryable,
|
|
||||||
Selectable,
|
|
||||||
Identifiable,
|
|
||||||
Associations,
|
|
||||||
CursorKeysModule,
|
|
||||||
TS
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = local_image))]
|
#[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(belongs_to(crate::source::person::Person)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(pictrs_alias)))]
|
||||||
#[cfg_attr(feature = "full", cursor_keys_module(name = local_image_keys))]
|
#[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 struct LocalImage {
|
||||||
pub pictrs_alias: String,
|
pub pictrs_alias: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// This means the image is an auto-generated thumbnail, for a post.
|
/// This means the image is an auto-generated thumbnail, for a post.
|
||||||
pub thumbnail_for_post_id: Option<PostId>,
|
pub thumbnail_for_post_id: Option<PostId>,
|
||||||
}
|
}
|
||||||
@ -62,17 +54,17 @@ pub struct RemoteImage {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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", ts(export))]
|
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = image_details))]
|
#[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(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(link)))]
|
#[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 struct ImageDetails {
|
||||||
pub link: DbUrl,
|
pub link: DbUrl,
|
||||||
pub width: i32,
|
pub width: i32,
|
||||||
pub height: i32,
|
pub height: i32,
|
||||||
pub content_type: String,
|
pub content_type: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,28 +5,24 @@ use lemmy_db_schema_file::schema::{instance, instance_actions};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = instance))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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
|
/// Basic data about a Fediverse instance which is available for every known domain. Additional
|
||||||
/// data may be available in [[Site]].
|
/// data may be available in [[Site]].
|
||||||
pub struct Instance {
|
pub struct Instance {
|
||||||
pub id: InstanceId,
|
pub id: InstanceId,
|
||||||
pub domain: String,
|
pub domain: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the instance was updated.
|
/// When the instance was updated.
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// The software of the instance.
|
/// The software of the instance.
|
||||||
pub software: Option<String>,
|
pub software: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// The version of the instance's software.
|
/// The version of the instance's software.
|
||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
}
|
}
|
||||||
@ -47,7 +43,7 @@ pub struct InstanceForm {
|
|||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
@ -56,19 +52,17 @@ pub struct InstanceForm {
|
|||||||
#[cfg_attr(feature = "full", diesel(table_name = instance_actions))]
|
#[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(primary_key(person_id, instance_id)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 {
|
pub struct InstanceActions {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the instance was blocked.
|
/// When the instance was blocked.
|
||||||
pub blocked_at: Option<DateTime<Utc>>,
|
pub blocked_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When this user received a site ban.
|
/// When this user received a site ban.
|
||||||
pub received_ban_at: Option<DateTime<Utc>>,
|
pub received_ban_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When their ban expires.
|
/// When their ban expires.
|
||||||
pub ban_expires_at: Option<DateTime<Utc>>,
|
pub ban_expires_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,13 @@ use crate::newtypes::LanguageId;
|
|||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use lemmy_db_schema_file::schema::language;
|
use lemmy_db_schema_file::schema::language;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = language))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A language.
|
||||||
pub struct Language {
|
pub struct Language {
|
||||||
pub id: LanguageId,
|
pub id: LanguageId,
|
||||||
|
@ -12,16 +12,15 @@ use lemmy_db_schema_file::enums::{
|
|||||||
use lemmy_db_schema_file::schema::local_site;
|
use lemmy_db_schema_file::schema::local_site;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize, Default)]
|
#[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(table_name = local_site))]
|
||||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::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", 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.
|
/// The local site.
|
||||||
pub struct LocalSite {
|
pub struct LocalSite {
|
||||||
pub id: LocalSiteId,
|
pub id: LocalSiteId,
|
||||||
@ -33,7 +32,6 @@ pub struct LocalSite {
|
|||||||
/// Whether emails are required.
|
/// Whether emails are required.
|
||||||
pub require_email_verification: bool,
|
pub require_email_verification: bool,
|
||||||
/// An optional registration application questionnaire in markdown.
|
/// An optional registration application questionnaire in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub application_question: Option<String>,
|
pub application_question: Option<String>,
|
||||||
/// Whether the instance is private or public.
|
/// Whether the instance is private or public.
|
||||||
pub private_instance: bool,
|
pub private_instance: bool,
|
||||||
@ -41,12 +39,10 @@ pub struct LocalSite {
|
|||||||
pub default_theme: String,
|
pub default_theme: String,
|
||||||
pub default_post_listing_type: ListingType,
|
pub default_post_listing_type: ListingType,
|
||||||
/// An optional legal disclaimer page.
|
/// An optional legal disclaimer page.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub legal_information: Option<String>,
|
pub legal_information: Option<String>,
|
||||||
/// Whether new applications email admins.
|
/// Whether new applications email admins.
|
||||||
pub application_email_admins: bool,
|
pub application_email_admins: bool,
|
||||||
/// An optional regex to filter words.
|
/// An optional regex to filter words.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub slur_filter_regex: Option<String>,
|
pub slur_filter_regex: Option<String>,
|
||||||
/// The max actor name length.
|
/// The max actor name length.
|
||||||
pub actor_name_max_length: i32,
|
pub actor_name_max_length: i32,
|
||||||
@ -57,7 +53,6 @@ pub struct LocalSite {
|
|||||||
/// The captcha difficulty.
|
/// The captcha difficulty.
|
||||||
pub captcha_difficulty: String,
|
pub captcha_difficulty: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
pub registration_mode: RegistrationMode,
|
pub registration_mode: RegistrationMode,
|
||||||
/// Whether to email admins on new reports.
|
/// Whether to email admins on new reports.
|
||||||
@ -81,7 +76,6 @@ pub struct LocalSite {
|
|||||||
pub comment_upvotes: FederationMode,
|
pub comment_upvotes: FederationMode,
|
||||||
/// What kind of comment downvotes your site allows.
|
/// What kind of comment downvotes your site allows.
|
||||||
pub comment_downvotes: FederationMode,
|
pub comment_downvotes: FederationMode,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// A default time range limit to apply to post sorts, in seconds.
|
/// A default time range limit to apply to post sorts, in seconds.
|
||||||
pub default_post_time_range_seconds: Option<i32>,
|
pub default_post_time_range_seconds: Option<i32>,
|
||||||
/// Block NSFW content being created
|
/// Block NSFW content being created
|
||||||
|
@ -4,12 +4,10 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::local_site_rate_limit;
|
use lemmy_db_schema_file::schema::local_site_rate_limit;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
#[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(table_name = local_site_rate_limit))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(local_site_id)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(local_site_id)))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
@ -17,7 +15,8 @@ use ts_rs::TS;
|
|||||||
diesel(belongs_to(crate::source::local_site::LocalSite))
|
diesel(belongs_to(crate::source::local_site::LocalSite))
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// Rate limits for your site. Given in count / length of time.
|
||||||
pub struct LocalSiteRateLimit {
|
pub struct LocalSiteRateLimit {
|
||||||
pub local_site_id: LocalSiteId,
|
pub local_site_id: LocalSiteId,
|
||||||
@ -34,7 +33,6 @@ pub struct LocalSiteRateLimit {
|
|||||||
pub search: i32,
|
pub search: i32,
|
||||||
pub search_per_second: i32,
|
pub search_per_second: i32,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
pub import_user_settings: i32,
|
pub import_user_settings: i32,
|
||||||
pub import_user_settings_per_second: 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 lemmy_db_schema_file::schema::local_site_url_blocklist;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = local_site_url_blocklist))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 struct LocalSiteUrlBlocklist {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
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 lemmy_db_schema_file::schema::local_user;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize, Default)]
|
#[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(table_name = local_user))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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)]
|
#[serde(default)]
|
||||||
/// A local user.
|
/// A local user.
|
||||||
pub struct LocalUser {
|
pub struct LocalUser {
|
||||||
@ -31,7 +30,6 @@ pub struct LocalUser {
|
|||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub password_encrypted: Option<SensitiveString>,
|
pub password_encrypted: Option<SensitiveString>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub email: Option<SensitiveString>,
|
pub email: Option<SensitiveString>,
|
||||||
/// Whether to show NSFW content.
|
/// Whether to show NSFW content.
|
||||||
pub show_nsfw: bool,
|
pub show_nsfw: bool,
|
||||||
@ -79,7 +77,6 @@ pub struct LocalUser {
|
|||||||
pub last_donation_notification_at: DateTime<Utc>,
|
pub last_donation_notification_at: DateTime<Utc>,
|
||||||
/// Whether to hide posts containing images/videos
|
/// Whether to hide posts containing images/videos
|
||||||
pub hide_media: bool,
|
pub hide_media: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// A default time range limit to apply to post sorts, in seconds.
|
/// A default time range limit to apply to post sorts, in seconds.
|
||||||
pub default_post_time_range_seconds: Option<i32>,
|
pub default_post_time_range_seconds: Option<i32>,
|
||||||
pub show_score: bool,
|
pub show_score: bool,
|
||||||
|
@ -4,17 +4,16 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::login_token;
|
use lemmy_db_schema_file::schema::login_token;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
/// Stores data related to a specific user login session.
|
/// Stores data related to a specific user login session.
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = login_token))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(token)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(token)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 {
|
pub struct LoginToken {
|
||||||
/// Jwt token for this login
|
/// Jwt token for this login
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
@ -24,9 +23,7 @@ pub struct LoginToken {
|
|||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
/// IP address where login was made from, allows invalidating logins by IP address.
|
/// 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.
|
/// Could be stored in truncated format, or store derived information for better privacy.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub ip: Option<String>,
|
pub ip: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub user_agent: Option<String>,
|
pub user_agent: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,20 +22,18 @@ use lemmy_db_schema_file::schema::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = admin_purge_person))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When an admin purges a person.
|
||||||
pub struct AdminPurgePerson {
|
pub struct AdminPurgePerson {
|
||||||
pub id: AdminPurgePersonId,
|
pub id: AdminPurgePersonId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
@ -49,15 +47,15 @@ pub struct AdminPurgePersonForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = admin_purge_community))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When an admin purges a community.
|
||||||
pub struct AdminPurgeCommunity {
|
pub struct AdminPurgeCommunity {
|
||||||
pub id: AdminPurgeCommunityId,
|
pub id: AdminPurgeCommunityId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
@ -71,16 +69,16 @@ pub struct AdminPurgeCommunityForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = admin_purge_post))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When an admin purges a post.
|
||||||
pub struct AdminPurgePost {
|
pub struct AdminPurgePost {
|
||||||
pub id: AdminPurgePostId,
|
pub id: AdminPurgePostId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
@ -95,16 +93,16 @@ pub struct AdminPurgePostForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = admin_purge_comment))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When an admin purges a comment.
|
||||||
pub struct AdminPurgeComment {
|
pub struct AdminPurgeComment {
|
||||||
pub id: AdminPurgeCommentId,
|
pub id: AdminPurgeCommentId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
@ -120,7 +118,7 @@ pub struct AdminPurgeCommentForm {
|
|||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(TS, Queryable, Selectable, Associations, Identifiable)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
@ -129,13 +127,13 @@ pub struct AdminPurgeCommentForm {
|
|||||||
#[cfg_attr(feature = "full", diesel(table_name = admin_allow_instance))]
|
#[cfg_attr(feature = "full", diesel(table_name = admin_allow_instance))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 struct AdminAllowInstance {
|
||||||
pub id: AdminAllowInstanceId,
|
pub id: AdminAllowInstanceId,
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub allowed: bool,
|
pub allowed: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
@ -153,7 +151,7 @@ pub struct AdminAllowInstanceForm {
|
|||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(TS, Queryable, Selectable, Associations, Identifiable)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
@ -162,15 +160,14 @@ pub struct AdminAllowInstanceForm {
|
|||||||
#[cfg_attr(feature = "full", diesel(table_name = admin_block_instance))]
|
#[cfg_attr(feature = "full", diesel(table_name = admin_block_instance))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
#[cfg_attr(feature = "full", diesel(primary_key(instance_id)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 struct AdminBlockInstance {
|
||||||
pub id: AdminBlockInstanceId,
|
pub id: AdminBlockInstanceId,
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
pub admin_person_id: PersonId,
|
pub admin_person_id: PersonId,
|
||||||
pub blocked: bool,
|
pub blocked: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<DateTime<Utc>>,
|
pub expires_at: Option<DateTime<Utc>>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -34,21 +34,19 @@ use lemmy_db_schema_file::schema::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_remove_post))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When a moderator removes a post.
|
||||||
pub struct ModRemovePost {
|
pub struct ModRemovePost {
|
||||||
pub id: ModRemovePostId,
|
pub id: ModRemovePostId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
@ -64,10 +62,11 @@ pub struct ModRemovePostForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_lock_post))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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).
|
/// When a moderator locks a post (prevents new comments being made).
|
||||||
pub struct ModLockPost {
|
pub struct ModLockPost {
|
||||||
pub id: ModLockPostId,
|
pub id: ModLockPostId,
|
||||||
@ -75,7 +74,6 @@ pub struct ModLockPost {
|
|||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,10 +87,11 @@ pub struct ModLockPostForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_feature_post))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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).
|
/// When a moderator features a post on a community (pins it to the top).
|
||||||
pub struct ModFeaturePost {
|
pub struct ModFeaturePost {
|
||||||
pub id: ModFeaturePostId,
|
pub id: ModFeaturePostId,
|
||||||
@ -114,16 +113,16 @@ pub struct ModFeaturePostForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_remove_comment))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When a moderator removes a comment.
|
||||||
pub struct ModRemoveComment {
|
pub struct ModRemoveComment {
|
||||||
pub id: ModRemoveCommentId,
|
pub id: ModRemoveCommentId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
@ -140,16 +139,16 @@ pub struct ModRemoveCommentForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_remove_community))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When a moderator removes a community.
|
||||||
pub struct ModRemoveCommunity {
|
pub struct ModRemoveCommunity {
|
||||||
pub id: ModRemoveCommunityId,
|
pub id: ModRemoveCommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
@ -166,20 +165,19 @@ pub struct ModRemoveCommunityForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_ban_from_community))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When someone is banned from a community.
|
||||||
pub struct ModBanFromCommunity {
|
pub struct ModBanFromCommunity {
|
||||||
pub id: ModBanFromCommunityId,
|
pub id: ModBanFromCommunityId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<DateTime<Utc>>,
|
pub expires_at: Option<DateTime<Utc>>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
@ -197,19 +195,18 @@ pub struct ModBanFromCommunityForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_ban))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When someone is banned from the site.
|
||||||
pub struct ModBan {
|
pub struct ModBan {
|
||||||
pub id: ModBanId,
|
pub id: ModBanId,
|
||||||
pub mod_person_id: PersonId,
|
pub mod_person_id: PersonId,
|
||||||
pub other_person_id: PersonId,
|
pub other_person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<DateTime<Utc>>,
|
pub expires_at: Option<DateTime<Utc>>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
@ -225,10 +222,11 @@ pub struct ModChangeCommunityVisibilityForm {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_change_community_visibility))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 struct ModChangeCommunityVisibility {
|
||||||
pub id: ModChangeCommunityVisibilityId,
|
pub id: ModChangeCommunityVisibilityId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -249,10 +247,11 @@ pub struct ModBanForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_add_community))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When someone is added as a community moderator.
|
||||||
pub struct ModAddCommunity {
|
pub struct ModAddCommunity {
|
||||||
pub id: ModAddCommunityId,
|
pub id: ModAddCommunityId,
|
||||||
@ -273,10 +272,11 @@ pub struct ModAddCommunityForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_transfer_community))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When a moderator transfers a community to a new owner.
|
||||||
pub struct ModTransferCommunity {
|
pub struct ModTransferCommunity {
|
||||||
pub id: ModTransferCommunityId,
|
pub id: ModTransferCommunityId,
|
||||||
@ -295,10 +295,11 @@ pub struct ModTransferCommunityForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = mod_add))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// When someone is added as a site moderator.
|
||||||
pub struct ModAdd {
|
pub struct ModAdd {
|
||||||
pub id: ModAddId,
|
pub id: ModAddId,
|
||||||
|
@ -4,22 +4,20 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::oauth_account;
|
use lemmy_db_schema_file::schema::oauth_account;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = oauth_account))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// An auth account method.
|
||||||
pub struct OAuthAccount {
|
pub struct OAuthAccount {
|
||||||
pub local_user_id: LocalUserId,
|
pub local_user_id: LocalUserId,
|
||||||
pub oauth_provider_id: OAuthProviderId,
|
pub oauth_provider_id: OAuthProviderId,
|
||||||
pub oauth_user_id: String,
|
pub oauth_user_id: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,34 +11,33 @@ use serde::{
|
|||||||
Serialize,
|
Serialize,
|
||||||
};
|
};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = oauth_provider))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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
|
/// oauth provider with client_secret - should never be sent to the client
|
||||||
pub struct OAuthProvider {
|
pub struct OAuthProvider {
|
||||||
pub id: OAuthProviderId,
|
pub id: OAuthProviderId,
|
||||||
/// The OAuth 2.0 provider name displayed to the user on the Login page
|
/// The OAuth 2.0 provider name displayed to the user on the Login page
|
||||||
pub display_name: String,
|
pub display_name: String,
|
||||||
/// The issuer url of the OAUTH provider.
|
/// 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,
|
pub issuer: DbUrl,
|
||||||
/// The authorization endpoint is used to interact with the resource owner and obtain an
|
/// The authorization endpoint is used to interact with the resource owner and obtain an
|
||||||
/// authorization grant. This is usually provided by the OAUTH provider.
|
/// 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,
|
pub authorization_endpoint: DbUrl,
|
||||||
/// The token endpoint is used by the client to obtain an access token by presenting its
|
/// 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.
|
/// 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,
|
pub token_endpoint: DbUrl,
|
||||||
/// The UserInfo Endpoint is an OAuth 2.0 Protected Resource that returns Claims about the
|
/// 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.
|
/// 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,
|
pub userinfo_endpoint: DbUrl,
|
||||||
/// The OAuth 2.0 claim containing the unique user ID returned by the provider. Usually this
|
/// The OAuth 2.0 claim containing the unique user ID returned by the provider. Usually this
|
||||||
/// should be set to "sub".
|
/// should be set to "sub".
|
||||||
@ -60,7 +59,6 @@ pub struct OAuthProvider {
|
|||||||
/// switch to enable or disable an oauth provider
|
/// switch to enable or disable an oauth provider
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
/// switch to enable or disable PKCE
|
/// switch to enable or disable PKCE
|
||||||
pub use_pkce: bool,
|
pub use_pkce: bool,
|
||||||
@ -68,8 +66,8 @@ pub struct OAuthProvider {
|
|||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[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
|
// A subset of OAuthProvider used for public requests, for example to display the OAUTH buttons on
|
||||||
// the login page
|
// the login page
|
||||||
pub struct PublicOAuthProvider(pub OAuthProvider);
|
pub struct PublicOAuthProvider(pub OAuthProvider);
|
||||||
|
@ -10,36 +10,31 @@ use i_love_jesus::CursorKeysModule;
|
|||||||
use lemmy_db_schema_file::schema::{person, person_actions};
|
use lemmy_db_schema_file::schema::{person, person_actions};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(table_name = person))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 = "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.
|
/// A person.
|
||||||
pub struct Person {
|
pub struct Person {
|
||||||
pub id: PersonId,
|
pub id: PersonId,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// A shorter display name.
|
/// A shorter display name.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
/// A URL for an avatar.
|
/// A URL for an avatar.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub avatar: Option<DbUrl>,
|
pub avatar: Option<DbUrl>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
/// The federated ap_id.
|
/// The federated ap_id.
|
||||||
pub ap_id: DbUrl,
|
pub ap_id: DbUrl,
|
||||||
/// An optional bio, in markdown.
|
/// An optional bio, in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub bio: Option<String>,
|
pub bio: Option<String>,
|
||||||
/// Whether the person is local to our site.
|
/// Whether the person is local to our site.
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
@ -50,15 +45,13 @@ pub struct Person {
|
|||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub last_refreshed_at: DateTime<Utc>,
|
pub last_refreshed_at: DateTime<Utc>,
|
||||||
/// A URL for a banner.
|
/// A URL for a banner.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub banner: Option<DbUrl>,
|
pub banner: Option<DbUrl>,
|
||||||
/// Whether the person is deleted.
|
/// Whether the person is deleted.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
#[cfg_attr(feature = "full", ts(skip))]
|
#[cfg_attr(feature = "ts-rs", ts(skip))]
|
||||||
#[serde(skip, default = "placeholder_apub_url")]
|
#[serde(skip, default = "placeholder_apub_url")]
|
||||||
pub inbox_url: DbUrl,
|
pub inbox_url: DbUrl,
|
||||||
/// A matrix id, usually given an @person:matrix.org
|
/// A matrix id, usually given an @person:matrix.org
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub matrix_user_id: Option<String>,
|
pub matrix_user_id: Option<String>,
|
||||||
/// Whether the person is a bot account.
|
/// Whether the person is a bot account.
|
||||||
pub bot_account: bool,
|
pub bot_account: bool,
|
||||||
@ -132,13 +125,14 @@ pub struct PersonUpdateForm {
|
|||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(belongs_to(crate::source::person::Person)))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = person_actions))]
|
#[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(primary_key(person_id, target_id)))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 {
|
pub struct PersonActions {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub target_id: PersonId,
|
pub target_id: PersonId,
|
||||||
@ -148,7 +142,6 @@ pub struct PersonActions {
|
|||||||
pub followed_at: Option<DateTime<Utc>>,
|
pub followed_at: Option<DateTime<Utc>>,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub follow_pending: Option<bool>,
|
pub follow_pending: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the person was blocked.
|
/// When the person was blocked.
|
||||||
pub blocked_at: Option<DateTime<Utc>>,
|
pub blocked_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
#[cfg_attr(feature = "full", ts(optional))]
|
||||||
|
@ -3,18 +3,17 @@ use chrono::{DateTime, Utc};
|
|||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use lemmy_db_schema_file::schema::person_comment_mention;
|
use lemmy_db_schema_file::schema::person_comment_mention;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(belongs_to(crate::source::comment::Comment)))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = person_comment_mention))]
|
#[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", 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.
|
/// A person mention.
|
||||||
pub struct PersonCommentMention {
|
pub struct PersonCommentMention {
|
||||||
pub id: PersonCommentMentionId,
|
pub id: PersonCommentMentionId,
|
||||||
|
@ -3,18 +3,17 @@ use chrono::{DateTime, Utc};
|
|||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use lemmy_db_schema_file::schema::person_post_mention;
|
use lemmy_db_schema_file::schema::person_post_mention;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(belongs_to(crate::source::post::Post)))]
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = person_post_mention))]
|
#[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", 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.
|
/// A person mention.
|
||||||
pub struct PersonPostMention {
|
pub struct PersonPostMention {
|
||||||
pub id: PersonPostMentionId,
|
pub id: PersonPostMentionId,
|
||||||
|
@ -6,28 +6,26 @@ use serde_with::skip_serializing_none;
|
|||||||
use {
|
use {
|
||||||
i_love_jesus::CursorKeysModule,
|
i_love_jesus::CursorKeysModule,
|
||||||
lemmy_db_schema_file::schema::{post, post_actions},
|
lemmy_db_schema_file::schema::{post, post_actions},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(table_name = post))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||||
#[cfg_attr(feature = "full", cursor_keys_module(name = post_keys))]
|
#[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.
|
/// A post.
|
||||||
pub struct Post {
|
pub struct Post {
|
||||||
pub id: PostId,
|
pub id: PostId,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// An optional link / url for the post.
|
/// An optional link / url for the post.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub url: Option<DbUrl>,
|
pub url: Option<DbUrl>,
|
||||||
/// An optional post body, in markdown.
|
/// An optional post body, in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
pub creator_id: PersonId,
|
pub creator_id: PersonId,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -36,40 +34,32 @@ pub struct Post {
|
|||||||
/// Whether the post is locked.
|
/// Whether the post is locked.
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
/// Whether the post is deleted.
|
/// Whether the post is deleted.
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
/// Whether the post is NSFW.
|
/// Whether the post is NSFW.
|
||||||
pub nsfw: bool,
|
pub nsfw: bool,
|
||||||
/// A title for the link.
|
/// A title for the link.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub embed_title: Option<String>,
|
pub embed_title: Option<String>,
|
||||||
/// A description for the link.
|
/// A description for the link.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub embed_description: Option<String>,
|
pub embed_description: Option<String>,
|
||||||
/// A thumbnail picture url.
|
/// A thumbnail picture url.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub thumbnail_url: Option<DbUrl>,
|
pub thumbnail_url: Option<DbUrl>,
|
||||||
/// The federated activity id / ap_id.
|
/// The federated activity id / ap_id.
|
||||||
pub ap_id: DbUrl,
|
pub ap_id: DbUrl,
|
||||||
/// Whether the post is local.
|
/// Whether the post is local.
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
/// A video url for the link.
|
/// A video url for the link.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub embed_video_url: Option<DbUrl>,
|
pub embed_video_url: Option<DbUrl>,
|
||||||
pub language_id: LanguageId,
|
pub language_id: LanguageId,
|
||||||
/// Whether the post is featured to its community.
|
/// Whether the post is featured to its community.
|
||||||
pub featured_community: bool,
|
pub featured_community: bool,
|
||||||
/// Whether the post is featured to its site.
|
/// Whether the post is featured to its site.
|
||||||
pub featured_local: bool,
|
pub featured_local: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub url_content_type: Option<String>,
|
pub url_content_type: Option<String>,
|
||||||
/// An optional alt_text, usable for image posts.
|
/// An optional alt_text, usable for image posts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub alt_text: Option<String>,
|
pub alt_text: Option<String>,
|
||||||
/// Time at which the post will be published. None means publish immediately.
|
/// 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 scheduled_publish_time_at: Option<DateTime<Utc>>,
|
||||||
pub comments: i64,
|
pub comments: i64,
|
||||||
pub score: i64,
|
pub score: i64,
|
||||||
@ -182,46 +172,33 @@ pub struct PostUpdateForm {
|
|||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(
|
derive(Identifiable, Queryable, Selectable, Associations, CursorKeysModule)
|
||||||
Identifiable,
|
|
||||||
Queryable,
|
|
||||||
Selectable,
|
|
||||||
Associations,
|
|
||||||
TS,
|
|
||||||
CursorKeysModule
|
|
||||||
)
|
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::post::Post)))]
|
#[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(table_name = post_actions))]
|
||||||
#[cfg_attr(feature = "full", diesel(primary_key(person_id, post_id)))]
|
#[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", 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 = "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 {
|
pub struct PostActions {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the post was read.
|
/// When the post was read.
|
||||||
pub read_at: Option<DateTime<Utc>>,
|
pub read_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When was the last time you read the comments.
|
/// When was the last time you read the comments.
|
||||||
pub read_comments_at: Option<DateTime<Utc>>,
|
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
|
/// The number of comments you read last. Subtract this from total comments to get an unread
|
||||||
/// count.
|
/// count.
|
||||||
pub read_comments_amount: Option<i64>,
|
pub read_comments_amount: Option<i64>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the post was saved.
|
/// When the post was saved.
|
||||||
pub saved_at: Option<DateTime<Utc>>,
|
pub saved_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the post was liked.
|
/// When the post was liked.
|
||||||
pub liked_at: Option<DateTime<Utc>>,
|
pub liked_at: Option<DateTime<Utc>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// The like / score of the post.
|
/// The like / score of the post.
|
||||||
pub like_score: Option<i16>,
|
pub like_score: Option<i16>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// When the post was hidden.
|
/// When the post was hidden.
|
||||||
pub hidden_at: Option<DateTime<Utc>>,
|
pub hidden_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
@ -4,19 +4,18 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::post_report;
|
use lemmy_db_schema_file::schema::post_report;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(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(table_name = post_report))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A post report.
|
||||||
pub struct PostReport {
|
pub struct PostReport {
|
||||||
pub id: PostReportId,
|
pub id: PostReportId,
|
||||||
@ -25,17 +24,13 @@ pub struct PostReport {
|
|||||||
/// The original post title.
|
/// The original post title.
|
||||||
pub original_post_name: String,
|
pub original_post_name: String,
|
||||||
/// The original post url.
|
/// The original post url.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub original_post_url: Option<DbUrl>,
|
pub original_post_url: Option<DbUrl>,
|
||||||
/// The original post body.
|
/// The original post body.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub original_post_body: Option<String>,
|
pub original_post_body: Option<String>,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
pub violates_instance_rules: bool,
|
pub violates_instance_rules: bool,
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,12 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::private_message;
|
use lemmy_db_schema_file::schema::private_message;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
@ -19,7 +17,8 @@ use ts_rs::TS;
|
|||||||
))] // Is this the right assoc?
|
))] // Is this the right assoc?
|
||||||
#[cfg_attr(feature = "full", diesel(table_name = private_message))]
|
#[cfg_attr(feature = "full", diesel(table_name = private_message))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A private message.
|
||||||
pub struct PrivateMessage {
|
pub struct PrivateMessage {
|
||||||
pub id: PrivateMessageId,
|
pub id: PrivateMessageId,
|
||||||
@ -29,7 +28,6 @@ pub struct PrivateMessage {
|
|||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
pub ap_id: DbUrl,
|
pub ap_id: DbUrl,
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
|
@ -4,14 +4,12 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::private_message_report;
|
use lemmy_db_schema_file::schema::private_message_report;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
derive(Queryable, Selectable, Associations, Identifiable, TS)
|
derive(Queryable, Selectable, Associations, Identifiable)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(table_name = private_message_report))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// The private message report.
|
||||||
pub struct PrivateMessageReport {
|
pub struct PrivateMessageReport {
|
||||||
pub id: PrivateMessageReportId,
|
pub id: PrivateMessageReportId,
|
||||||
@ -29,10 +28,8 @@ pub struct PrivateMessageReport {
|
|||||||
pub original_pm_text: String,
|
pub original_pm_text: String,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
pub resolved: bool,
|
pub resolved: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub resolver_id: Option<PersonId>,
|
pub resolver_id: Option<PersonId>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,23 +4,20 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::registration_application;
|
use lemmy_db_schema_file::schema::registration_application;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
#[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(table_name = registration_application))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A registration application.
|
||||||
pub struct RegistrationApplication {
|
pub struct RegistrationApplication {
|
||||||
pub id: RegistrationApplicationId,
|
pub id: RegistrationApplicationId,
|
||||||
pub local_user_id: LocalUserId,
|
pub local_user_id: LocalUserId,
|
||||||
pub answer: String,
|
pub answer: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin_id: Option<PersonId>,
|
pub admin_id: Option<PersonId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub deny_reason: Option<String>,
|
pub deny_reason: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
@ -7,34 +7,28 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema_file::schema::site;
|
use lemmy_db_schema_file::schema::site;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
#[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(table_name = site))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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
|
/// 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]].
|
/// fully compatible. Basic data is guaranteed to be available via [[Instance]].
|
||||||
pub struct Site {
|
pub struct Site {
|
||||||
pub id: SiteId,
|
pub id: SiteId,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
/// A sidebar for the site in markdown.
|
/// A sidebar for the site in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
/// An icon URL.
|
/// An icon URL.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub icon: Option<DbUrl>,
|
pub icon: Option<DbUrl>,
|
||||||
/// A banner url.
|
/// A banner url.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub banner: Option<DbUrl>,
|
pub banner: Option<DbUrl>,
|
||||||
/// A shorter, one-line description of the site.
|
/// A shorter, one-line description of the site.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// The federated ap_id.
|
/// The federated ap_id.
|
||||||
pub ap_id: DbUrl,
|
pub ap_id: DbUrl,
|
||||||
@ -49,7 +43,6 @@ pub struct Site {
|
|||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||||
/// when the site is first opened by a user.
|
/// when the site is first opened by a user.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub content_warning: Option<String>,
|
pub content_warning: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,15 +6,15 @@ use serde_with::skip_serializing_none;
|
|||||||
use {
|
use {
|
||||||
diesel::{sql_types::Nullable, AsExpression, FromSqlRow},
|
diesel::{sql_types::Nullable, AsExpression, FromSqlRow},
|
||||||
lemmy_db_schema_file::schema::tag,
|
lemmy_db_schema_file::schema::tag,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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(table_name = tag))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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.
|
/// A tag that can be assigned to a post within a community.
|
||||||
/// The tag object is created by the community moderators.
|
/// The tag object is created by the community moderators.
|
||||||
/// The assignment happens by the post creator and can be updated 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
|
/// the community that owns this tag
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
}
|
}
|
||||||
@ -62,7 +61,9 @@ pub struct TagUpdateForm {
|
|||||||
|
|
||||||
#[derive(Clone, serde::Serialize, serde::Deserialize, Debug, PartialEq, Default)]
|
#[derive(Clone, serde::Serialize, serde::Deserialize, Debug, PartialEq, Default)]
|
||||||
#[serde(transparent)]
|
#[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 = "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
|
/// we wrap this in a struct so we can implement FromSqlRow<Json> for it
|
||||||
pub struct TagsView(pub Vec<Tag>);
|
pub struct TagsView(pub Vec<Tag>);
|
||||||
|
@ -3,24 +3,24 @@ use chrono::{DateTime, Utc};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
#[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]
|
#[skip_serializing_none]
|
||||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "full",
|
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(table_name = tagline))]
|
||||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
#[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 = "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.
|
/// A tagline, shown at the top of your site.
|
||||||
pub struct Tagline {
|
pub struct Tagline {
|
||||||
pub id: TaglineId,
|
pub id: TaglineId,
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub published_at: DateTime<Utc>,
|
pub published_at: DateTime<Utc>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub updated_at: Option<DateTime<Utc>>,
|
pub updated_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,13 +22,13 @@ full = [
|
|||||||
"diesel",
|
"diesel",
|
||||||
"diesel_ltree",
|
"diesel_ltree",
|
||||||
"diesel-derive-enum",
|
"diesel-derive-enum",
|
||||||
"ts-rs",
|
|
||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
"tracing",
|
"tracing",
|
||||||
"diesel_migrations",
|
"diesel_migrations",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
|
#[cfg(feature = "full")]
|
||||||
|
use diesel_derive_enum::DbEnum;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use strum::{Display, EnumString};
|
use strum::{Display, EnumString};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use {diesel_derive_enum::DbEnum, ts_rs::TS};
|
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::PostSortTypeEnum"
|
ExistingTypePath = "crate::schema::sql_types::PostSortTypeEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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
|
// 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
|
/// The post sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||||
pub enum PostSortType {
|
pub enum PostSortType {
|
||||||
@ -31,13 +32,14 @@ pub enum PostSortType {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::CommentSortTypeEnum"
|
ExistingTypePath = "crate::schema::sql_types::CommentSortTypeEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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
|
/// The comment sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||||
pub enum CommentSortType {
|
pub enum CommentSortType {
|
||||||
#[default]
|
#[default]
|
||||||
@ -51,13 +53,14 @@ pub enum CommentSortType {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
|
ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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.
|
/// A listing type for post and comment list fetches.
|
||||||
pub enum ListingType {
|
pub enum ListingType {
|
||||||
/// Content from your own site, as well as all connected / federated sites.
|
/// Content from your own site, as well as all connected / federated sites.
|
||||||
@ -74,13 +77,14 @@ pub enum ListingType {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
|
ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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.
|
/// The registration mode for your site. Determines what happens after a user signs up.
|
||||||
pub enum RegistrationMode {
|
pub enum RegistrationMode {
|
||||||
/// Closed to public.
|
/// Closed to public.
|
||||||
@ -95,13 +99,14 @@ pub enum RegistrationMode {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::PostListingModeEnum"
|
ExistingTypePath = "crate::schema::sql_types::PostListingModeEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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.
|
/// A post-view mode that changes how multiple post listings look.
|
||||||
pub enum PostListingMode {
|
pub enum PostListingMode {
|
||||||
/// A compact, list-type view.
|
/// A compact, list-type view.
|
||||||
@ -116,13 +121,14 @@ pub enum PostListingMode {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::CommunityVisibility"
|
ExistingTypePath = "crate::schema::sql_types::CommunityVisibility"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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.
|
/// Defines who can browse and interact with content in a community.
|
||||||
pub enum CommunityVisibility {
|
pub enum CommunityVisibility {
|
||||||
/// Public community, any local or federated user can interact.
|
/// Public community, any local or federated user can interact.
|
||||||
@ -153,13 +159,14 @@ impl CommunityVisibility {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::FederationModeEnum"
|
ExistingTypePath = "crate::schema::sql_types::FederationModeEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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
|
/// The federation mode for an item
|
||||||
pub enum FederationMode {
|
pub enum FederationMode {
|
||||||
#[default]
|
#[default]
|
||||||
@ -184,13 +191,14 @@ pub enum ActorType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::CommunityFollowerState"
|
ExistingTypePath = "crate::schema::sql_types::CommunityFollowerState"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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 {
|
pub enum CommunityFollowerState {
|
||||||
Accepted,
|
Accepted,
|
||||||
Pending,
|
Pending,
|
||||||
@ -200,13 +208,14 @@ pub enum CommunityFollowerState {
|
|||||||
#[derive(
|
#[derive(
|
||||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
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(
|
#[cfg_attr(
|
||||||
feature = "full",
|
feature = "full",
|
||||||
ExistingTypePath = "crate::schema::sql_types::VoteShowEnum"
|
ExistingTypePath = "crate::schema::sql_types::VoteShowEnum"
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
#[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.
|
/// Lets you show votes for others only, show all votes, or hide all votes.
|
||||||
pub enum VoteShow {
|
pub enum VoteShow {
|
||||||
#[default]
|
#[default]
|
||||||
|
@ -25,8 +25,8 @@ full = [
|
|||||||
"lemmy_db_views_post/full",
|
"lemmy_db_views_post/full",
|
||||||
"extism",
|
"extism",
|
||||||
"extism-convert",
|
"extism-convert",
|
||||||
"ts-rs",
|
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema.workspace = true
|
lemmy_db_schema.workspace = true
|
||||||
|
@ -21,12 +21,11 @@ use url::Url;
|
|||||||
use {
|
use {
|
||||||
extism::FromBytes,
|
extism::FromBytes,
|
||||||
extism_convert::{encoding, Json},
|
extism_convert::{encoding, Json},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A captcha response.
|
/// A captcha response.
|
||||||
pub struct CaptchaResponse {
|
pub struct CaptchaResponse {
|
||||||
/// A Base64 encoded png
|
/// A Base64 encoded png
|
||||||
@ -38,8 +37,8 @@ pub struct CaptchaResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Changes your account password.
|
/// Changes your account password.
|
||||||
pub struct ChangePassword {
|
pub struct ChangePassword {
|
||||||
pub new_password: SensitiveString,
|
pub new_password: SensitiveString,
|
||||||
@ -48,16 +47,16 @@ pub struct ChangePassword {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a tagline
|
/// Create a tagline
|
||||||
pub struct CreateTagline {
|
pub struct CreateTagline {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete your account.
|
/// Delete your account.
|
||||||
pub struct DeleteAccount {
|
pub struct DeleteAccount {
|
||||||
pub password: SensitiveString,
|
pub password: SensitiveString,
|
||||||
@ -66,89 +65,78 @@ pub struct DeleteAccount {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A wrapper for the captcha response.
|
/// A wrapper for the captcha response.
|
||||||
pub struct GetCaptchaResponse {
|
pub struct GetCaptchaResponse {
|
||||||
/// Will be None if captchas are disabled.
|
/// Will be None if captchas are disabled.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub ok: Option<CaptchaResponse>,
|
pub ok: Option<CaptchaResponse>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct GenerateTotpSecretResponse {
|
pub struct GenerateTotpSecretResponse {
|
||||||
pub totp_secret_url: SensitiveString,
|
pub totp_secret_url: SensitiveString,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ListLoginsResponse {
|
pub struct ListLoginsResponse {
|
||||||
pub logins: Vec<LoginToken>,
|
pub logins: Vec<LoginToken>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets your hidden posts.
|
/// Gets your hidden posts.
|
||||||
pub struct ListPersonHidden {
|
pub struct ListPersonHidden {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// You hidden posts response.
|
/// You hidden posts response.
|
||||||
pub struct ListPersonHiddenResponse {
|
pub struct ListPersonHiddenResponse {
|
||||||
pub hidden: Vec<PostView>,
|
pub hidden: Vec<PostView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets your read posts.
|
/// Gets your read posts.
|
||||||
pub struct ListPersonRead {
|
pub struct ListPersonRead {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// You read posts response.
|
/// You read posts response.
|
||||||
pub struct ListPersonReadResponse {
|
pub struct ListPersonReadResponse {
|
||||||
pub read: Vec<PostView>,
|
pub read: Vec<PostView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Logging into lemmy.
|
/// Logging into lemmy.
|
||||||
///
|
///
|
||||||
/// Note: Banned users can still log in, to be able to do certain things like delete
|
/// 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 username_or_email: SensitiveString,
|
||||||
pub password: SensitiveString,
|
pub password: SensitiveString,
|
||||||
/// May be required, if totp is enabled for their account.
|
/// May be required, if totp is enabled for their account.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub totp_2fa_token: Option<String>,
|
pub totp_2fa_token: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response for your login.
|
/// A response for your login.
|
||||||
pub struct LoginResponse {
|
pub struct LoginResponse {
|
||||||
/// This is None in response to `Register` if email verification is enabled, or the server
|
/// This is None in response to `Register` if email verification is enabled, or the server
|
||||||
/// requires registration applications.
|
/// requires registration applications.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub jwt: Option<SensitiveString>,
|
pub jwt: Option<SensitiveString>,
|
||||||
/// If registration applications are required, this will return true for a signup response.
|
/// If registration applications are required, this will return true for a signup response.
|
||||||
pub registration_created: bool,
|
pub registration_created: bool,
|
||||||
@ -189,8 +175,8 @@ pub struct NotePerson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Your user info.
|
/// Your user info.
|
||||||
pub struct MyUserInfo {
|
pub struct MyUserInfo {
|
||||||
pub local_user_view: LocalUserView,
|
pub local_user_view: LocalUserView,
|
||||||
@ -204,8 +190,8 @@ pub struct MyUserInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Change your password after receiving a reset request.
|
/// Change your password after receiving a reset request.
|
||||||
pub struct PasswordChangeAfterReset {
|
pub struct PasswordChangeAfterReset {
|
||||||
pub token: SensitiveString,
|
pub token: SensitiveString,
|
||||||
@ -214,17 +200,18 @@ pub struct PasswordChangeAfterReset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Reset your password via email.
|
/// Reset your password via email.
|
||||||
pub struct PasswordReset {
|
pub struct PasswordReset {
|
||||||
pub email: SensitiveString,
|
pub email: SensitiveString,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS, FromBytes))]
|
#[cfg_attr(feature = "full", derive(FromBytes))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
|
||||||
#[cfg_attr(feature = "full", encoding(Json))]
|
#[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 {
|
pub struct PluginMetadata {
|
||||||
name: String,
|
name: String,
|
||||||
url: Url,
|
url: Url,
|
||||||
@ -232,16 +219,16 @@ pub struct PluginMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Make a request to resend your verification email.
|
/// Make a request to resend your verification email.
|
||||||
pub struct ResendVerificationEmail {
|
pub struct ResendVerificationEmail {
|
||||||
pub email: SensitiveString,
|
pub email: SensitiveString,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Does an apub fetch for an object.
|
/// Does an apub fetch for an object.
|
||||||
pub struct ResolveObject {
|
pub struct ResolveObject {
|
||||||
/// Can be the full url, or a shortened version like: !fediverse@lemmy.ml
|
/// Can be the full url, or a shortened version like: !fediverse@lemmy.ml
|
||||||
@ -250,109 +237,77 @@ pub struct ResolveObject {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Saves settings for your user.
|
/// Saves settings for your user.
|
||||||
pub struct SaveUserSettings {
|
pub struct SaveUserSettings {
|
||||||
/// Show nsfw posts.
|
/// Show nsfw posts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// Blur nsfw posts.
|
/// Blur nsfw posts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub blur_nsfw: Option<bool>,
|
pub blur_nsfw: Option<bool>,
|
||||||
/// Your user's theme.
|
/// Your user's theme.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub theme: Option<String>,
|
pub theme: Option<String>,
|
||||||
/// The default post listing type, usually "local"
|
/// The default post listing type, usually "local"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_listing_type: Option<ListingType>,
|
pub default_listing_type: Option<ListingType>,
|
||||||
/// A post-view mode that changes how multiple post listings look.
|
/// A post-view mode that changes how multiple post listings look.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_listing_mode: Option<PostListingMode>,
|
pub post_listing_mode: Option<PostListingMode>,
|
||||||
/// The default post sort, usually "active"
|
/// The default post sort, usually "active"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_sort_type: Option<PostSortType>,
|
pub default_post_sort_type: Option<PostSortType>,
|
||||||
/// A default time range limit to apply to post sorts, in seconds. 0 means none.
|
/// 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>,
|
pub default_post_time_range_seconds: Option<i32>,
|
||||||
/// The default comment sort, usually "hot"
|
/// The default comment sort, usually "hot"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_comment_sort_type: Option<CommentSortType>,
|
pub default_comment_sort_type: Option<CommentSortType>,
|
||||||
/// The language of the lemmy interface
|
/// The language of the lemmy interface
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub interface_language: Option<String>,
|
pub interface_language: Option<String>,
|
||||||
/// Your display name, which can contain strange characters, and does not need to be unique.
|
/// 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>,
|
pub display_name: Option<String>,
|
||||||
/// Your email.
|
/// Your email.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub email: Option<SensitiveString>,
|
pub email: Option<SensitiveString>,
|
||||||
/// Your bio / info, in markdown.
|
/// Your bio / info, in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub bio: Option<String>,
|
pub bio: Option<String>,
|
||||||
/// Your matrix user id. Ex: @my_user:matrix.org
|
/// Your matrix user id. Ex: @my_user:matrix.org
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub matrix_user_id: Option<String>,
|
pub matrix_user_id: Option<String>,
|
||||||
/// Whether to show or hide avatars.
|
/// Whether to show or hide avatars.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_avatars: Option<bool>,
|
pub show_avatars: Option<bool>,
|
||||||
/// Sends notifications to your email.
|
/// Sends notifications to your email.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub send_notifications_to_email: Option<bool>,
|
pub send_notifications_to_email: Option<bool>,
|
||||||
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
/// 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>,
|
pub bot_account: Option<bool>,
|
||||||
/// Whether to show bot accounts.
|
/// Whether to show bot accounts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_bot_accounts: Option<bool>,
|
pub show_bot_accounts: Option<bool>,
|
||||||
/// Whether to show read posts.
|
/// Whether to show read posts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_read_posts: Option<bool>,
|
pub show_read_posts: Option<bool>,
|
||||||
/// A list of languages you are able to see discussion in.
|
/// A list of languages you are able to see discussion in.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
// A list of keywords used for blocking posts having them in title,url or body.
|
// 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>>,
|
pub blocking_keywords: Option<Vec<String>>,
|
||||||
/// Open links in a new tab
|
/// Open links in a new tab
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub open_links_in_new_tab: Option<bool>,
|
pub open_links_in_new_tab: Option<bool>,
|
||||||
/// Enable infinite scroll
|
/// Enable infinite scroll
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub infinite_scroll_enabled: Option<bool>,
|
pub infinite_scroll_enabled: Option<bool>,
|
||||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
/// 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>,
|
pub enable_keyboard_navigation: Option<bool>,
|
||||||
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
||||||
/// should be paused
|
/// should be paused
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub enable_animated_images: Option<bool>,
|
pub enable_animated_images: Option<bool>,
|
||||||
/// Whether a user can send / receive private messages
|
/// Whether a user can send / receive private messages
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub enable_private_messages: Option<bool>,
|
pub enable_private_messages: Option<bool>,
|
||||||
/// Whether to auto-collapse bot comments.
|
/// Whether to auto-collapse bot comments.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub collapse_bot_comments: Option<bool>,
|
pub collapse_bot_comments: Option<bool>,
|
||||||
/// Some vote display mode settings
|
/// Some vote display mode settings
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_scores: Option<bool>,
|
pub show_scores: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_upvotes: Option<bool>,
|
pub show_upvotes: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_downvotes: Option<VoteShow>,
|
pub show_downvotes: Option<VoteShow>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_upvote_percentage: Option<bool>,
|
pub show_upvote_percentage: Option<bool>,
|
||||||
/// Whether to automatically mark fetched posts as read.
|
/// Whether to automatically mark fetched posts as read.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
||||||
/// Whether to hide posts containing images/videos.
|
/// Whether to hide posts containing images/videos.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub hide_media: Option<bool>,
|
pub hide_media: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response that completes successfully.
|
/// A response that completes successfully.
|
||||||
pub struct SuccessResponse {
|
pub struct SuccessResponse {
|
||||||
pub success: bool,
|
pub success: bool,
|
||||||
@ -365,23 +320,23 @@ impl Default for SuccessResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct UpdateTotp {
|
pub struct UpdateTotp {
|
||||||
pub totp_token: String,
|
pub totp_token: String,
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct UpdateTotpResponse {
|
pub struct UpdateTotpResponse {
|
||||||
pub enabled: bool,
|
pub enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Block an instance as user
|
/// Block an instance as user
|
||||||
pub struct UserBlockInstanceParams {
|
pub struct UserBlockInstanceParams {
|
||||||
pub instance_id: InstanceId,
|
pub instance_id: InstanceId,
|
||||||
@ -389,8 +344,8 @@ pub struct UserBlockInstanceParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Verify your email.
|
/// Verify your email.
|
||||||
pub struct VerifyEmail {
|
pub struct VerifyEmail {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
|
@ -21,12 +21,12 @@ full = [
|
|||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"diesel_ltree",
|
"diesel_ltree",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_vote/full",
|
"lemmy_db_views_vote/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -11,13 +11,11 @@ use lemmy_db_schema_file::enums::{CommentSortType, ListingType};
|
|||||||
use lemmy_db_views_vote::VoteView;
|
use lemmy_db_views_vote::VoteView;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A comment response.
|
/// A comment response.
|
||||||
pub struct CommentResponse {
|
pub struct CommentResponse {
|
||||||
pub comment_view: CommentView,
|
pub comment_view: CommentView,
|
||||||
@ -26,21 +24,19 @@ pub struct CommentResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a comment.
|
/// Create a comment.
|
||||||
pub struct CreateComment {
|
pub struct CreateComment {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub parent_id: Option<CommentId>,
|
pub parent_id: Option<CommentId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Like a comment.
|
/// Like a comment.
|
||||||
pub struct CreateCommentLike {
|
pub struct CreateCommentLike {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
@ -50,8 +46,8 @@ pub struct CreateCommentLike {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete your own comment.
|
/// Delete your own comment.
|
||||||
pub struct DeleteComment {
|
pub struct DeleteComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
@ -60,8 +56,8 @@ pub struct DeleteComment {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Distinguish a comment (IE speak as moderator).
|
/// Distinguish a comment (IE speak as moderator).
|
||||||
pub struct DistinguishComment {
|
pub struct DistinguishComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
@ -70,8 +66,8 @@ pub struct DistinguishComment {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetch an individual comment.
|
/// Fetch an individual comment.
|
||||||
pub struct GetComment {
|
pub struct GetComment {
|
||||||
pub id: CommentId,
|
pub id: CommentId,
|
||||||
@ -79,114 +75,92 @@ pub struct GetComment {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get a list of comments.
|
/// Get a list of comments.
|
||||||
pub struct GetComments {
|
pub struct GetComments {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sort: Option<CommentSortType>,
|
pub sort: Option<CommentSortType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// Filter to within a given time range, in seconds.
|
/// Filter to within a given time range, in seconds.
|
||||||
/// IE 60 would give results for the past minute.
|
/// IE 60 would give results for the past minute.
|
||||||
pub time_range_seconds: Option<i32>,
|
pub time_range_seconds: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub max_depth: Option<i32>,
|
pub max_depth: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_name: Option<String>,
|
pub community_name: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub parent_id: Option<CommentId>,
|
pub parent_id: Option<CommentId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The comment list response.
|
/// The comment list response.
|
||||||
pub struct GetCommentsResponse {
|
pub struct GetCommentsResponse {
|
||||||
pub comments: Vec<CommentView>,
|
pub comments: Vec<CommentView>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A slimmer comment list response, without the post or community.
|
/// A slimmer comment list response, without the post or community.
|
||||||
pub struct GetCommentsSlimResponse {
|
pub struct GetCommentsSlimResponse {
|
||||||
pub comments: Vec<CommentSlimView>,
|
pub comments: Vec<CommentSlimView>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// List comment likes. Admins-only.
|
/// List comment likes. Admins-only.
|
||||||
pub struct ListCommentLikes {
|
pub struct ListCommentLikes {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The comment likes response
|
/// The comment likes response
|
||||||
pub struct ListCommentLikesResponse {
|
pub struct ListCommentLikesResponse {
|
||||||
pub comment_likes: Vec<VoteView>,
|
pub comment_likes: Vec<VoteView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Purges a comment from the database. This will delete all content attached to that comment.
|
/// Purges a comment from the database. This will delete all content attached to that comment.
|
||||||
pub struct PurgeComment {
|
pub struct PurgeComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Remove a comment (only doable by mods).
|
/// Remove a comment (only doable by mods).
|
||||||
pub struct RemoveComment {
|
pub struct RemoveComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Save / bookmark a comment.
|
/// Save / bookmark a comment.
|
||||||
pub struct SaveComment {
|
pub struct SaveComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
@ -195,13 +169,11 @@ pub struct SaveComment {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edit a comment.
|
/// Edit a comment.
|
||||||
pub struct EditComment {
|
pub struct EditComment {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub content: Option<String>,
|
pub content: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ use {
|
|||||||
CreatorHomeInstanceActionsAllColumnsTuple,
|
CreatorHomeInstanceActionsAllColumnsTuple,
|
||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -35,9 +34,10 @@ pub mod impls;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A comment view.
|
||||||
pub struct CommentView {
|
pub struct CommentView {
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
@ -53,28 +53,21 @@ pub struct CommentView {
|
|||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_actions: Option<CommentActions>,
|
pub comment_actions: Option<CommentActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_home_instance_actions_select()))]
|
select_expression = creator_home_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_local_instance_actions_select()))]
|
select_expression = creator_local_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
||||||
@ -110,24 +103,19 @@ pub struct CommentView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A slimmer comment view, without the post, or community.
|
||||||
pub struct CommentSlimView {
|
pub struct CommentSlimView {
|
||||||
pub comment: Comment,
|
pub comment: Comment,
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_actions: Option<CommentActions>,
|
pub comment_actions: Option<CommentActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_community_actions: Option<CommunityActions>,
|
pub creator_community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||||
pub creator_is_admin: bool,
|
pub creator_is_admin: bool,
|
||||||
pub can_mod: bool,
|
pub can_mod: bool,
|
||||||
|
@ -20,13 +20,13 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_community_moderator/full",
|
"lemmy_db_views_community_moderator/full",
|
||||||
"lemmy_db_views_person/full",
|
"lemmy_db_views_person/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -9,12 +9,10 @@ use lemmy_db_views_community_moderator::CommunityModeratorView;
|
|||||||
use lemmy_db_views_person::PersonView;
|
use lemmy_db_views_person::PersonView;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Add a moderator to a community.
|
/// Add a moderator to a community.
|
||||||
pub struct AddModToCommunity {
|
pub struct AddModToCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -23,16 +21,16 @@ pub struct AddModToCommunity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response of adding a moderator to a community.
|
/// The response of adding a moderator to a community.
|
||||||
pub struct AddModToCommunityResponse {
|
pub struct AddModToCommunityResponse {
|
||||||
pub moderators: Vec<CommunityModeratorView>,
|
pub moderators: Vec<CommunityModeratorView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ApproveCommunityPendingFollower {
|
pub struct ApproveCommunityPendingFollower {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub follower_id: PersonId,
|
pub follower_id: PersonId,
|
||||||
@ -41,8 +39,8 @@ pub struct ApproveCommunityPendingFollower {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Ban a user from a community.
|
/// Ban a user from a community.
|
||||||
pub struct BanFromCommunity {
|
pub struct BanFromCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -50,20 +48,17 @@ pub struct BanFromCommunity {
|
|||||||
pub ban: bool,
|
pub ban: bool,
|
||||||
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
/// 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.
|
/// 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>,
|
pub remove_or_restore_data: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
/// A time that the ban will expire, in unix epoch seconds.
|
/// A time that the ban will expire, in unix epoch seconds.
|
||||||
///
|
///
|
||||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<i64>,
|
pub expires_at: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response for banning a user from a community.
|
/// The response for banning a user from a community.
|
||||||
pub struct BanFromCommunityResponse {
|
pub struct BanFromCommunityResponse {
|
||||||
pub person_view: PersonView,
|
pub person_view: PersonView,
|
||||||
@ -71,8 +66,8 @@ pub struct BanFromCommunityResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Block a community.
|
/// Block a community.
|
||||||
pub struct BlockCommunity {
|
pub struct BlockCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -81,8 +76,8 @@ pub struct BlockCommunity {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The block community response.
|
/// The block community response.
|
||||||
pub struct BlockCommunityResponse {
|
pub struct BlockCommunityResponse {
|
||||||
pub community_view: CommunityView,
|
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
|
/// Parameter for setting community icon or banner. Can't use POST data here as it already contains
|
||||||
/// the image data.
|
/// the image data.
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct CommunityIdQuery {
|
pub struct CommunityIdQuery {
|
||||||
pub id: CommunityId,
|
pub id: CommunityId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A simple community response.
|
/// A simple community response.
|
||||||
pub struct CommunityResponse {
|
pub struct CommunityResponse {
|
||||||
pub community_view: CommunityView,
|
pub community_view: CommunityView,
|
||||||
@ -108,8 +103,8 @@ pub struct CommunityResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
/// Create a community.
|
/// Create a community.
|
||||||
pub struct CreateCommunity {
|
pub struct CreateCommunity {
|
||||||
@ -118,33 +113,25 @@ pub struct CreateCommunity {
|
|||||||
/// A longer title.
|
/// A longer title.
|
||||||
pub title: String,
|
pub title: String,
|
||||||
/// A sidebar for the community in markdown.
|
/// A sidebar for the community in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// A shorter, one line description of your community.
|
/// A shorter, one line description of your community.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// An icon URL.
|
/// An icon URL.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub icon: Option<String>,
|
pub icon: Option<String>,
|
||||||
/// A banner URL.
|
/// A banner URL.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
/// Whether its an NSFW community.
|
/// Whether its an NSFW community.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
/// Whether to restrict posting only to moderators.
|
/// Whether to restrict posting only to moderators.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub posting_restricted_to_mods: Option<bool>,
|
pub posting_restricted_to_mods: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub visibility: Option<CommunityVisibility>,
|
pub visibility: Option<CommunityVisibility>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a tag for a community.
|
/// Create a tag for a community.
|
||||||
pub struct CreateCommunityTag {
|
pub struct CreateCommunityTag {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -153,8 +140,8 @@ pub struct CreateCommunityTag {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete your own community.
|
/// Delete your own community.
|
||||||
pub struct DeleteCommunity {
|
pub struct DeleteCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -163,35 +150,28 @@ pub struct DeleteCommunity {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edit a community.
|
/// Edit a community.
|
||||||
pub struct EditCommunity {
|
pub struct EditCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
/// A longer title.
|
/// A longer title.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
/// A sidebar for the community in markdown.
|
/// A sidebar for the community in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// A shorter, one line description of your community.
|
/// A shorter, one line description of your community.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// Whether its an NSFW community.
|
/// Whether its an NSFW community.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
/// Whether to restrict posting only to moderators.
|
/// Whether to restrict posting only to moderators.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub posting_restricted_to_mods: Option<bool>,
|
pub posting_restricted_to_mods: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub visibility: Option<CommunityVisibility>,
|
pub visibility: Option<CommunityVisibility>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Follow / subscribe to a community.
|
/// Follow / subscribe to a community.
|
||||||
pub struct FollowCommunity {
|
pub struct FollowCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -200,26 +180,23 @@ pub struct FollowCommunity {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
// TODO make this into a tagged enum
|
// TODO make this into a tagged enum
|
||||||
/// Get a community. Must provide either an id, or a name.
|
/// Get a community. Must provide either an id, or a name.
|
||||||
pub struct GetCommunity {
|
pub struct GetCommunity {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub id: Option<CommunityId>,
|
pub id: Option<CommunityId>,
|
||||||
/// Example: star_trek , or star_trek@xyz.tld
|
/// Example: star_trek , or star_trek@xyz.tld
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The community response.
|
/// The community response.
|
||||||
pub struct GetCommunityResponse {
|
pub struct GetCommunityResponse {
|
||||||
pub community_view: CommunityView,
|
pub community_view: CommunityView,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub site: Option<Site>,
|
pub site: Option<Site>,
|
||||||
pub moderators: Vec<CommunityModeratorView>,
|
pub moderators: Vec<CommunityModeratorView>,
|
||||||
pub discussion_languages: Vec<LanguageId>,
|
pub discussion_languages: Vec<LanguageId>,
|
||||||
@ -227,91 +204,77 @@ pub struct GetCommunityResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetches a random community
|
/// Fetches a random community
|
||||||
pub struct GetRandomCommunity {
|
pub struct GetRandomCommunity {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Hide a community from the main view.
|
/// Hide a community from the main view.
|
||||||
pub struct HideCommunity {
|
pub struct HideCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub hidden: bool,
|
pub hidden: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetches a list of communities.
|
/// Fetches a list of communities.
|
||||||
pub struct ListCommunities {
|
pub struct ListCommunities {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sort: Option<CommunitySortType>,
|
pub sort: Option<CommunitySortType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// Filter to within a given time range, in seconds.
|
/// Filter to within a given time range, in seconds.
|
||||||
/// IE 60 would give results for the past minute.
|
/// IE 60 would give results for the past minute.
|
||||||
pub time_range_seconds: Option<i32>,
|
pub time_range_seconds: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response for listing communities.
|
/// The response for listing communities.
|
||||||
pub struct ListCommunitiesResponse {
|
pub struct ListCommunitiesResponse {
|
||||||
pub communities: Vec<CommunityView>,
|
pub communities: Vec<CommunityView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Purges a community from the database. This will delete all content attached to that community.
|
/// Purges a community from the database. This will delete all content attached to that community.
|
||||||
pub struct PurgeCommunity {
|
pub struct PurgeCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Remove a community (only doable by moderators).
|
/// Remove a community (only doable by moderators).
|
||||||
pub struct RemoveCommunity {
|
pub struct RemoveCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Transfer a community to a new owner.
|
/// Transfer a community to a new owner.
|
||||||
pub struct TransferCommunity {
|
pub struct TransferCommunity {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -320,8 +283,8 @@ pub struct TransferCommunity {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Update a community tag.
|
/// Update a community tag.
|
||||||
pub struct UpdateCommunityTag {
|
pub struct UpdateCommunityTag {
|
||||||
pub tag_id: TagId,
|
pub tag_id: TagId,
|
||||||
@ -330,8 +293,8 @@ pub struct UpdateCommunityTag {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete a community tag.
|
/// Delete a community tag.
|
||||||
pub struct DeleteCommunityTag {
|
pub struct DeleteCommunityTag {
|
||||||
pub tag_id: TagId,
|
pub tag_id: TagId,
|
||||||
|
@ -9,7 +9,6 @@ use serde_with::skip_serializing_none;
|
|||||||
use {
|
use {
|
||||||
diesel::{Queryable, Selectable},
|
diesel::{Queryable, Selectable},
|
||||||
lemmy_db_schema::utils::queries::{community_post_tags_fragment, local_user_community_can_mod},
|
lemmy_db_schema::utils::queries::{community_post_tags_fragment, local_user_community_can_mod},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -18,18 +17,17 @@ pub mod impls;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A community view.
|
||||||
pub struct CommunityView {
|
pub struct CommunityView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -2,50 +2,41 @@ use crate::PendingFollow;
|
|||||||
use lemmy_db_schema::newtypes::{CommunityId, PaginationCursor};
|
use lemmy_db_schema::newtypes::{CommunityId, PaginationCursor};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct GetCommunityPendingFollowsCount {
|
pub struct GetCommunityPendingFollowsCount {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct GetCommunityPendingFollowsCountResponse {
|
pub struct GetCommunityPendingFollowsCountResponse {
|
||||||
pub count: i64,
|
pub count: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ListCommunityPendingFollows {
|
pub struct ListCommunityPendingFollows {
|
||||||
/// Only shows the unapproved applications
|
/// Only shows the unapproved applications
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub pending_only: Option<bool>,
|
pub pending_only: Option<bool>,
|
||||||
// Only for admins, show pending follows for communities which you dont moderate
|
// Only for admins, show pending follows for communities which you dont moderate
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub all_communities: Option<bool>,
|
pub all_communities: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ListCommunityPendingFollowsResponse {
|
pub struct ListCommunityPendingFollowsResponse {
|
||||||
pub items: Vec<PendingFollow>,
|
pub items: Vec<PendingFollow>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
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::source::{community::Community, person::Person};
|
||||||
use lemmy_db_schema_file::enums::CommunityFollowerState;
|
use lemmy_db_schema_file::enums::CommunityFollowerState;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use {
|
|
||||||
diesel::{Queryable, Selectable},
|
|
||||||
ts_rs::TS,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A community follower.
|
||||||
pub struct CommunityFollowerView {
|
pub struct CommunityFollowerView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -26,13 +24,13 @@ pub struct CommunityFollowerView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[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", 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 struct PendingFollow {
|
||||||
pub person: Person,
|
pub person: Person,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub is_new_instance: bool,
|
pub is_new_instance: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub follow_state: Option<CommunityFollowerState>,
|
pub follow_state: Option<CommunityFollowerState>,
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
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 lemmy_db_schema::source::{community::Community, person::Person};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use {
|
|
||||||
diesel::{Queryable, Selectable},
|
|
||||||
ts_rs::TS,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A community moderator.
|
||||||
pub struct CommunityModeratorView {
|
pub struct CommunityModeratorView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
|
@ -20,10 +20,10 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -2,47 +2,45 @@ use crate::CustomEmojiView;
|
|||||||
use lemmy_db_schema::newtypes::CustomEmojiId;
|
use lemmy_db_schema::newtypes::CustomEmojiId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a custom emoji.
|
/// Create a custom emoji.
|
||||||
pub struct CreateCustomEmoji {
|
pub struct CreateCustomEmoji {
|
||||||
pub category: String,
|
pub category: String,
|
||||||
pub shortcode: String,
|
pub shortcode: String,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||||
pub image_url: Url,
|
pub image_url: Url,
|
||||||
pub alt_text: String,
|
pub alt_text: String,
|
||||||
pub keywords: Vec<String>,
|
pub keywords: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response for a custom emoji.
|
/// A response for a custom emoji.
|
||||||
pub struct CustomEmojiResponse {
|
pub struct CustomEmojiResponse {
|
||||||
pub custom_emoji: CustomEmojiView,
|
pub custom_emoji: CustomEmojiView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete a custom emoji.
|
/// Delete a custom emoji.
|
||||||
pub struct DeleteCustomEmoji {
|
pub struct DeleteCustomEmoji {
|
||||||
pub id: CustomEmojiId,
|
pub id: CustomEmojiId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edit a custom emoji.
|
/// Edit a custom emoji.
|
||||||
pub struct EditCustomEmoji {
|
pub struct EditCustomEmoji {
|
||||||
pub id: CustomEmojiId,
|
pub id: CustomEmojiId,
|
||||||
pub category: String,
|
pub category: String,
|
||||||
#[cfg_attr(feature = "full", ts(type = "string"))]
|
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
|
||||||
pub image_url: Url,
|
pub image_url: Url,
|
||||||
pub alt_text: String,
|
pub alt_text: String,
|
||||||
pub keywords: Vec<String>,
|
pub keywords: Vec<String>,
|
||||||
@ -50,17 +48,16 @@ pub struct EditCustomEmoji {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetches a list of custom emojis.
|
/// Fetches a list of custom emojis.
|
||||||
pub struct ListCustomEmojis {
|
pub struct ListCustomEmojis {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub category: Option<String>,
|
pub category: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response for custom emojis.
|
/// A response for custom emojis.
|
||||||
pub struct ListCustomEmojisResponse {
|
pub struct ListCustomEmojisResponse {
|
||||||
pub custom_emojis: Vec<CustomEmojiView>,
|
pub custom_emojis: Vec<CustomEmojiView>,
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
|
#[cfg(feature = "full")]
|
||||||
|
use diesel::Queryable;
|
||||||
use lemmy_db_schema::source::{
|
use lemmy_db_schema::source::{
|
||||||
custom_emoji::CustomEmoji,
|
custom_emoji::CustomEmoji,
|
||||||
custom_emoji_keyword::CustomEmojiKeyword,
|
custom_emoji_keyword::CustomEmojiKeyword,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use {diesel::Queryable, ts_rs::TS};
|
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A custom emoji view.
|
||||||
pub struct CustomEmojiView {
|
pub struct CustomEmojiView {
|
||||||
pub custom_emoji: CustomEmoji,
|
pub custom_emoji: CustomEmoji,
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_views_private_message = { workspace = true }
|
lemmy_db_views_private_message = { workspace = true }
|
||||||
|
@ -5,28 +5,26 @@ use lemmy_db_schema::newtypes::{
|
|||||||
PrivateMessageId,
|
PrivateMessageId,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response containing a count of unread notifications.
|
/// A response containing a count of unread notifications.
|
||||||
pub struct GetUnreadCountResponse {
|
pub struct GetUnreadCountResponse {
|
||||||
pub count: i64,
|
pub count: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The count of unread registration applications.
|
/// The count of unread registration applications.
|
||||||
pub struct GetUnreadRegistrationApplicationCountResponse {
|
pub struct GetUnreadRegistrationApplicationCountResponse {
|
||||||
pub registration_applications: i64,
|
pub registration_applications: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Mark a comment reply as read.
|
/// Mark a comment reply as read.
|
||||||
pub struct MarkCommentReplyAsRead {
|
pub struct MarkCommentReplyAsRead {
|
||||||
pub comment_reply_id: CommentReplyId,
|
pub comment_reply_id: CommentReplyId,
|
||||||
@ -34,8 +32,8 @@ pub struct MarkCommentReplyAsRead {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Mark a person mention as read.
|
/// Mark a person mention as read.
|
||||||
pub struct MarkPersonCommentMentionAsRead {
|
pub struct MarkPersonCommentMentionAsRead {
|
||||||
pub person_comment_mention_id: PersonCommentMentionId,
|
pub person_comment_mention_id: PersonCommentMentionId,
|
||||||
@ -43,8 +41,8 @@ pub struct MarkPersonCommentMentionAsRead {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Mark a person mention as read.
|
/// Mark a person mention as read.
|
||||||
pub struct MarkPersonPostMentionAsRead {
|
pub struct MarkPersonPostMentionAsRead {
|
||||||
pub person_post_mention_id: PersonPostMentionId,
|
pub person_post_mention_id: PersonPostMentionId,
|
||||||
@ -52,8 +50,8 @@ pub struct MarkPersonPostMentionAsRead {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Mark a private message as read.
|
/// Mark a private message as read.
|
||||||
pub struct MarkPrivateMessageAsRead {
|
pub struct MarkPrivateMessageAsRead {
|
||||||
pub private_message_id: PrivateMessageId,
|
pub private_message_id: PrivateMessageId,
|
||||||
|
@ -38,7 +38,6 @@ use {
|
|||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
Person1AliasAllColumnsTuple,
|
Person1AliasAllColumnsTuple,
|
||||||
},
|
},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -129,8 +128,8 @@ pub struct InboxCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum InboxCombinedView {
|
pub enum InboxCombinedView {
|
||||||
@ -141,9 +140,10 @@ pub enum InboxCombinedView {
|
|||||||
}
|
}
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A person comment mention view.
|
||||||
pub struct PersonCommentMentionView {
|
pub struct PersonCommentMentionView {
|
||||||
pub person_comment_mention: PersonCommentMention,
|
pub person_comment_mention: PersonCommentMention,
|
||||||
@ -152,19 +152,12 @@ pub struct PersonCommentMentionView {
|
|||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_actions: Option<CommentActions>,
|
pub comment_actions: Option<CommentActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_community_actions: Option<CommunityActions>,
|
pub creator_community_actions: Option<CommunityActions>,
|
||||||
pub creator_is_admin: bool,
|
pub creator_is_admin: bool,
|
||||||
pub can_mod: bool,
|
pub can_mod: bool,
|
||||||
@ -173,9 +166,10 @@ pub struct PersonCommentMentionView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A person post mention view.
|
||||||
pub struct PersonPostMentionView {
|
pub struct PersonPostMentionView {
|
||||||
pub person_post_mention: PersonPostMention,
|
pub person_post_mention: PersonPostMention,
|
||||||
@ -183,21 +177,13 @@ pub struct PersonPostMentionView {
|
|||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub image_details: Option<ImageDetails>,
|
pub image_details: Option<ImageDetails>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_actions: Option<PostActions>,
|
pub post_actions: Option<PostActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_community_actions: Option<CommunityActions>,
|
pub creator_community_actions: Option<CommunityActions>,
|
||||||
pub post_tags: TagsView,
|
pub post_tags: TagsView,
|
||||||
pub creator_is_admin: bool,
|
pub creator_is_admin: bool,
|
||||||
@ -207,9 +193,10 @@ pub struct PersonPostMentionView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A comment reply view.
|
||||||
pub struct CommentReplyView {
|
pub struct CommentReplyView {
|
||||||
pub comment_reply: CommentReply,
|
pub comment_reply: CommentReply,
|
||||||
@ -218,20 +205,13 @@ pub struct CommentReplyView {
|
|||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_actions: Option<CommentActions>,
|
pub comment_actions: Option<CommentActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_community_actions: Option<CommunityActions>,
|
pub creator_community_actions: Option<CommunityActions>,
|
||||||
pub creator_is_admin: bool,
|
pub creator_is_admin: bool,
|
||||||
pub post_tags: TagsView,
|
pub post_tags: TagsView,
|
||||||
@ -241,31 +221,24 @@ pub struct CommentReplyView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get your inbox (replies, comment mentions, post mentions, and messages)
|
/// Get your inbox (replies, comment mentions, post mentions, and messages)
|
||||||
pub struct ListInbox {
|
pub struct ListInbox {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<InboxDataType>,
|
pub type_: Option<InboxDataType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub unread_only: Option<bool>,
|
pub unread_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get your inbox (replies, comment mentions, post mentions, and messages)
|
/// Get your inbox (replies, comment mentions, post mentions, and messages)
|
||||||
pub struct ListInboxResponse {
|
pub struct ListInboxResponse {
|
||||||
pub inbox: Vec<InboxCombinedView>,
|
pub inbox: Vec<InboxCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -2,70 +2,59 @@ use crate::LocalImageView;
|
|||||||
use lemmy_db_schema::newtypes::PaginationCursor;
|
use lemmy_db_schema::newtypes::PaginationCursor;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct DeleteImageParams {
|
pub struct DeleteImageParams {
|
||||||
pub filename: String,
|
pub filename: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ImageGetParams {
|
pub struct ImageGetParams {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub file_type: Option<String>,
|
pub file_type: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub max_size: Option<i32>,
|
pub max_size: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ImageProxyParams {
|
pub struct ImageProxyParams {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub file_type: Option<String>,
|
pub file_type: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub max_size: Option<i32>,
|
pub max_size: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get your user's image / media uploads.
|
/// Get your user's image / media uploads.
|
||||||
pub struct ListMedia {
|
pub struct ListMedia {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ListMediaResponse {
|
pub struct ListMediaResponse {
|
||||||
pub images: Vec<LocalImageView>,
|
pub images: Vec<LocalImageView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct UploadImageResponse {
|
pub struct UploadImageResponse {
|
||||||
pub image_url: Url,
|
pub image_url: Url,
|
||||||
pub filename: String,
|
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 lemmy_db_schema::source::{images::LocalImage, person::Person, post::Post};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use {
|
|
||||||
diesel::{Queryable, Selectable},
|
|
||||||
ts_rs::TS,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
@ -13,9 +10,10 @@ pub mod impls;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A local image view.
|
||||||
pub struct LocalImageView {
|
pub struct LocalImageView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -23,6 +21,5 @@ pub struct LocalImageView {
|
|||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
pub person: Person,
|
pub person: Person,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post: Option<Post>,
|
pub post: Option<Post>,
|
||||||
}
|
}
|
||||||
|
@ -20,12 +20,12 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -2,32 +2,24 @@ use crate::LocalUserView;
|
|||||||
use lemmy_db_schema::newtypes::PaginationCursor;
|
use lemmy_db_schema::newtypes::PaginationCursor;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct AdminListUsers {
|
pub struct AdminListUsers {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub banned_only: Option<bool>,
|
pub banned_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct AdminListUsersResponse {
|
pub struct AdminListUsersResponse {
|
||||||
pub users: Vec<LocalUserView>,
|
pub users: Vec<LocalUserView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ use {
|
|||||||
utils::queries::creator_home_instance_actions_select,
|
utils::queries::creator_home_instance_actions_select,
|
||||||
CreatorHomeInstanceActionsAllColumnsTuple,
|
CreatorHomeInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -15,9 +14,10 @@ pub mod api;
|
|||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A local user view.
|
||||||
pub struct LocalUserView {
|
pub struct LocalUserView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -27,6 +27,5 @@ pub struct LocalUserView {
|
|||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_home_instance_actions_select()))]
|
select_expression = creator_home_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -6,54 +6,40 @@ use lemmy_db_schema::{
|
|||||||
use lemmy_db_schema_file::enums::ListingType;
|
use lemmy_db_schema_file::enums::ListingType;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetches the modlog.
|
/// Fetches the modlog.
|
||||||
pub struct GetModlog {
|
pub struct GetModlog {
|
||||||
/// Filter by the moderator.
|
/// Filter by the moderator.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub mod_person_id: Option<PersonId>,
|
pub mod_person_id: Option<PersonId>,
|
||||||
/// Filter by the community.
|
/// Filter by the community.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
/// Filter by the modlog action type.
|
/// Filter by the modlog action type.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ModlogActionType>,
|
pub type_: Option<ModlogActionType>,
|
||||||
/// Filter by listing type. When not using All, it will remove the non-community modlog entries,
|
/// 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.
|
/// such as site bans, instance blocks, adding an admin, etc.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub listing_type: Option<ListingType>,
|
pub listing_type: Option<ListingType>,
|
||||||
/// Filter by the other / modded person.
|
/// Filter by the other / modded person.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub other_person_id: Option<PersonId>,
|
pub other_person_id: Option<PersonId>,
|
||||||
/// Filter by post. Will include comments of that post.
|
/// Filter by post. Will include comments of that post.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
/// Filter by comment.
|
/// Filter by comment.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The modlog fetch response.
|
/// The modlog fetch response.
|
||||||
pub struct GetModlogResponse {
|
pub struct GetModlogResponse {
|
||||||
pub modlog: Vec<ModlogCombinedView>,
|
pub modlog: Vec<ModlogCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ use serde_with::skip_serializing_none;
|
|||||||
use {
|
use {
|
||||||
diesel::{dsl::Nullable, NullableExpressionMethods, Queryable, Selectable},
|
diesel::{dsl::Nullable, NullableExpressionMethods, Queryable, Selectable},
|
||||||
lemmy_db_schema::{utils::queries::person1_select, Person1AliasAllColumnsTuple},
|
lemmy_db_schema::{utils::queries::person1_select, Person1AliasAllColumnsTuple},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -43,13 +42,13 @@ pub mod impls;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When someone is added as a community moderator.
|
||||||
pub struct ModAddCommunityView {
|
pub struct ModAddCommunityView {
|
||||||
pub mod_add_community: ModAddCommunity,
|
pub mod_add_community: ModAddCommunity,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
@ -57,26 +56,26 @@ pub struct ModAddCommunityView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When someone is added as a site moderator.
|
||||||
pub struct ModAddView {
|
pub struct ModAddView {
|
||||||
pub mod_add: ModAdd,
|
pub mod_add: ModAdd,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When someone is banned from a community.
|
||||||
pub struct ModBanFromCommunityView {
|
pub struct ModBanFromCommunityView {
|
||||||
pub mod_ban_from_community: ModBanFromCommunity,
|
pub mod_ban_from_community: ModBanFromCommunity,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
@ -84,39 +83,39 @@ pub struct ModBanFromCommunityView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When someone is banned from the site.
|
||||||
pub struct ModBanView {
|
pub struct ModBanView {
|
||||||
pub mod_ban: ModBan,
|
pub mod_ban: ModBan,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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
|
/// When the visibility of a community is changed
|
||||||
pub struct ModChangeCommunityVisibilityView {
|
pub struct ModChangeCommunityVisibilityView {
|
||||||
pub mod_change_community_visibility: ModChangeCommunityVisibility,
|
pub mod_change_community_visibility: ModChangeCommunityVisibility,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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).
|
/// When a moderator locks a post (prevents new comments being made).
|
||||||
pub struct ModLockPostView {
|
pub struct ModLockPostView {
|
||||||
pub mod_lock_post: ModLockPost,
|
pub mod_lock_post: ModLockPost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
@ -125,13 +124,13 @@ pub struct ModLockPostView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When a moderator removes a comment.
|
||||||
pub struct ModRemoveCommentView {
|
pub struct ModRemoveCommentView {
|
||||||
pub mod_remove_comment: ModRemoveComment,
|
pub mod_remove_comment: ModRemoveComment,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
pub comment: Comment,
|
pub comment: Comment,
|
||||||
@ -141,26 +140,26 @@ pub struct ModRemoveCommentView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When a moderator removes a community.
|
||||||
pub struct ModRemoveCommunityView {
|
pub struct ModRemoveCommunityView {
|
||||||
pub mod_remove_community: ModRemoveCommunity,
|
pub mod_remove_community: ModRemoveCommunity,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When a moderator removes a post.
|
||||||
pub struct ModRemovePostView {
|
pub struct ModRemovePostView {
|
||||||
pub mod_remove_post: ModRemovePost,
|
pub mod_remove_post: ModRemovePost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
@ -169,13 +168,13 @@ pub struct ModRemovePostView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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).
|
/// When a moderator features a post on a community (pins it to the top).
|
||||||
pub struct ModFeaturePostView {
|
pub struct ModFeaturePostView {
|
||||||
pub mod_feature_post: ModFeaturePost,
|
pub mod_feature_post: ModFeaturePost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
@ -184,13 +183,13 @@ pub struct ModFeaturePostView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When a moderator transfers a community to a new owner.
|
||||||
pub struct ModTransferCommunityView {
|
pub struct ModTransferCommunityView {
|
||||||
pub mod_transfer_community: ModTransferCommunity,
|
pub mod_transfer_community: ModTransferCommunity,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub moderator: Option<Person>,
|
pub moderator: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
pub other_person: Person,
|
pub other_person: Person,
|
||||||
@ -198,77 +197,77 @@ pub struct ModTransferCommunityView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When an admin purges a comment.
|
||||||
pub struct AdminPurgeCommentView {
|
pub struct AdminPurgeCommentView {
|
||||||
pub admin_purge_comment: AdminPurgeComment,
|
pub admin_purge_comment: AdminPurgeComment,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
pub post: Post,
|
pub post: Post,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When an admin purges a community.
|
||||||
pub struct AdminPurgeCommunityView {
|
pub struct AdminPurgeCommunityView {
|
||||||
pub admin_purge_community: AdminPurgeCommunity,
|
pub admin_purge_community: AdminPurgeCommunity,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When an admin purges a person.
|
||||||
pub struct AdminPurgePersonView {
|
pub struct AdminPurgePersonView {
|
||||||
pub admin_purge_person: AdminPurgePerson,
|
pub admin_purge_person: AdminPurgePerson,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When an admin purges a post.
|
||||||
pub struct AdminPurgePostView {
|
pub struct AdminPurgePostView {
|
||||||
pub admin_purge_post: AdminPurgePost,
|
pub admin_purge_post: AdminPurgePost,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When an admin purges a post.
|
||||||
pub struct AdminBlockInstanceView {
|
pub struct AdminBlockInstanceView {
|
||||||
pub admin_block_instance: AdminBlockInstance,
|
pub admin_block_instance: AdminBlockInstance,
|
||||||
pub instance: Instance,
|
pub instance: Instance,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// When an admin purges a post.
|
||||||
pub struct AdminAllowInstanceView {
|
pub struct AdminAllowInstanceView {
|
||||||
pub admin_allow_instance: AdminAllowInstance,
|
pub admin_allow_instance: AdminAllowInstance,
|
||||||
pub instance: Instance,
|
pub instance: Instance,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub admin: Option<Person>,
|
pub admin: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,8 +334,8 @@ pub(crate) struct ModlogCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum ModlogCombinedView {
|
pub enum ModlogCombinedView {
|
||||||
|
@ -20,12 +20,12 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_community_moderator/full",
|
"lemmy_db_views_community_moderator/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
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 lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Adds an admin to a site.
|
/// Adds an admin to a site.
|
||||||
pub struct AddAdmin {
|
pub struct AddAdmin {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
@ -16,8 +14,8 @@ pub struct AddAdmin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response of current admins.
|
/// The response of current admins.
|
||||||
pub struct AddAdminResponse {
|
pub struct AddAdminResponse {
|
||||||
pub admins: Vec<PersonView>,
|
pub admins: Vec<PersonView>,
|
||||||
@ -25,28 +23,25 @@ pub struct AddAdminResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Ban a person from the site.
|
/// Ban a person from the site.
|
||||||
pub struct BanPerson {
|
pub struct BanPerson {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
pub ban: bool,
|
pub ban: bool,
|
||||||
/// Optionally remove or restore all their data. Useful for new troll accounts.
|
/// 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.
|
/// 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>,
|
pub remove_or_restore_data: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
/// A time that the ban will expire, in unix epoch seconds.
|
/// A time that the ban will expire, in unix epoch seconds.
|
||||||
///
|
///
|
||||||
/// An i64 unix timestamp is used for a simpler API client implementation.
|
/// An i64 unix timestamp is used for a simpler API client implementation.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<i64>,
|
pub expires_at: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response for a banned person.
|
/// A response for a banned person.
|
||||||
pub struct BanPersonResponse {
|
pub struct BanPersonResponse {
|
||||||
pub person_view: PersonView,
|
pub person_view: PersonView,
|
||||||
@ -54,8 +49,8 @@ pub struct BanPersonResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Block a person.
|
/// Block a person.
|
||||||
pub struct BlockPerson {
|
pub struct BlockPerson {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
@ -63,8 +58,8 @@ pub struct BlockPerson {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response for a person block.
|
/// The response for a person block.
|
||||||
pub struct BlockPersonResponse {
|
pub struct BlockPersonResponse {
|
||||||
pub person_view: PersonView,
|
pub person_view: PersonView,
|
||||||
@ -73,38 +68,34 @@ pub struct BlockPersonResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets a person's details.
|
/// Gets a person's details.
|
||||||
///
|
///
|
||||||
/// Either person_id, or username are required.
|
/// Either person_id, or username are required.
|
||||||
pub struct GetPersonDetails {
|
pub struct GetPersonDetails {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_id: Option<PersonId>,
|
pub person_id: Option<PersonId>,
|
||||||
/// Example: dessalines , or dessalines@xyz.tld
|
/// Example: dessalines , or dessalines@xyz.tld
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A person's details response.
|
/// A person's details response.
|
||||||
pub struct GetPersonDetailsResponse {
|
pub struct GetPersonDetailsResponse {
|
||||||
pub person_view: PersonView,
|
pub person_view: PersonView,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub site: Option<Site>,
|
pub site: Option<Site>,
|
||||||
pub moderates: Vec<CommunityModeratorView>,
|
pub moderates: Vec<CommunityModeratorView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Purges a person from the database. This will delete all content attached to that person.
|
/// Purges a person from the database. This will delete all content attached to that person.
|
||||||
pub struct PurgePerson {
|
pub struct PurgePerson {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ use {
|
|||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
lemmy_db_schema_file::schema::local_user,
|
lemmy_db_schema_file::schema::local_user,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -27,9 +26,10 @@ pub mod api;
|
|||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A person view.
|
||||||
pub struct PersonView {
|
pub struct PersonView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -47,12 +47,10 @@ pub struct PersonView {
|
|||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_home_instance_actions_select()))]
|
select_expression = creator_home_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub home_instance_actions: Option<InstanceActions>,
|
pub home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_local_instance_actions_select()))]
|
select_expression = creator_local_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub local_instance_actions: Option<InstanceActions>,
|
pub local_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_views_post = { workspace = true }
|
lemmy_db_views_post = { workspace = true }
|
||||||
|
@ -34,7 +34,6 @@ use {
|
|||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
lemmy_db_views_local_user::LocalUserView,
|
lemmy_db_views_local_user::LocalUserView,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
@ -109,8 +108,8 @@ pub(crate) struct PersonContentCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum PersonContentCombinedView {
|
pub enum PersonContentCombinedView {
|
||||||
@ -120,37 +119,29 @@ pub enum PersonContentCombinedView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets a person's content (posts and comments)
|
/// Gets a person's content (posts and comments)
|
||||||
///
|
///
|
||||||
/// Either person_id, or username are required.
|
/// Either person_id, or username are required.
|
||||||
pub struct ListPersonContent {
|
pub struct ListPersonContent {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<PersonContentType>,
|
pub type_: Option<PersonContentType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_id: Option<PersonId>,
|
pub person_id: Option<PersonId>,
|
||||||
/// Example: dessalines , or dessalines@xyz.tld
|
/// Example: dessalines , or dessalines@xyz.tld
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A person's content response.
|
/// A person's content response.
|
||||||
pub struct ListPersonContentResponse {
|
pub struct ListPersonContentResponse {
|
||||||
pub content: Vec<PersonContentCombinedView>,
|
pub content: Vec<PersonContentCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_comment/full",
|
"lemmy_db_views_comment/full",
|
||||||
"lemmy_db_views_post/full",
|
"lemmy_db_views_post/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_views_post = { workspace = true }
|
lemmy_db_views_post = { workspace = true }
|
||||||
|
@ -35,7 +35,6 @@ use {
|
|||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
lemmy_db_views_local_user::LocalUserView,
|
lemmy_db_views_local_user::LocalUserView,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
@ -110,8 +109,8 @@ pub(crate) struct PersonLikedCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum PersonLikedCombinedView {
|
pub enum PersonLikedCombinedView {
|
||||||
@ -121,32 +120,25 @@ pub enum PersonLikedCombinedView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets your liked / disliked posts
|
/// Gets your liked / disliked posts
|
||||||
pub struct ListPersonLiked {
|
pub struct ListPersonLiked {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<PersonContentType>,
|
pub type_: Option<PersonContentType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub like_type: Option<LikeType>,
|
pub like_type: Option<LikeType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Your liked posts response.
|
/// Your liked posts response.
|
||||||
pub struct ListPersonLikedResponse {
|
pub struct ListPersonLikedResponse {
|
||||||
pub liked: Vec<PersonLikedCombinedView>,
|
pub liked: Vec<PersonLikedCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_post/full",
|
"lemmy_db_views_post/full",
|
||||||
"lemmy_db_views_comment/full",
|
"lemmy_db_views_comment/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_views_post = { workspace = true }
|
lemmy_db_views_post = { workspace = true }
|
||||||
|
@ -34,7 +34,6 @@ use {
|
|||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
lemmy_db_views_local_user::LocalUserView,
|
lemmy_db_views_local_user::LocalUserView,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
@ -109,8 +108,8 @@ pub(crate) struct PersonSavedCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum PersonSavedCombinedView {
|
pub enum PersonSavedCombinedView {
|
||||||
@ -120,30 +119,24 @@ pub enum PersonSavedCombinedView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets your saved posts and comments
|
/// Gets your saved posts and comments
|
||||||
pub struct ListPersonSaved {
|
pub struct ListPersonSaved {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<PersonContentType>,
|
pub type_: Option<PersonContentType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A person's saved content response.
|
/// A person's saved content response.
|
||||||
pub struct ListPersonSavedResponse {
|
pub struct ListPersonSavedResponse {
|
||||||
pub saved: Vec<PersonSavedCombinedView>,
|
pub saved: Vec<PersonSavedCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_community/full",
|
"lemmy_db_views_community/full",
|
||||||
"lemmy_db_views_vote/full",
|
"lemmy_db_views_vote/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -8,45 +8,34 @@ use lemmy_db_views_community::CommunityView;
|
|||||||
use lemmy_db_views_vote::VoteView;
|
use lemmy_db_views_vote::VoteView;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a post.
|
/// Create a post.
|
||||||
pub struct CreatePost {
|
pub struct CreatePost {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
/// An optional body for the post in markdown.
|
/// An optional body for the post in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
/// An optional alt_text, usable for image posts.
|
/// An optional alt_text, usable for image posts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub alt_text: Option<String>,
|
pub alt_text: Option<String>,
|
||||||
/// A honeypot to catch bots. Should be None.
|
/// A honeypot to catch bots. Should be None.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub honeypot: Option<String>,
|
pub honeypot: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
/// Instead of fetching a thumbnail, use a custom one.
|
/// Instead of fetching a thumbnail, use a custom one.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub custom_thumbnail: Option<String>,
|
pub custom_thumbnail: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub tags: Option<Vec<TagId>>,
|
pub tags: Option<Vec<TagId>>,
|
||||||
/// Time when this post should be scheduled. Null means publish immediately.
|
/// Time when this post should be scheduled. Null means publish immediately.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub scheduled_publish_time_at: Option<i64>,
|
pub scheduled_publish_time_at: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Like a post.
|
/// Like a post.
|
||||||
pub struct CreatePostLike {
|
pub struct CreatePostLike {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
@ -55,8 +44,8 @@ pub struct CreatePostLike {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete a post.
|
/// Delete a post.
|
||||||
pub struct DeletePost {
|
pub struct DeletePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
@ -65,38 +54,29 @@ pub struct DeletePost {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edit a post.
|
/// Edit a post.
|
||||||
pub struct EditPost {
|
pub struct EditPost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
/// An optional body for the post in markdown.
|
/// An optional body for the post in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub body: Option<String>,
|
pub body: Option<String>,
|
||||||
/// An optional alt_text, usable for image posts.
|
/// An optional alt_text, usable for image posts.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub alt_text: Option<String>,
|
pub alt_text: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub nsfw: Option<bool>,
|
pub nsfw: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub language_id: Option<LanguageId>,
|
pub language_id: Option<LanguageId>,
|
||||||
/// Instead of fetching a thumbnail, use a custom one.
|
/// Instead of fetching a thumbnail, use a custom one.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub custom_thumbnail: Option<String>,
|
pub custom_thumbnail: Option<String>,
|
||||||
/// Time when this post should be scheduled. Null means publish immediately.
|
/// Time when this post should be scheduled. Null means publish immediately.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub scheduled_publish_time_at: Option<i64>,
|
pub scheduled_publish_time_at: Option<i64>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub tags: Option<Vec<TagId>>,
|
pub tags: Option<Vec<TagId>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Feature a post (stickies / pins to the top).
|
/// Feature a post (stickies / pins to the top).
|
||||||
pub struct FeaturePost {
|
pub struct FeaturePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
@ -106,21 +86,19 @@ pub struct FeaturePost {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
// TODO this should be made into a tagged enum
|
// TODO this should be made into a tagged enum
|
||||||
/// Get a post. Needs either the post id, or comment_id.
|
/// Get a post. Needs either the post id, or comment_id.
|
||||||
pub struct GetPost {
|
pub struct GetPost {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub id: Option<PostId>,
|
pub id: Option<PostId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_id: Option<CommentId>,
|
pub comment_id: Option<CommentId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The post response.
|
/// The post response.
|
||||||
pub struct GetPostResponse {
|
pub struct GetPostResponse {
|
||||||
pub post_view: PostView,
|
pub post_view: PostView,
|
||||||
@ -131,73 +109,57 @@ pub struct GetPostResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get a list of posts.
|
/// Get a list of posts.
|
||||||
pub struct GetPosts {
|
pub struct GetPosts {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ListingType>,
|
pub type_: Option<ListingType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sort: Option<PostSortType>,
|
pub sort: Option<PostSortType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// Filter to within a given time range, in seconds.
|
/// Filter to within a given time range, in seconds.
|
||||||
/// IE 60 would give results for the past minute.
|
/// IE 60 would give results for the past minute.
|
||||||
/// Use Zero to override the local_site and local_user time_range.
|
/// Use Zero to override the local_site and local_user time_range.
|
||||||
pub time_range_seconds: Option<i32>,
|
pub time_range_seconds: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_name: Option<String>,
|
pub community_name: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_hidden: Option<bool>,
|
pub show_hidden: Option<bool>,
|
||||||
/// If true, then show the read posts (even if your user setting is to hide them)
|
/// 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>,
|
pub show_read: Option<bool>,
|
||||||
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
/// 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>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// If false, then show posts with media attached (even if your user setting is to hide them)
|
/// 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>,
|
pub hide_media: Option<bool>,
|
||||||
/// Whether to automatically mark fetched posts as read.
|
/// Whether to automatically mark fetched posts as read.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub mark_as_read: Option<bool>,
|
pub mark_as_read: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// If true, then only show posts with no comments
|
/// If true, then only show posts with no comments
|
||||||
pub no_comments_only: Option<bool>,
|
pub no_comments_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The post list response.
|
/// The post list response.
|
||||||
pub struct GetPostsResponse {
|
pub struct GetPostsResponse {
|
||||||
pub posts: Vec<PostView>,
|
pub posts: Vec<PostView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get metadata for a given site.
|
/// Get metadata for a given site.
|
||||||
pub struct GetSiteMetadata {
|
pub struct GetSiteMetadata {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The site metadata response.
|
/// The site metadata response.
|
||||||
pub struct GetSiteMetadataResponse {
|
pub struct GetSiteMetadataResponse {
|
||||||
pub metadata: LinkMetadata,
|
pub metadata: LinkMetadata,
|
||||||
@ -205,20 +167,19 @@ pub struct GetSiteMetadataResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Site metadata, from its opengraph tags.
|
/// Site metadata, from its opengraph tags.
|
||||||
pub struct LinkMetadata {
|
pub struct LinkMetadata {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub opengraph_data: OpenGraphData,
|
pub opengraph_data: OpenGraphData,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub content_type: Option<String>,
|
pub content_type: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Hide a post from list views
|
/// Hide a post from list views
|
||||||
pub struct HidePost {
|
pub struct HidePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
@ -227,47 +188,41 @@ pub struct HidePost {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// List post likes. Admins-only.
|
/// List post likes. Admins-only.
|
||||||
pub struct ListPostLikes {
|
pub struct ListPostLikes {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The post likes response
|
/// The post likes response
|
||||||
pub struct ListPostLikesResponse {
|
pub struct ListPostLikesResponse {
|
||||||
pub post_likes: Vec<VoteView>,
|
pub post_likes: Vec<VoteView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Lock a post (prevent new comments).
|
/// Lock a post (prevent new comments).
|
||||||
pub struct LockPost {
|
pub struct LockPost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Mark a post as read.
|
/// Mark a post as read.
|
||||||
pub struct MarkPostAsRead {
|
pub struct MarkPostAsRead {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
@ -276,53 +231,47 @@ pub struct MarkPostAsRead {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone, Default, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Site metadata, from its opengraph tags.
|
/// Site metadata, from its opengraph tags.
|
||||||
pub struct OpenGraphData {
|
pub struct OpenGraphData {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub image: Option<DbUrl>,
|
pub image: Option<DbUrl>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub embed_video_url: Option<DbUrl>,
|
pub embed_video_url: Option<DbUrl>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct PostResponse {
|
pub struct PostResponse {
|
||||||
pub post_view: PostView,
|
pub post_view: PostView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Purges a post from the database. This will delete all content attached to that post.
|
/// Purges a post from the database. This will delete all content attached to that post.
|
||||||
pub struct PurgePost {
|
pub struct PurgePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Remove a post (only doable by mods).
|
/// Remove a post (only doable by mods).
|
||||||
pub struct RemovePost {
|
pub struct RemovePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Save / bookmark a post.
|
/// Save / bookmark a post.
|
||||||
pub struct SavePost {
|
pub struct SavePost {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
@ -331,8 +280,8 @@ pub struct SavePost {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Mark several posts as read.
|
/// Mark several posts as read.
|
||||||
pub struct MarkManyPostsAsRead {
|
pub struct MarkManyPostsAsRead {
|
||||||
pub post_ids: Vec<PostId>,
|
pub post_ids: Vec<PostId>,
|
||||||
|
@ -25,7 +25,6 @@ use {
|
|||||||
CreatorHomeInstanceActionsAllColumnsTuple,
|
CreatorHomeInstanceActionsAllColumnsTuple,
|
||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -34,9 +33,9 @@ pub mod impls;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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 = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A post view.
|
/// A post view.
|
||||||
pub struct PostView {
|
pub struct PostView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -46,31 +45,23 @@ pub struct PostView {
|
|||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub image_details: Option<ImageDetails>,
|
pub image_details: Option<ImageDetails>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_actions: Option<PostActions>,
|
pub post_actions: Option<PostActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub instance_actions: Option<InstanceActions>,
|
pub instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorHomeInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_home_instance_actions_select()))]
|
select_expression = creator_home_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_home_instance_actions: Option<InstanceActions>,
|
pub creator_home_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(
|
#[cfg_attr(feature = "full", diesel(
|
||||||
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorLocalInstanceActionsAllColumnsTuple>,
|
||||||
select_expression = creator_local_instance_actions_select()))]
|
select_expression = creator_local_instance_actions_select()))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_local_instance_actions: Option<InstanceActions>,
|
pub creator_local_instance_actions: Option<InstanceActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
||||||
|
@ -20,10 +20,10 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
use crate::PrivateMessageView;
|
use crate::PrivateMessageView;
|
||||||
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId};
|
use lemmy_db_schema::newtypes::{PersonId, PrivateMessageId};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a private message.
|
/// Create a private message.
|
||||||
pub struct CreatePrivateMessage {
|
pub struct CreatePrivateMessage {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
@ -14,8 +12,8 @@ pub struct CreatePrivateMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete a private message.
|
/// Delete a private message.
|
||||||
pub struct DeletePrivateMessage {
|
pub struct DeletePrivateMessage {
|
||||||
pub private_message_id: PrivateMessageId,
|
pub private_message_id: PrivateMessageId,
|
||||||
@ -23,8 +21,8 @@ pub struct DeletePrivateMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edit a private message.
|
/// Edit a private message.
|
||||||
pub struct EditPrivateMessage {
|
pub struct EditPrivateMessage {
|
||||||
pub private_message_id: PrivateMessageId,
|
pub private_message_id: PrivateMessageId,
|
||||||
@ -32,8 +30,8 @@ pub struct EditPrivateMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A single private message response.
|
/// A single private message response.
|
||||||
pub struct PrivateMessageResponse {
|
pub struct PrivateMessageResponse {
|
||||||
pub private_message_view: PrivateMessageView,
|
pub private_message_view: PrivateMessageView,
|
||||||
|
@ -5,7 +5,6 @@ use {
|
|||||||
diesel::{Queryable, Selectable},
|
diesel::{Queryable, Selectable},
|
||||||
lemmy_db_schema::utils::queries::person1_select,
|
lemmy_db_schema::utils::queries::person1_select,
|
||||||
lemmy_db_schema::Person1AliasAllColumnsTuple,
|
lemmy_db_schema::Person1AliasAllColumnsTuple,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -13,9 +12,10 @@ pub mod api;
|
|||||||
pub mod impls;
|
pub mod impls;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A private message view.
|
||||||
pub struct PrivateMessageView {
|
pub struct PrivateMessageView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
|
@ -15,7 +15,8 @@ doctest = false
|
|||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[features]
|
[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]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -2,19 +2,16 @@ use chrono::{DateTime, Utc};
|
|||||||
use lemmy_db_schema::source::federation_queue_state::FederationQueueState;
|
use lemmy_db_schema::source::federation_queue_state::FederationQueueState;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
mod impls;
|
mod impls;
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct ReadableFederationState {
|
pub struct ReadableFederationState {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
internal_state: FederationQueueState,
|
internal_state: FederationQueueState,
|
||||||
/// timestamp of the next retry attempt (null if fail count is 0)
|
/// timestamp of the next retry attempt (null if fail count is 0)
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
next_retry: Option<DateTime<Utc>>,
|
next_retry: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -5,25 +5,22 @@ use lemmy_db_schema::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Approves a registration application.
|
/// Approves a registration application.
|
||||||
pub struct ApproveRegistrationApplication {
|
pub struct ApproveRegistrationApplication {
|
||||||
pub id: RegistrationApplicationId,
|
pub id: RegistrationApplicationId,
|
||||||
pub approve: bool,
|
pub approve: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub deny_reason: Option<String>,
|
pub deny_reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Gets a registration application for a person
|
/// Gets a registration application for a person
|
||||||
pub struct GetRegistrationApplication {
|
pub struct GetRegistrationApplication {
|
||||||
pub person_id: PersonId,
|
pub person_id: PersonId,
|
||||||
@ -31,65 +28,53 @@ pub struct GetRegistrationApplication {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetches a list of registration applications.
|
/// Fetches a list of registration applications.
|
||||||
pub struct ListRegistrationApplications {
|
pub struct ListRegistrationApplications {
|
||||||
/// Only shows the unread applications (IE those without an admin actor)
|
/// Only shows the unread applications (IE those without an admin actor)
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub unread_only: Option<bool>,
|
pub unread_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The list of registration applications.
|
/// The list of registration applications.
|
||||||
pub struct ListRegistrationApplicationsResponse {
|
pub struct ListRegistrationApplicationsResponse {
|
||||||
pub registration_applications: Vec<RegistrationApplicationView>,
|
pub registration_applications: Vec<RegistrationApplicationView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Register / Sign up to lemmy.
|
/// Register / Sign up to lemmy.
|
||||||
pub struct Register {
|
pub struct Register {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub password: SensitiveString,
|
pub password: SensitiveString,
|
||||||
pub password_verify: SensitiveString,
|
pub password_verify: SensitiveString,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// email is mandatory if email verification is enabled on the server
|
/// email is mandatory if email verification is enabled on the server
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub email: Option<SensitiveString>,
|
pub email: Option<SensitiveString>,
|
||||||
/// The UUID of the captcha item.
|
/// The UUID of the captcha item.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub captcha_uuid: Option<String>,
|
pub captcha_uuid: Option<String>,
|
||||||
/// Your captcha answer.
|
/// Your captcha answer.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub captcha_answer: Option<String>,
|
pub captcha_answer: Option<String>,
|
||||||
/// A form field to trick signup bots. Should be None.
|
/// A form field to trick signup bots. Should be None.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub honeypot: Option<String>,
|
pub honeypot: Option<String>,
|
||||||
/// An answer is mandatory if require application is enabled on the server
|
/// An answer is mandatory if require application is enabled on the server
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub answer: Option<String>,
|
pub answer: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response of an action done to a registration application.
|
/// The response of an action done to a registration application.
|
||||||
pub struct RegistrationApplicationResponse {
|
pub struct RegistrationApplicationResponse {
|
||||||
pub registration_application: RegistrationApplicationView,
|
pub registration_application: RegistrationApplicationView,
|
||||||
|
@ -9,7 +9,6 @@ use serde_with::skip_serializing_none;
|
|||||||
use {
|
use {
|
||||||
diesel::{helper_types::Nullable, NullableExpressionMethods, Queryable, Selectable},
|
diesel::{helper_types::Nullable, NullableExpressionMethods, Queryable, Selectable},
|
||||||
lemmy_db_schema::{utils::queries::person1_select, Person1AliasAllColumnsTuple},
|
lemmy_db_schema::{utils::queries::person1_select, Person1AliasAllColumnsTuple},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -18,9 +17,10 @@ pub mod impls;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A registration application view.
|
||||||
pub struct RegistrationApplicationView {
|
pub struct RegistrationApplicationView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -29,7 +29,6 @@ pub struct RegistrationApplicationView {
|
|||||||
pub creator_local_user: LocalUser,
|
pub creator_local_user: LocalUser,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<Person1AliasAllColumnsTuple>,
|
select_expression_type = Nullable<Person1AliasAllColumnsTuple>,
|
||||||
|
@ -20,11 +20,11 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_views_reports = { workspace = true }
|
lemmy_db_views_reports = { workspace = true }
|
||||||
|
@ -5,50 +5,37 @@ use lemmy_db_schema::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// List reports.
|
/// List reports.
|
||||||
pub struct ListReports {
|
pub struct ListReports {
|
||||||
/// Only shows the unresolved reports
|
/// Only shows the unresolved reports
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub unresolved_only: Option<bool>,
|
pub unresolved_only: Option<bool>,
|
||||||
/// Filter the type of report.
|
/// Filter the type of report.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<ReportType>,
|
pub type_: Option<ReportType>,
|
||||||
/// Filter by the post id. Can return either comment or post reports.
|
/// Filter by the post id. Can return either comment or post reports.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_id: Option<PostId>,
|
pub post_id: Option<PostId>,
|
||||||
/// if no community is given, it returns reports for all communities moderated by the auth user
|
/// 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>,
|
pub community_id: Option<CommunityId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
/// Only for admins: also show reports with `violates_instance_rules=false`
|
/// Only for admins: also show reports with `violates_instance_rules=false`
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_community_rule_violations: Option<bool>,
|
pub show_community_rule_violations: Option<bool>,
|
||||||
/// If true, view all your created reports. Works for non-admins/mods also.
|
/// 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>,
|
pub my_reports_only: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The post reports response.
|
/// The post reports response.
|
||||||
pub struct ListReportsResponse {
|
pub struct ListReportsResponse {
|
||||||
pub reports: Vec<ReportCombinedView>,
|
pub reports: Vec<ReportCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ use {
|
|||||||
Person2AliasAllColumnsTuple,
|
Person2AliasAllColumnsTuple,
|
||||||
},
|
},
|
||||||
lemmy_db_views_local_user::LocalUserView,
|
lemmy_db_views_local_user::LocalUserView,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -102,8 +101,8 @@ pub struct ReportCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum ReportCombinedView {
|
pub enum ReportCombinedView {
|
||||||
|
@ -20,10 +20,10 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -11,39 +11,36 @@ use lemmy_db_schema::newtypes::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The comment report response.
|
/// The comment report response.
|
||||||
pub struct CommentReportResponse {
|
pub struct CommentReportResponse {
|
||||||
pub comment_report_view: CommentReportView,
|
pub comment_report_view: CommentReportView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A community report response.
|
/// A community report response.
|
||||||
pub struct CommunityReportResponse {
|
pub struct CommunityReportResponse {
|
||||||
pub community_report_view: CommunityReportView,
|
pub community_report_view: CommunityReportView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Report a comment.
|
/// Report a comment.
|
||||||
pub struct CreateCommentReport {
|
pub struct CreateCommentReport {
|
||||||
pub comment_id: CommentId,
|
pub comment_id: CommentId,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub violates_instance_rules: Option<bool>,
|
pub violates_instance_rules: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a report for a community.
|
/// Create a report for a community.
|
||||||
pub struct CreateCommunityReport {
|
pub struct CreateCommunityReport {
|
||||||
pub community_id: CommunityId,
|
pub community_id: CommunityId,
|
||||||
@ -51,38 +48,36 @@ pub struct CreateCommunityReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a post report.
|
/// Create a post report.
|
||||||
pub struct CreatePostReport {
|
pub struct CreatePostReport {
|
||||||
pub post_id: PostId,
|
pub post_id: PostId,
|
||||||
pub reason: String,
|
pub reason: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub violates_instance_rules: Option<bool>,
|
pub violates_instance_rules: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Get a count of the number of reports.
|
/// Get a count of the number of reports.
|
||||||
pub struct GetReportCount {
|
pub struct GetReportCount {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response for the number of reports.
|
/// A response for the number of reports.
|
||||||
pub struct GetReportCountResponse {
|
pub struct GetReportCountResponse {
|
||||||
pub count: i64,
|
pub count: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Resolve a comment report (only doable by mods).
|
/// Resolve a comment report (only doable by mods).
|
||||||
pub struct ResolveCommentReport {
|
pub struct ResolveCommentReport {
|
||||||
pub report_id: CommentReportId,
|
pub report_id: CommentReportId,
|
||||||
@ -90,8 +85,8 @@ pub struct ResolveCommentReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Resolve a community report.
|
/// Resolve a community report.
|
||||||
pub struct ResolveCommunityReport {
|
pub struct ResolveCommunityReport {
|
||||||
pub report_id: CommunityReportId,
|
pub report_id: CommunityReportId,
|
||||||
@ -99,8 +94,8 @@ pub struct ResolveCommunityReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Resolve a post report (mods only).
|
/// Resolve a post report (mods only).
|
||||||
pub struct ResolvePostReport {
|
pub struct ResolvePostReport {
|
||||||
pub report_id: PostReportId,
|
pub report_id: PostReportId,
|
||||||
@ -108,8 +103,8 @@ pub struct ResolvePostReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Resolve a private message report.
|
/// Resolve a private message report.
|
||||||
pub struct ResolvePrivateMessageReport {
|
pub struct ResolvePrivateMessageReport {
|
||||||
pub report_id: PrivateMessageReportId,
|
pub report_id: PrivateMessageReportId,
|
||||||
@ -117,8 +112,8 @@ pub struct ResolvePrivateMessageReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create a report for a private message.
|
/// Create a report for a private message.
|
||||||
pub struct CreatePrivateMessageReport {
|
pub struct CreatePrivateMessageReport {
|
||||||
pub private_message_id: PrivateMessageId,
|
pub private_message_id: PrivateMessageId,
|
||||||
@ -126,16 +121,16 @@ pub struct CreatePrivateMessageReport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A private message report response.
|
/// A private message report response.
|
||||||
pub struct PrivateMessageReportResponse {
|
pub struct PrivateMessageReportResponse {
|
||||||
pub private_message_report_view: PrivateMessageReportView,
|
pub private_message_report_view: PrivateMessageReportView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The post report response.
|
/// The post report response.
|
||||||
pub struct PostReportResponse {
|
pub struct PostReportResponse {
|
||||||
pub post_report_view: PostReportView,
|
pub post_report_view: PostReportView,
|
||||||
|
@ -26,7 +26,6 @@ use {
|
|||||||
Person1AliasAllColumnsTuple,
|
Person1AliasAllColumnsTuple,
|
||||||
Person2AliasAllColumnsTuple,
|
Person2AliasAllColumnsTuple,
|
||||||
},
|
},
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
@ -44,9 +43,10 @@ pub mod private_message_report_view;
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A private message report view.
|
||||||
pub struct PrivateMessageReportView {
|
pub struct PrivateMessageReportView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -62,7 +62,6 @@ pub struct PrivateMessageReportView {
|
|||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
pub private_message_creator: Person,
|
pub private_message_creator: Person,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||||
@ -74,9 +73,10 @@ pub struct PrivateMessageReportView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A comment report view.
|
||||||
pub struct CommentReportView {
|
pub struct CommentReportView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -97,9 +97,7 @@ pub struct CommentReportView {
|
|||||||
)]
|
)]
|
||||||
pub comment_creator: Person,
|
pub comment_creator: Person,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_actions: Option<CommentActions>,
|
pub comment_actions: Option<CommentActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||||
@ -107,7 +105,6 @@ pub struct CommentReportView {
|
|||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
pub resolver: Option<Person>,
|
pub resolver: Option<Person>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
@ -117,10 +114,8 @@ pub struct CommentReportView {
|
|||||||
)]
|
)]
|
||||||
pub creator_community_actions: Option<CommunityActions>,
|
pub creator_community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
@ -132,9 +127,10 @@ pub struct CommentReportView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A community report view.
|
||||||
pub struct CommunityReportView {
|
pub struct CommunityReportView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -143,7 +139,6 @@ pub struct CommunityReportView {
|
|||||||
pub community: Community,
|
pub community: Community,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
pub creator: Person,
|
pub creator: Person,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||||
@ -152,11 +147,13 @@ pub struct CommunityReportView {
|
|||||||
)]
|
)]
|
||||||
pub resolver: Option<Person>,
|
pub resolver: Option<Person>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[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", 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.
|
/// A post report view.
|
||||||
pub struct PostReportView {
|
pub struct PostReportView {
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
@ -174,7 +171,6 @@ pub struct PostReportView {
|
|||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
pub post_creator: Person,
|
pub post_creator: Person,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
select_expression_type = Nullable<CreatorCommunityActionsAllColumnsTuple>,
|
||||||
@ -183,15 +179,11 @@ pub struct PostReportView {
|
|||||||
)]
|
)]
|
||||||
pub creator_community_actions: Option<CommunityActions>,
|
pub creator_community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_actions: Option<CommunityActions>,
|
pub community_actions: Option<CommunityActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_actions: Option<PostActions>,
|
pub post_actions: Option<PostActions>,
|
||||||
#[cfg_attr(feature = "full", diesel(embed))]
|
#[cfg_attr(feature = "full", diesel(embed))]
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub person_actions: Option<PersonActions>,
|
pub person_actions: Option<PersonActions>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full",
|
#[cfg_attr(feature = "full",
|
||||||
diesel(
|
diesel(
|
||||||
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
select_expression_type = Nullable<Person2AliasAllColumnsTuple>,
|
||||||
|
@ -20,7 +20,6 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"i-love-jesus",
|
"i-love-jesus",
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
@ -29,6 +28,7 @@ full = [
|
|||||||
"lemmy_db_views_community/full",
|
"lemmy_db_views_community/full",
|
||||||
"lemmy_db_views_person/full",
|
"lemmy_db_views_person/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_views_post = { workspace = true }
|
lemmy_db_views_post = { workspace = true }
|
||||||
|
@ -39,7 +39,6 @@ use {
|
|||||||
CreatorLocalInstanceActionsAllColumnsTuple,
|
CreatorLocalInstanceActionsAllColumnsTuple,
|
||||||
},
|
},
|
||||||
lemmy_db_views_local_user::LocalUserView,
|
lemmy_db_views_local_user::LocalUserView,
|
||||||
ts_rs::TS,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
@ -122,8 +121,8 @@ pub(crate) struct SearchCombinedViewInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
#[serde(tag = "type_")]
|
#[serde(tag = "type_")]
|
||||||
pub enum SearchCombinedView {
|
pub enum SearchCombinedView {
|
||||||
@ -135,55 +134,38 @@ pub enum SearchCombinedView {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Searches the site, given a search term, and some optional filters.
|
/// Searches the site, given a search term, and some optional filters.
|
||||||
pub struct Search {
|
pub struct Search {
|
||||||
pub q: String,
|
pub q: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_id: Option<CommunityId>,
|
pub community_id: Option<CommunityId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_name: Option<String>,
|
pub community_name: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub creator_id: Option<PersonId>,
|
pub creator_id: Option<PersonId>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub type_: Option<SearchType>,
|
pub type_: Option<SearchType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sort: Option<SearchSortType>,
|
pub sort: Option<SearchSortType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
/// Filter to within a given time range, in seconds.
|
/// Filter to within a given time range, in seconds.
|
||||||
/// IE 60 would give results for the past minute.
|
/// IE 60 would give results for the past minute.
|
||||||
pub time_range_seconds: Option<i32>,
|
pub time_range_seconds: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub listing_type: Option<ListingType>,
|
pub listing_type: Option<ListingType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub title_only: Option<bool>,
|
pub title_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_url_only: Option<bool>,
|
pub post_url_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub liked_only: Option<bool>,
|
pub liked_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub disliked_only: Option<bool>,
|
pub disliked_only: Option<bool>,
|
||||||
/// If true, then show the nsfw posts (even if your user setting is to hide them)
|
/// 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>,
|
pub show_nsfw: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The search response, containing lists of the return type possibilities
|
/// The search response, containing lists of the return type possibilities
|
||||||
pub struct SearchResponse {
|
pub struct SearchResponse {
|
||||||
pub results: Vec<SearchCombinedView>,
|
pub results: Vec<SearchCombinedView>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,13 @@ full = [
|
|||||||
"lemmy_utils",
|
"lemmy_utils",
|
||||||
"diesel",
|
"diesel",
|
||||||
"diesel-async",
|
"diesel-async",
|
||||||
"ts-rs",
|
|
||||||
"lemmy_db_schema/full",
|
"lemmy_db_schema/full",
|
||||||
"lemmy_db_schema_file/full",
|
"lemmy_db_schema_file/full",
|
||||||
"lemmy_db_views_api_misc/full",
|
"lemmy_db_views_api_misc/full",
|
||||||
"lemmy_db_views_person/full",
|
"lemmy_db_views_person/full",
|
||||||
"lemmy_db_views_readable_federation_state/full",
|
"lemmy_db_views_readable_federation_state/full",
|
||||||
]
|
]
|
||||||
|
ts-rs = ["dep:ts-rs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lemmy_db_schema = { workspace = true }
|
lemmy_db_schema = { workspace = true }
|
||||||
|
@ -18,62 +18,53 @@ use lemmy_db_schema_file::enums::{
|
|||||||
PostSortType,
|
PostSortType,
|
||||||
RegistrationMode,
|
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_person::PersonView;
|
||||||
use lemmy_db_views_readable_federation_state::ReadableFederationState;
|
use lemmy_db_views_readable_federation_state::ReadableFederationState;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
#[cfg(feature = "full")]
|
|
||||||
use ts_rs::TS;
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct AdminAllowInstanceParams {
|
pub struct AdminAllowInstanceParams {
|
||||||
pub instance: String,
|
pub instance: String,
|
||||||
pub allow: bool,
|
pub allow: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct AdminBlockInstanceParams {
|
pub struct AdminBlockInstanceParams {
|
||||||
pub instance: String,
|
pub instance: String,
|
||||||
pub block: bool,
|
pub block: bool,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reason: Option<String>,
|
pub reason: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub expires_at: Option<DateTime<Utc>>,
|
pub expires_at: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Logging in with an OAuth 2.0 authorization
|
/// Logging in with an OAuth 2.0 authorization
|
||||||
pub struct AuthenticateWithOauth {
|
pub struct AuthenticateWithOauth {
|
||||||
pub code: String,
|
pub code: String,
|
||||||
pub oauth_provider_id: OAuthProviderId,
|
pub oauth_provider_id: OAuthProviderId,
|
||||||
pub redirect_uri: Url,
|
pub redirect_uri: Url,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub show_nsfw: Option<bool>,
|
pub show_nsfw: Option<bool>,
|
||||||
/// Username is mandatory at registration time
|
/// Username is mandatory at registration time
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
/// An answer is mandatory if require application is enabled on the server
|
/// An answer is mandatory if require application is enabled on the server
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub answer: Option<String>,
|
pub answer: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub pkce_code_verifier: Option<String>,
|
pub pkce_code_verifier: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Create an external auth method.
|
/// Create an external auth method.
|
||||||
pub struct CreateOAuthProvider {
|
pub struct CreateOAuthProvider {
|
||||||
pub display_name: String,
|
pub display_name: String,
|
||||||
@ -85,119 +76,73 @@ pub struct CreateOAuthProvider {
|
|||||||
pub client_id: String,
|
pub client_id: String,
|
||||||
pub client_secret: String,
|
pub client_secret: String,
|
||||||
pub scopes: String,
|
pub scopes: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub auto_verify_email: Option<bool>,
|
pub auto_verify_email: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub account_linking_enabled: Option<bool>,
|
pub account_linking_enabled: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub use_pkce: Option<bool>,
|
pub use_pkce: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub enabled: Option<bool>,
|
pub enabled: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Creates a site. Should be done after first running lemmy.
|
/// Creates a site. Should be done after first running lemmy.
|
||||||
pub struct CreateSite {
|
pub struct CreateSite {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_creation_admin_only: Option<bool>,
|
pub community_creation_admin_only: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub require_email_verification: Option<bool>,
|
pub require_email_verification: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub application_question: Option<String>,
|
pub application_question: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub private_instance: Option<bool>,
|
pub private_instance: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_theme: Option<String>,
|
pub default_theme: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_listing_type: Option<ListingType>,
|
pub default_post_listing_type: Option<ListingType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_listing_mode: Option<PostListingMode>,
|
pub default_post_listing_mode: Option<PostListingMode>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_sort_type: Option<PostSortType>,
|
pub default_post_sort_type: Option<PostSortType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_time_range_seconds: Option<i32>,
|
pub default_post_time_range_seconds: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_comment_sort_type: Option<CommentSortType>,
|
pub default_comment_sort_type: Option<CommentSortType>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub legal_information: Option<String>,
|
pub legal_information: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub application_email_admins: Option<bool>,
|
pub application_email_admins: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub slur_filter_regex: Option<String>,
|
pub slur_filter_regex: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub actor_name_max_length: Option<i32>,
|
pub actor_name_max_length: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_message: Option<i32>,
|
pub rate_limit_message: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_message_per_second: Option<i32>,
|
pub rate_limit_message_per_second: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_post: Option<i32>,
|
pub rate_limit_post: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_post_per_second: Option<i32>,
|
pub rate_limit_post_per_second: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_register: Option<i32>,
|
pub rate_limit_register: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_register_per_second: Option<i32>,
|
pub rate_limit_register_per_second: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_image: Option<i32>,
|
pub rate_limit_image: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_image_per_second: Option<i32>,
|
pub rate_limit_image_per_second: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_comment: Option<i32>,
|
pub rate_limit_comment: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_comment_per_second: Option<i32>,
|
pub rate_limit_comment_per_second: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_search: Option<i32>,
|
pub rate_limit_search: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_search_per_second: Option<i32>,
|
pub rate_limit_search_per_second: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub federation_enabled: Option<bool>,
|
pub federation_enabled: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub captcha_enabled: Option<bool>,
|
pub captcha_enabled: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub captcha_difficulty: Option<String>,
|
pub captcha_difficulty: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub registration_mode: Option<RegistrationMode>,
|
pub registration_mode: Option<RegistrationMode>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub oauth_registration: Option<bool>,
|
pub oauth_registration: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub content_warning: Option<String>,
|
pub content_warning: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_upvotes: Option<FederationMode>,
|
pub post_upvotes: Option<FederationMode>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_downvotes: Option<FederationMode>,
|
pub post_downvotes: Option<FederationMode>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_upvotes: Option<FederationMode>,
|
pub comment_upvotes: Option<FederationMode>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_downvotes: Option<FederationMode>,
|
pub comment_downvotes: Option<FederationMode>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub disallow_nsfw_content: Option<bool>,
|
pub disallow_nsfw_content: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub disable_email_notifications: Option<bool>,
|
pub disable_email_notifications: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete an external auth method.
|
/// Delete an external auth method.
|
||||||
pub struct DeleteOAuthProvider {
|
pub struct DeleteOAuthProvider {
|
||||||
pub id: OAuthProviderId,
|
pub id: OAuthProviderId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Delete a tagline
|
/// Delete a tagline
|
||||||
pub struct DeleteTagline {
|
pub struct DeleteTagline {
|
||||||
pub id: TaglineId,
|
pub id: TaglineId,
|
||||||
@ -205,171 +150,116 @@ pub struct DeleteTagline {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edit an external auth method.
|
/// Edit an external auth method.
|
||||||
pub struct EditOAuthProvider {
|
pub struct EditOAuthProvider {
|
||||||
pub id: OAuthProviderId,
|
pub id: OAuthProviderId,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub authorization_endpoint: Option<String>,
|
pub authorization_endpoint: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub token_endpoint: Option<String>,
|
pub token_endpoint: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub userinfo_endpoint: Option<String>,
|
pub userinfo_endpoint: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub id_claim: Option<String>,
|
pub id_claim: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub client_secret: Option<String>,
|
pub client_secret: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub scopes: Option<String>,
|
pub scopes: Option<String>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub auto_verify_email: Option<bool>,
|
pub auto_verify_email: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub account_linking_enabled: Option<bool>,
|
pub account_linking_enabled: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub use_pkce: Option<bool>,
|
pub use_pkce: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub enabled: Option<bool>,
|
pub enabled: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Edits a site.
|
/// Edits a site.
|
||||||
pub struct EditSite {
|
pub struct EditSite {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
/// A sidebar for the site, in markdown.
|
/// A sidebar for the site, in markdown.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub sidebar: Option<String>,
|
pub sidebar: Option<String>,
|
||||||
/// A shorter, one line description of your site.
|
/// A shorter, one line description of your site.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
/// Limits community creation to admins only.
|
/// Limits community creation to admins only.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub community_creation_admin_only: Option<bool>,
|
pub community_creation_admin_only: Option<bool>,
|
||||||
/// Whether to require email verification.
|
/// Whether to require email verification.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub require_email_verification: Option<bool>,
|
pub require_email_verification: Option<bool>,
|
||||||
/// Your application question form. This is in markdown, and can be many questions.
|
/// Your application question form. This is in markdown, and can be many questions.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub application_question: Option<String>,
|
pub application_question: Option<String>,
|
||||||
/// Whether your instance is public, or private.
|
/// Whether your instance is public, or private.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub private_instance: Option<bool>,
|
pub private_instance: Option<bool>,
|
||||||
/// The default theme. Usually "browser"
|
/// The default theme. Usually "browser"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_theme: Option<String>,
|
pub default_theme: Option<String>,
|
||||||
/// The default post listing type, usually "local"
|
/// The default post listing type, usually "local"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_listing_type: Option<ListingType>,
|
pub default_post_listing_type: Option<ListingType>,
|
||||||
/// Default value for listing mode, usually "list"
|
/// Default value for listing mode, usually "list"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_listing_mode: Option<PostListingMode>,
|
pub default_post_listing_mode: Option<PostListingMode>,
|
||||||
/// The default post sort, usually "active"
|
/// The default post sort, usually "active"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_post_sort_type: Option<PostSortType>,
|
pub default_post_sort_type: Option<PostSortType>,
|
||||||
/// A default time range limit to apply to post sorts, in seconds. 0 means none.
|
/// 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>,
|
pub default_post_time_range_seconds: Option<i32>,
|
||||||
/// The default comment sort, usually "hot"
|
/// The default comment sort, usually "hot"
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub default_comment_sort_type: Option<CommentSortType>,
|
pub default_comment_sort_type: Option<CommentSortType>,
|
||||||
/// An optional page of legal information
|
/// An optional page of legal information
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub legal_information: Option<String>,
|
pub legal_information: Option<String>,
|
||||||
/// Whether to email admins when receiving a new application.
|
/// Whether to email admins when receiving a new application.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub application_email_admins: Option<bool>,
|
pub application_email_admins: Option<bool>,
|
||||||
/// A list of allowed discussion languages.
|
/// A list of allowed discussion languages.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||||
/// A regex string of items to filter.
|
/// A regex string of items to filter.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub slur_filter_regex: Option<String>,
|
pub slur_filter_regex: Option<String>,
|
||||||
/// The max length of actor names.
|
/// The max length of actor names.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub actor_name_max_length: Option<i32>,
|
pub actor_name_max_length: Option<i32>,
|
||||||
/// The number of messages allowed in a given time frame.
|
/// The number of messages allowed in a given time frame.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_message: Option<i32>,
|
pub rate_limit_message: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_message_per_second: Option<i32>,
|
pub rate_limit_message_per_second: Option<i32>,
|
||||||
/// The number of posts allowed in a given time frame.
|
/// The number of posts allowed in a given time frame.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_post: Option<i32>,
|
pub rate_limit_post: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_post_per_second: Option<i32>,
|
pub rate_limit_post_per_second: Option<i32>,
|
||||||
/// The number of registrations allowed in a given time frame.
|
/// The number of registrations allowed in a given time frame.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_register: Option<i32>,
|
pub rate_limit_register: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_register_per_second: Option<i32>,
|
pub rate_limit_register_per_second: Option<i32>,
|
||||||
/// The number of image uploads allowed in a given time frame.
|
/// The number of image uploads allowed in a given time frame.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_image: Option<i32>,
|
pub rate_limit_image: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_image_per_second: Option<i32>,
|
pub rate_limit_image_per_second: Option<i32>,
|
||||||
/// The number of comments allowed in a given time frame.
|
/// The number of comments allowed in a given time frame.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_comment: Option<i32>,
|
pub rate_limit_comment: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_comment_per_second: Option<i32>,
|
pub rate_limit_comment_per_second: Option<i32>,
|
||||||
/// The number of searches allowed in a given time frame.
|
/// The number of searches allowed in a given time frame.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_search: Option<i32>,
|
pub rate_limit_search: Option<i32>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub rate_limit_search_per_second: Option<i32>,
|
pub rate_limit_search_per_second: Option<i32>,
|
||||||
/// Whether to enable federation.
|
/// Whether to enable federation.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub federation_enabled: Option<bool>,
|
pub federation_enabled: Option<bool>,
|
||||||
/// Whether to enable captchas for signups.
|
/// Whether to enable captchas for signups.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub captcha_enabled: Option<bool>,
|
pub captcha_enabled: Option<bool>,
|
||||||
/// The captcha difficulty. Can be easy, medium, or hard
|
/// The captcha difficulty. Can be easy, medium, or hard
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub captcha_difficulty: Option<String>,
|
pub captcha_difficulty: Option<String>,
|
||||||
/// A list of blocked URLs
|
/// A list of blocked URLs
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub blocked_urls: Option<Vec<String>>,
|
pub blocked_urls: Option<Vec<String>>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub registration_mode: Option<RegistrationMode>,
|
pub registration_mode: Option<RegistrationMode>,
|
||||||
/// Whether to email admins for new reports.
|
/// Whether to email admins for new reports.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub reports_email_admins: Option<bool>,
|
pub reports_email_admins: Option<bool>,
|
||||||
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
/// If present, nsfw content is visible by default. Should be displayed by frontends/clients
|
||||||
/// when the site is first opened by a user.
|
/// when the site is first opened by a user.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub content_warning: Option<String>,
|
pub content_warning: Option<String>,
|
||||||
/// Whether or not external auth methods can auto-register users.
|
/// Whether or not external auth methods can auto-register users.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub oauth_registration: Option<bool>,
|
pub oauth_registration: Option<bool>,
|
||||||
/// What kind of post upvotes your site allows.
|
/// What kind of post upvotes your site allows.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_upvotes: Option<FederationMode>,
|
pub post_upvotes: Option<FederationMode>,
|
||||||
/// What kind of post downvotes your site allows.
|
/// What kind of post downvotes your site allows.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub post_downvotes: Option<FederationMode>,
|
pub post_downvotes: Option<FederationMode>,
|
||||||
/// What kind of comment upvotes your site allows.
|
/// What kind of comment upvotes your site allows.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_upvotes: Option<FederationMode>,
|
pub comment_upvotes: Option<FederationMode>,
|
||||||
/// What kind of comment downvotes your site allows.
|
/// What kind of comment downvotes your site allows.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub comment_downvotes: Option<FederationMode>,
|
pub comment_downvotes: Option<FederationMode>,
|
||||||
/// Block NSFW content being created
|
/// Block NSFW content being created
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub disallow_nsfw_content: Option<bool>,
|
pub disallow_nsfw_content: Option<bool>,
|
||||||
/// Dont send email notifications to users for new replies, mentions etc
|
/// Dont send email notifications to users for new replies, mentions etc
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub disable_email_notifications: Option<bool>,
|
pub disable_email_notifications: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A list of federated instances.
|
/// A list of federated instances.
|
||||||
pub struct FederatedInstances {
|
pub struct FederatedInstances {
|
||||||
pub linked: Vec<InstanceWithFederationState>,
|
pub linked: Vec<InstanceWithFederationState>,
|
||||||
@ -379,30 +269,26 @@ pub struct FederatedInstances {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response of federated instances.
|
/// A response of federated instances.
|
||||||
pub struct GetFederatedInstancesResponse {
|
pub struct GetFederatedInstancesResponse {
|
||||||
/// Optional, because federation may be disabled.
|
/// Optional, because federation may be disabled.
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub federated_instances: Option<FederatedInstances>,
|
pub federated_instances: Option<FederatedInstances>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// An expanded response for a site.
|
/// An expanded response for a site.
|
||||||
pub struct GetSiteResponse {
|
pub struct GetSiteResponse {
|
||||||
pub site_view: SiteView,
|
pub site_view: SiteView,
|
||||||
pub admins: Vec<PersonView>,
|
pub admins: Vec<PersonView>,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
#[cfg_attr(feature = "full", ts(skip))]
|
|
||||||
pub my_user: Option<MyUserInfo>,
|
|
||||||
pub all_languages: Vec<Language>,
|
pub all_languages: Vec<Language>,
|
||||||
pub discussion_languages: Vec<LanguageId>,
|
pub discussion_languages: Vec<LanguageId>,
|
||||||
/// If the site has any taglines, a random one is included here for displaying
|
/// If the site has any taglines, a random one is included here for displaying
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub tagline: Option<Tagline>,
|
pub tagline: Option<Tagline>,
|
||||||
/// A list of external auth methods your site supports.
|
/// A list of external auth methods your site supports.
|
||||||
pub oauth_providers: Vec<PublicOAuthProvider>,
|
pub oauth_providers: Vec<PublicOAuthProvider>,
|
||||||
@ -416,62 +302,56 @@ pub struct GetSiteResponse {
|
|||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct InstanceWithFederationState {
|
pub struct InstanceWithFederationState {
|
||||||
#[serde(flatten)]
|
#[serde(flatten)]
|
||||||
pub instance: Instance,
|
pub instance: Instance,
|
||||||
/// if federation to this instance is or was active, show state of outgoing federation to this
|
/// if federation to this instance is or was active, show state of outgoing federation to this
|
||||||
/// instance
|
/// instance
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub federation_state: Option<ReadableFederationState>,
|
pub federation_state: Option<ReadableFederationState>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[skip_serializing_none]
|
#[skip_serializing_none]
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Fetches a list of taglines.
|
/// Fetches a list of taglines.
|
||||||
pub struct ListTaglines {
|
pub struct ListTaglines {
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_cursor: Option<PaginationCursor>,
|
pub page_cursor: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub page_back: Option<bool>,
|
pub page_back: Option<bool>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// A response for taglines.
|
/// A response for taglines.
|
||||||
pub struct ListTaglinesResponse {
|
pub struct ListTaglinesResponse {
|
||||||
pub taglines: Vec<Tagline>,
|
pub taglines: Vec<Tagline>,
|
||||||
/// the pagination cursor to use to fetch the next page
|
/// the pagination cursor to use to fetch the next page
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub next_page: Option<PaginationCursor>,
|
pub next_page: Option<PaginationCursor>,
|
||||||
#[cfg_attr(feature = "full", ts(optional))]
|
|
||||||
pub prev_page: Option<PaginationCursor>,
|
pub prev_page: Option<PaginationCursor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// The response for a site.
|
/// The response for a site.
|
||||||
pub struct SiteResponse {
|
pub struct SiteResponse {
|
||||||
pub site_view: SiteView,
|
pub site_view: SiteView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
pub struct TaglineResponse {
|
pub struct TaglineResponse {
|
||||||
pub tagline: Tagline,
|
pub tagline: Tagline,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||||
/// Update a tagline
|
/// Update a tagline
|
||||||
pub struct UpdateTagline {
|
pub struct UpdateTagline {
|
||||||
pub id: TaglineId,
|
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