]> Untitled Git - lemmy.git/blobdiff - crates/db_views/src/structs.rs
Implement reports for private messages (#2433)
[lemmy.git] / crates / db_views / src / structs.rs
index b92bb271481a086285a7f36e120d8985f1b63927..1d509a1399fb7c6bb042fa92c25055e4f84758a6 100644 (file)
@@ -4,11 +4,13 @@ use lemmy_db_schema::{
     comment::Comment,
     comment_report::CommentReport,
     community::CommunitySafe,
+    language::Language,
     local_user::{LocalUser, LocalUserSettings},
     person::{Person, PersonSafe, PersonSafeAlias1, PersonSafeAlias2},
     post::Post,
     post_report::PostReport,
     private_message::PrivateMessage,
+    private_message_report::PrivateMessageReport,
     registration_application::RegistrationApplication,
     site::Site,
   },
@@ -34,7 +36,6 @@ pub struct CommentReportView {
 pub struct CommentView {
   pub comment: Comment,
   pub creator: PersonSafe,
-  pub recipient: Option<PersonSafeAlias1>, // Left joins to comment and person
   pub post: Post,
   pub community: CommunitySafe,
   pub counts: CommentAggregates,
@@ -84,6 +85,7 @@ pub struct PostView {
   pub read: bool,                 // Left join to PostRead
   pub creator_blocked: bool,      // Left join to PersonBlock
   pub my_vote: Option<i16>,       // Left join to PostLike
+  pub language: Language,
 }
 
 #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
@@ -93,6 +95,15 @@ pub struct PrivateMessageView {
   pub recipient: PersonSafeAlias1,
 }
 
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
+pub struct PrivateMessageReportView {
+  pub private_message_report: PrivateMessageReport,
+  pub private_message: PrivateMessage,
+  pub private_message_creator: PersonSafe,
+  pub creator: PersonSafeAlias1,
+  pub resolver: Option<PersonSafeAlias2>,
+}
+
 #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
 pub struct RegistrationApplicationView {
   pub registration_application: RegistrationApplication,
@@ -106,3 +117,9 @@ pub struct SiteView {
   pub site: Site,
   pub counts: SiteAggregates,
 }
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct LocalUserDiscussionLanguageView {
+  pub local_user: LocalUserSettings,
+  pub language: Language,
+}