Skip to content

Commit 92e0754

Browse files
committed
primitives - AdUnit & AdSlot - re-add with for the milliseconds timestamps
1 parent 4015d81 commit 92e0754

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

primitives/src/ad_slot.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use crate::{targeting::Rule, BigNum, ValidatorId};
2-
use chrono::{DateTime, Utc};
2+
use chrono::{
3+
serde::{ts_milliseconds, ts_milliseconds_option},
4+
DateTime, Utc,
5+
};
36
use serde::{Deserialize, Serialize};
47
use std::collections::HashMap;
58

@@ -32,6 +35,7 @@ pub struct AdSlot {
3235
/// User address from the session
3336
pub owner: ValidatorId,
3437
/// UTC timestamp in milliseconds, used as nonce for escaping duplicated spec ipfs hashes
38+
#[serde(with = "ts_milliseconds")]
3539
pub created: DateTime<Utc>,
3640
/// the name of the unit used in platform UI
3741
#[serde(default)]
@@ -45,5 +49,6 @@ pub struct AdSlot {
4549
#[serde(default)]
4650
pub archived: bool,
4751
/// UTC timestamp in milliseconds, changed every time modifiable property is changed
52+
#[serde(with = "ts_milliseconds_option")]
4853
pub modified: Option<DateTime<Utc>>,
4954
}

primitives/src/ad_unit.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use chrono::{DateTime, Utc};
1+
use chrono::{
2+
serde::{ts_milliseconds, ts_milliseconds_option},
3+
DateTime, Utc,
4+
};
25
use serde::{Deserialize, Serialize};
36

47
use crate::{ValidatorId, IPFS};
@@ -29,6 +32,7 @@ pub struct AdUnit {
2932
/// user address from the session
3033
pub owner: ValidatorId,
3134
/// number, UTC timestamp in milliseconds, used as nonce for escaping duplicated spec ipfs hashes
35+
#[serde(with = "ts_milliseconds")]
3236
pub created: DateTime<Utc>,
3337
/// the name of the unit used in platform UI
3438
pub title: Option<String>,
@@ -38,5 +42,6 @@ pub struct AdUnit {
3842
#[serde(default)]
3943
pub archived: bool,
4044
/// UTC timestamp in milliseconds, changed every time modifiable property is changed
45+
#[serde(with = "ts_milliseconds_option")]
4146
pub modified: Option<DateTime<Utc>>,
4247
}

0 commit comments

Comments
 (0)