Skip to content

Commit

Permalink
feat: update last_watched on MarkAsWatched
Browse files Browse the repository at this point in the history
Signed-off-by: Lachezar Lechev <[email protected]>
  • Loading branch information
elpiel committed Aug 21, 2023
1 parent f6cb786 commit a50e06e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/models/meta_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ impl<E: Env + 'static> UpdateWithCtx<E> for MetaDetails {
true => library_item.state.times_watched + 1,
false => 0,
};
// update the last_watched for the LibraryItem
library_item.state.last_watched = Some(E::now());

Effects::msg(Msg::Internal(Internal::UpdateLibraryItem(library_item)))
.unchanged()
}
Expand Down
6 changes: 6 additions & 0 deletions src/runtime/msg/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ pub enum ActionLibraryByType {
#[derive(Clone, Deserialize, Debug)]
#[serde(tag = "action", content = "args")]
pub enum ActionMetaDetails {
/// Marks the [`LibraryItem`] as watched.
///
/// Applicable when you have single-video (e.g. a movie) and multi-video (e.g. a movie series) item.
MarkAsWatched(bool),
/// Marks the given [`Video`] of the [`LibraryItem`] as watched.
///
/// Applicable only when you have a multi-video (e.g. movie series) item.
MarkVideoAsWatched(Video, bool),
}

Expand Down

0 comments on commit a50e06e

Please sign in to comment.