From e5edaceb22c487370edf706308f472766d79ee96 Mon Sep 17 00:00:00 2001 From: Andrey Brusnik Date: Fri, 19 Jul 2024 14:20:40 +0400 Subject: [PATCH] Move deserialization prefix for `giveaway_message_id` field to types module because it will be used in `ChatBoostSourceGiveaway` later --- crates/teloxide-core/src/types.rs | 5 +++++ crates/teloxide-core/src/types/giveaway_winners.rs | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/teloxide-core/src/types.rs b/crates/teloxide-core/src/types.rs index 643fe086..97bcbf76 100644 --- a/crates/teloxide-core/src/types.rs +++ b/crates/teloxide-core/src/types.rs @@ -306,6 +306,11 @@ pub use recipient::*; pub use seconds::*; pub use user_id::*; +use serde_with::with_prefix; + +// Deserialization prefix for giveaway_message_id field used in GiveawayWinners +with_prefix!(prefix_giveaway_message_id "giveaway_"); + /// Converts an `i64` timestamp to a `choro::DateTime`, producing serde error /// for invalid timestamps pub(crate) fn serde_timestamp( diff --git a/crates/teloxide-core/src/types/giveaway_winners.rs b/crates/teloxide-core/src/types/giveaway_winners.rs index 9dddc3e6..b5043ad8 100644 --- a/crates/teloxide-core/src/types/giveaway_winners.rs +++ b/crates/teloxide-core/src/types/giveaway_winners.rs @@ -1,11 +1,8 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; -use serde_with::with_prefix; use crate::types::{Chat, MessageId, User}; -with_prefix!(prefix_giveaway "giveaway_"); - /// This object represents a message about the completion of a giveaway with /// public winners. #[serde_with::skip_serializing_none] @@ -15,7 +12,7 @@ pub struct GiveawayWinners { pub chat: Chat, /// Identifier of the messsage with the giveaway in the chat - #[serde(flatten, with = "prefix_giveaway")] + #[serde(flatten, with = "crate::types::prefix_giveaway_message_id")] pub giveaway_message_id: MessageId, /// Point in time (Unix timestamp) when winners of the giveaway were