@@ -3,6 +3,7 @@ use chrono::serde::ts_milliseconds;
3
3
use serde:: { Deserialize , Serialize } ;
4
4
5
5
use crate :: domain:: TargetingTag ;
6
+ use crate :: util:: serde:: ts_milliseconds_option;
6
7
7
8
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
8
9
#[ serde( rename_all = "camelCase" ) ]
@@ -23,27 +24,30 @@ pub struct AdUnit {
23
24
media_url : String ,
24
25
/// MIME type of the media, possible values at the moment are: image/jpeg, image/png
25
26
media_mime : String ,
26
- /// the advertised URL
27
+ /// Advertised URL
27
28
target_url : String ,
28
- /// an array of TargetingTag, optional
29
+ /// Array of TargetingTag
29
30
targeting : Vec < TargetingTag > ,
30
- /// optional, Number; minimum targeting score
31
+ /// Number; minimum targeting score (optional)
31
32
min_targeting_score : Option < u8 > ,
32
- /// an array of TargetingTag, meant for discovery between publishers/advertisers
33
+ /// Array of TargetingTag (optional)
34
+ /// meant for discovery between publishers/advertisers
35
+ #[ serde( default ) ]
33
36
tags : Vec < TargetingTag > ,
34
37
/// user address from the session
35
38
owner : String ,
36
39
/// number, UTC timestamp in milliseconds, used as nonce for escaping duplicated spec ipfs hashes
37
40
#[ serde( with = "ts_milliseconds" ) ]
38
41
created : DateTime < Utc > ,
39
42
/// the name of the unit used in platform UI
40
- title : String ,
43
+ title : Option < String > ,
41
44
/// arbitrary text used in platform UI
42
- description : String ,
45
+ description : Option < String > ,
43
46
/// user can change it - used for filtering in platform UI
47
+ #[ serde( default ) ]
44
48
archived : bool ,
45
49
/// UTC timestamp in milliseconds, changed every time modifiable property is changed
46
- #[ serde( with = "ts_milliseconds " ) ]
47
- modified : DateTime < Utc > ,
50
+ #[ serde( default , with = "ts_milliseconds_option " ) ]
51
+ modified : Option < DateTime < Utc > > ,
48
52
49
53
}
0 commit comments