fix deserialization Message's created_at
This commit is contained in:
parent
2e356ac067
commit
0bc7978c99
@ -12,6 +12,7 @@ use enum_stringify::EnumStringify;
|
|||||||
use futures::stream::TryStreamExt;
|
use futures::stream::TryStreamExt;
|
||||||
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
use mongodb::bson::serde_helpers::chrono_datetime_as_bson_datetime;
|
||||||
use mongodb::options::IndexOptions;
|
use mongodb::options::IndexOptions;
|
||||||
use mongodb::{bson::doc, options::ClientOptions, Client};
|
use mongodb::{bson::doc, options::ClientOptions, Client};
|
||||||
use mongodb::{Collection, Database, IndexModel};
|
use mongodb::{Collection, Database, IndexModel};
|
||||||
@ -108,7 +109,8 @@ pub struct Message {
|
|||||||
pub message_id: i64,
|
pub message_id: i64,
|
||||||
pub token: String,
|
pub token: String,
|
||||||
pub variant: Option<String>,
|
pub variant: Option<String>,
|
||||||
pub created_at: DateTime<FixedOffset>,
|
#[serde(with = "chrono_datetime_as_bson_datetime")]
|
||||||
|
pub created_at: DateTime<Utc>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
@ -346,7 +348,7 @@ pub trait CallDB {
|
|||||||
doc! {
|
doc! {
|
||||||
"$set": {
|
"$set": {
|
||||||
"token": literal,
|
"token": literal,
|
||||||
"created_at": Into::<DateTime<FixedOffset>>::into(Local::now()),
|
"created_at": Into::<DateTime<Utc>>::into(Local::now()),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -376,7 +378,7 @@ pub trait CallDB {
|
|||||||
"$set": {
|
"$set": {
|
||||||
"token": literal,
|
"token": literal,
|
||||||
"variant": variant,
|
"variant": variant,
|
||||||
"created_at": Into::<DateTime<FixedOffset>>::into(Local::now()),
|
"created_at": Into::<DateTime<Utc>>::into(Local::now()),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user