Merge pull request #144 from mprasil/collection_revision

Update affected users revision when there are collection changes
This commit is contained in:
Daniel García
2018-08-21 13:47:19 +02:00
committed by GitHub
2 changed files with 20 additions and 0 deletions

View File

@@ -154,6 +154,14 @@ impl User {
}
}
pub fn update_uuid_revision(uuid: &str, conn: &DbConn) {
if let Some(mut user) = User::find_by_uuid(&uuid, conn) {
if user.update_revision(conn).is_err(){
println!("Warning: Failed to update revision for {}", user.email);
};
};
}
pub fn update_revision(&mut self, conn: &DbConn) -> QueryResult<()> {
self.updated_at = Utc::now().naive_utc();
diesel::update(