2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_schema::{
|
|
|
|
aggregates::structs::{CommentAggregates, PersonAggregates, PostAggregates, SiteAggregates},
|
|
|
|
source::{
|
|
|
|
comment::Comment,
|
|
|
|
comment_report::CommentReport,
|
|
|
|
community::CommunitySafe,
|
2022-10-27 09:24:07 +00:00
|
|
|
local_site::LocalSite,
|
|
|
|
local_site_rate_limit::LocalSiteRateLimit,
|
2022-05-03 17:44:13 +00:00
|
|
|
local_user::{LocalUser, LocalUserSettings},
|
2022-09-26 14:09:32 +00:00
|
|
|
person::{Person, PersonSafe},
|
2022-05-03 17:44:13 +00:00
|
|
|
post::Post,
|
|
|
|
post_report::PostReport,
|
|
|
|
private_message::PrivateMessage,
|
2022-09-19 22:58:42 +00:00
|
|
|
private_message_report::PrivateMessageReport,
|
2022-05-03 17:44:13 +00:00
|
|
|
registration_application::RegistrationApplication,
|
|
|
|
site::Site,
|
|
|
|
},
|
2022-06-22 12:05:41 +00:00
|
|
|
SubscribedType,
|
2022-05-03 17:44:13 +00:00
|
|
|
};
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct CommentReportView {
|
|
|
|
pub comment_report: CommentReport,
|
|
|
|
pub comment: Comment,
|
|
|
|
pub post: Post,
|
|
|
|
pub community: CommunitySafe,
|
|
|
|
pub creator: PersonSafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub comment_creator: PersonSafe,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub counts: CommentAggregates,
|
|
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
|
|
|
pub my_vote: Option<i16>, // Left join to CommentLike
|
2022-09-26 14:09:32 +00:00
|
|
|
pub resolver: Option<PersonSafe>,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct CommentView {
|
|
|
|
pub comment: Comment,
|
|
|
|
pub creator: PersonSafe,
|
|
|
|
pub post: Post,
|
|
|
|
pub community: CommunitySafe,
|
|
|
|
pub counts: CommentAggregates,
|
|
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
2022-06-22 12:05:41 +00:00
|
|
|
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
2022-05-03 17:44:13 +00:00
|
|
|
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)]
|
|
|
|
pub struct LocalUserView {
|
|
|
|
pub local_user: LocalUser,
|
|
|
|
pub person: Person,
|
|
|
|
pub counts: PersonAggregates,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct LocalUserSettingsView {
|
|
|
|
pub local_user: LocalUserSettings,
|
|
|
|
pub person: PersonSafe,
|
|
|
|
pub counts: PersonAggregates,
|
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct PostReportView {
|
|
|
|
pub post_report: PostReport,
|
|
|
|
pub post: Post,
|
|
|
|
pub community: CommunitySafe,
|
|
|
|
pub creator: PersonSafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub post_creator: PersonSafe,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub creator_banned_from_community: bool,
|
|
|
|
pub my_vote: Option<i16>,
|
|
|
|
pub counts: PostAggregates,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub resolver: Option<PersonSafe>,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct PostView {
|
|
|
|
pub post: Post,
|
|
|
|
pub creator: PersonSafe,
|
|
|
|
pub community: CommunitySafe,
|
|
|
|
pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
|
|
|
|
pub counts: PostAggregates,
|
2022-06-22 12:05:41 +00:00
|
|
|
pub subscribed: SubscribedType, // Left join to CommunityFollower
|
|
|
|
pub saved: bool, // Left join to PostSaved
|
|
|
|
pub read: bool, // Left join to PostRead
|
|
|
|
pub creator_blocked: bool, // Left join to PersonBlock
|
|
|
|
pub my_vote: Option<i16>, // Left join to PostLike
|
2022-09-27 16:45:46 +00:00
|
|
|
pub unread_comments: i64, // Left join to PersonPostAggregates
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct PrivateMessageView {
|
|
|
|
pub private_message: PrivateMessage,
|
|
|
|
pub creator: PersonSafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub recipient: PersonSafe,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-09-19 22:58:42 +00:00
|
|
|
pub struct PrivateMessageReportView {
|
|
|
|
pub private_message_report: PrivateMessageReport,
|
|
|
|
pub private_message: PrivateMessage,
|
|
|
|
pub private_message_creator: PersonSafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub creator: PersonSafe,
|
|
|
|
pub resolver: Option<PersonSafe>,
|
2022-09-19 22:58:42 +00:00
|
|
|
}
|
|
|
|
|
2022-09-26 14:09:32 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct RegistrationApplicationView {
|
|
|
|
pub registration_application: RegistrationApplication,
|
|
|
|
pub creator_local_user: LocalUserSettings,
|
|
|
|
pub creator: PersonSafe,
|
2022-09-26 14:09:32 +00:00
|
|
|
pub admin: Option<PersonSafe>,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
pub struct SiteView {
|
|
|
|
pub site: Site,
|
2022-10-27 09:24:07 +00:00
|
|
|
pub local_site: LocalSite,
|
|
|
|
pub local_site_rate_limit: LocalSiteRateLimit,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub counts: SiteAggregates,
|
|
|
|
}
|