mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-15 08:54:01 +00:00
15930cbf4d
* Update utils.rs * Update traits.rs * Update comment_report_view.rs * Update comment_view.rs * Update local_user_view.rs * Update post_report_view.rs * Update post_view.rs * Update private_message_report_view.rs * Update private_message_view.rs * Update registration_application_view.rs * Update site_view.rs * Update structs.rs * Update comment_reply_view.rs * Update community_block_view.rs * Update community_follower_view.rs * Update community_moderator_view.rs * Update community_person_ban_view.rs * Update community_person_ban_view.rs * Update community_view.rs * Update person_block_view.rs * Update person_mention_view.rs * Update person_view.rs * Update structs.rs * Update admin_purge_comment_view.rs * Update admin_purge_community_view.rs * Update admin_purge_person_view.rs * Update admin_purge_post_view.rs * Update mod_add_community_view.rs * Update mod_add_view.rs * Update mod_ban_from_community_view.rs * Update mod_ban_view.rs * Update mod_feature_post_view.rs * Update mod_hide_community_view.rs * Update mod_lock_post_view.rs * Update mod_remove_comment_view.rs * Update mod_remove_community_view.rs * Update mod_remove_post_view.rs * Update mod_transfer_community_view.rs * Update structs.rs * Update utils.rs * Update private_message_view.rs * Update comment_report_view.rs * Update registration_application_view.rs * Update utils.rs * fix * fix db_views * fix * Update comment_view.rs
122 lines
3.5 KiB
Rust
122 lines
3.5 KiB
Rust
#[cfg(feature = "full")]
|
|
use diesel::Queryable;
|
|
use lemmy_db_schema::{
|
|
aggregates::structs::{CommentAggregates, CommunityAggregates, PersonAggregates},
|
|
source::{
|
|
comment::Comment,
|
|
comment_reply::CommentReply,
|
|
community::Community,
|
|
person::Person,
|
|
person_mention::PersonMention,
|
|
post::Post,
|
|
},
|
|
SubscribedType,
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
use serde_with::skip_serializing_none;
|
|
#[cfg(feature = "full")]
|
|
use ts_rs::TS;
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A community block.
|
|
pub struct CommunityBlockView {
|
|
pub person: Person,
|
|
pub community: Community,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A community follower.
|
|
pub struct CommunityFollowerView {
|
|
pub community: Community,
|
|
pub follower: Person,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A community moderator.
|
|
pub struct CommunityModeratorView {
|
|
pub community: Community,
|
|
pub moderator: Person,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(Queryable))]
|
|
/// A community person ban.
|
|
pub struct CommunityPersonBanView {
|
|
pub community: Community,
|
|
pub person: Person,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A community view.
|
|
pub struct CommunityView {
|
|
pub community: Community,
|
|
pub subscribed: SubscribedType,
|
|
pub blocked: bool,
|
|
pub counts: CommunityAggregates,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A person block.
|
|
pub struct PersonBlockView {
|
|
pub person: Person,
|
|
pub target: Person,
|
|
}
|
|
|
|
#[skip_serializing_none]
|
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A person mention view.
|
|
pub struct PersonMentionView {
|
|
pub person_mention: PersonMention,
|
|
pub comment: Comment,
|
|
pub creator: Person,
|
|
pub post: Post,
|
|
pub community: Community,
|
|
pub recipient: Person,
|
|
pub counts: CommentAggregates,
|
|
pub creator_banned_from_community: bool,
|
|
pub subscribed: SubscribedType,
|
|
pub saved: bool,
|
|
pub creator_blocked: bool,
|
|
pub my_vote: Option<i16>,
|
|
}
|
|
|
|
#[skip_serializing_none]
|
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A comment reply view.
|
|
pub struct CommentReplyView {
|
|
pub comment_reply: CommentReply,
|
|
pub comment: Comment,
|
|
pub creator: Person,
|
|
pub post: Post,
|
|
pub community: Community,
|
|
pub recipient: Person,
|
|
pub counts: CommentAggregates,
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
|
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
|
pub saved: bool, // Left join to CommentSaved
|
|
pub creator_blocked: bool, // Left join to PersonBlock
|
|
pub my_vote: Option<i16>, // Left join to CommentLike
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
/// A person view.
|
|
pub struct PersonView {
|
|
pub person: Person,
|
|
pub counts: PersonAggregates,
|
|
}
|