Skip to content

Commit

Permalink
feat: NotificationBucket - add last_updated datetime
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Jul 27, 2023
1 parent 20a7736 commit 308974c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/models/ctx/update_notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub fn update_notifications<E: Env + 'static>(
},
);

notifications.created = E::now();
notifications.last_updated = E::now();
let notification_items_effects = update_notification_items::<E>(
&mut notifications.items,
notification_catalogs,
Expand Down
1 change: 0 additions & 1 deletion src/types/addon/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use crate::types::{
resource::{MetaItem, MetaItemPreview, Stream, Subtitles},
};


/// Resource Response from an addon.
///
/// Deserializing the struct from json will skip any invalid Vec items
Expand Down
9 changes: 8 additions & 1 deletion src/types/notifications/notifications_bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ use crate::{

#[derive(Default, Derivative, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub struct NotificationsBucket {
#[serde(default)]
pub uid: UID,
/// Notifications
/// Notifications per meta item and video id
#[serde(default)]
pub items: HashMap<MetaItemId, HashMap<VideoId, NotificationItem>>,
/// The last time notifications were pulled.
#[serde(default)]
pub last_updated: Option<DateTime<Utc>>,
/// The moment that the notification bucket was initialized.
#[derivative(Default(value = "Utc::now()"))]
pub created: DateTime<Utc>,
}
Expand All @@ -39,6 +45,7 @@ impl NotificationsBucket {

acc
}),
last_updated: None,
created: E::now(),
}
}
Expand Down

0 comments on commit 308974c

Please sign in to comment.