]> Untitled Git - lemmy.git/blobdiff - crates/db_schema/src/source/activity.rs
Split activity table into sent and received parts (fixes #3103) (#3583)
[lemmy.git] / crates / db_schema / src / source / activity.rs
index c5ac833ed2aa109cb9a93d8091df998e1731b1f4..85b193f51f525fcbab2df076eca8be2c87f225cc 100644 (file)
@@ -1,25 +1,28 @@
-use crate::{newtypes::DbUrl, schema::activity};
+use crate::{newtypes::DbUrl, schema::sent_activity};
 use serde_json::Value;
 use std::fmt::Debug;
 
-#[derive(Queryable, Identifiable, PartialEq, Debug)]
-#[table_name = "activity"]
-pub struct Activity {
-  pub id: i32,
+#[derive(PartialEq, Eq, Debug, Queryable)]
+#[diesel(table_name = sent_activity)]
+pub struct SentActivity {
+  pub id: i64,
+  pub ap_id: DbUrl,
   pub data: Value,
-  pub local: bool,
+  pub sensitive: bool,
   pub published: chrono::NaiveDateTime,
-  pub updated: Option<chrono::NaiveDateTime>,
-  pub ap_id: Option<DbUrl>,
-  pub sensitive: Option<bool>,
 }
-
-#[derive(Insertable, AsChangeset)]
-#[table_name = "activity"]
-pub struct ActivityForm {
-  pub data: Value,
-  pub local: Option<bool>,
-  pub updated: Option<chrono::NaiveDateTime>,
+#[derive(Insertable)]
+#[diesel(table_name = sent_activity)]
+pub struct SentActivityForm {
   pub ap_id: DbUrl,
+  pub data: Value,
   pub sensitive: bool,
 }
+
+#[derive(PartialEq, Eq, Debug, Queryable)]
+#[diesel(table_name = received_activity)]
+pub struct ReceivedActivity {
+  pub id: i64,
+  pub ap_id: DbUrl,
+  pub published: chrono::NaiveDateTime,
+}