2022-05-03 17:44:13 +00:00
|
|
|
use lemmy_db_schema::{
|
|
|
|
aggregates::structs::{CommentAggregates, PersonAggregates, PostAggregates, SiteAggregates},
|
|
|
|
source::{
|
|
|
|
comment::Comment,
|
|
|
|
comment_report::CommentReport,
|
2023-03-01 17:19:46 +00:00
|
|
|
community::Community,
|
2022-10-27 09:24:07 +00:00
|
|
|
local_site::LocalSite,
|
|
|
|
local_site_rate_limit::LocalSiteRateLimit,
|
2023-03-01 17:19:46 +00:00
|
|
|
local_user::LocalUser,
|
|
|
|
person::Person,
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
|
|
|
pub creator: Person,
|
|
|
|
pub comment_creator: Person,
|
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
|
2023-03-01 17:19:46 +00:00
|
|
|
pub resolver: Option<Person>,
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub creator: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub post: Post,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
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,
|
|
|
|
}
|
|
|
|
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
|
|
|
pub creator: Person,
|
|
|
|
pub post_creator: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub creator_banned_from_community: bool,
|
|
|
|
pub my_vote: Option<i16>,
|
|
|
|
pub counts: PostAggregates,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub resolver: Option<Person>,
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub creator: Person,
|
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub creator: Person,
|
|
|
|
pub recipient: Person,
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub private_message_creator: Person,
|
|
|
|
pub creator: Person,
|
|
|
|
pub resolver: Option<Person>,
|
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,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub creator_local_user: LocalUser,
|
|
|
|
pub creator: Person,
|
|
|
|
pub admin: Option<Person>,
|
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,
|
|
|
|
}
|