From 12ae4a225ab0a370fc9ee1101c4402fbde1ac64b Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Sun, 15 Mar 2020 16:52:14 -0400 Subject: [PATCH] UserEvent's beatmap(set) IDs are not required --- youmubot-osu/src/models/mod.rs | 4 ++-- youmubot-osu/src/models/parse.rs | 4 ++-- youmubot-osu/src/models/raw.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/youmubot-osu/src/models/mod.rs b/youmubot-osu/src/models/mod.rs index 8c746ec..57697bf 100644 --- a/youmubot-osu/src/models/mod.rs +++ b/youmubot-osu/src/models/mod.rs @@ -181,8 +181,8 @@ impl Beatmap { #[derive(Clone, Debug, Serialize, Deserialize)] pub struct UserEvent { pub display_html: String, - pub beatmap_id: u64, - pub beatmapset_id: u64, + pub beatmap_id: Option, + pub beatmapset_id: Option, pub date: DateTime, pub epic_factor: u8, } diff --git a/youmubot-osu/src/models/parse.rs b/youmubot-osu/src/models/parse.rs index a230ad9..ba6651a 100644 --- a/youmubot-osu/src/models/parse.rs +++ b/youmubot-osu/src/models/parse.rs @@ -152,8 +152,8 @@ impl TryFrom for Beatmap { fn parse_user_event(s: raw::UserEvent) -> ParseResult { Ok(UserEvent { display_html: s.display_html, - beatmap_id: parse_from_str(&s.beatmap_id)?, - beatmapset_id: parse_from_str(&s.beatmapset_id)?, + beatmap_id: s.beatmap_id.map(parse_from_str).transpose()?, + beatmapset_id: s.beatmapset_id.map(parse_from_str).transpose()?, date: parse_date(&s.date)?, epic_factor: parse_from_str(&s.epicfactor)?, }) diff --git a/youmubot-osu/src/models/raw.rs b/youmubot-osu/src/models/raw.rs index d11064a..70cf94e 100644 --- a/youmubot-osu/src/models/raw.rs +++ b/youmubot-osu/src/models/raw.rs @@ -70,8 +70,8 @@ pub(crate) struct User { #[derive(Debug, Deserialize)] pub(crate) struct UserEvent { pub display_html: String, - pub beatmap_id: String, - pub beatmapset_id: String, + pub beatmap_id: Option, + pub beatmapset_id: Option, pub date: String, pub epicfactor: String, }