diff --git a/src/main.rs b/src/main.rs index c4300ef0..2ec8c06f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,7 +72,7 @@ mod tests { #[test] fn test_order_deserialize_serialize() { - let sample_order = r#"{"kind":"Sell","status":"Pending","amount":100,"fiat_code":"XXX","fiat_amount":10,"payment_method":"belo","premium":1}"#; + let sample_order = r#"{"kind":"Sell","status":"Pending","amount":100,"fiat_code":"XXX","fiat_amount":10,"payment_method":"belo","premium":1,"created_at":0}"#; let order = NewOrder::from_json(sample_order).unwrap(); let json_order = order.as_json().unwrap(); assert_eq!(sample_order, json_order); diff --git a/src/util.rs b/src/util.rs index 1fcd4a27..2456e76d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -12,6 +12,7 @@ use log::{error, info}; use mostro_core::order::{Kind as OrderKind, NewOrder, Order, SmallOrder, Status}; use mostro_core::{Action, Content, Message}; use nostr_sdk::prelude::*; +use sqlx::types::chrono::Utc; use sqlx::SqlitePool; use sqlx::{Pool, Sqlite}; use std::str::FromStr; @@ -105,7 +106,7 @@ pub async fn publish_order( None, None, None, - order.created_at, + Utc::now().timestamp(), ); let order_string = order.as_json().unwrap(); info!("serialized order: {order_string}");