1 // rustfmt-max_width: 140
3 impl NotificationRepository {
6 repo_tx_conn: &RepoTxConn,
8 changed_at: NaiveDateTime,
9 ) -> NukeResult<Option<NotificationStatus>> {
10 repo_tx_conn.run(move |conn| {
11 let res = diesel::update(client_notification::table)
13 client_notification::routable_id.eq(DieselRoutableId(rid.clone())).and(
14 client_notification::changed_at
16 .or(client_notification::changed_at.is_null()),
19 .set(client_notification::changed_at.eq(changed_at))
21 client_notification::id,
22 client_notification::changed_at,
23 client_notification::polled_at,
24 client_notification::notified_at,
26 .get_result::<(Uuid, Option<NaiveDateTime>, Option<NaiveDateTime>, Option<NaiveDateTime>)>(conn)
31 let client_id = client_contract::table
32 .inner_join(client_notification::table)
33 .filter(client_notification::id.eq(row.0))
34 .select(client_contract::client_id)
35 .get_result::<Uuid>(conn)?;
37 Ok(Some(NotificationStatus {
38 client_id: client_id.into(),