]> Untitled Git - lemmy.git/blobdiff - crates/db_queries/src/lib.rs
Rewrite fetcher (#1792)
[lemmy.git] / crates / db_queries / src / lib.rs
index e62124b1827b49b3cb2099f605a67bbaba8f9189..dbd470e4deb98be1b9c7c0d19b510863ffb4df5c 100644 (file)
@@ -12,6 +12,7 @@ extern crate diesel_migrations;
 #[cfg(test)]
 extern crate serial_test;
 
+use chrono::NaiveDateTime;
 use diesel::{result::Error, *};
 use lemmy_db_schema::{CommunityId, DbUrl, PersonId};
 use lemmy_utils::ApiError;
@@ -145,14 +146,14 @@ pub trait DeleteableOrRemoveable {
   fn blank_out_deleted_or_removed_info(self) -> Self;
 }
 
+// TODO: move this to apub lib
 pub trait ApubObject {
-  type Form;
+  /// If this object should be refetched after a certain interval, it should return the last refresh
+  /// time here. This is mainly used to update remote actors.
+  fn last_refreshed_at(&self) -> Option<NaiveDateTime>;
   fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Self, Error>
   where
     Self: Sized;
-  fn upsert(conn: &PgConnection, user_form: &Self::Form) -> Result<Self, Error>
-  where
-    Self: Sized;
 }
 
 pub trait MaybeOptional<T> {