@@ -45,6 +45,7 @@ pub struct EntryData {
45
45
pub default_unit_of_effort : Option < UnitId > ,
46
46
pub default_unit_of_resource : Option < UnitId > ,
47
47
pub _nonce : Bytes ,
48
+ pub substitutable : Option < bool > ,
48
49
}
49
50
50
51
generate_record_entry ! ( EntryData , ResourceSpecificationAddress , EntryStorage ) ;
@@ -97,6 +98,7 @@ impl TryFrom<CreateRequest> for EntryData {
97
98
default_unit_of_effort : e. default_unit_of_effort . into ( ) ,
98
99
default_unit_of_resource : e. default_unit_of_resource . into ( ) ,
99
100
_nonce : random_bytes ( 32 ) ?,
101
+ substitutable : e. substitutable . into ( ) ,
100
102
} )
101
103
}
102
104
}
@@ -107,11 +109,36 @@ impl TryFrom<CreateRequest> for EntryData {
107
109
impl Updateable < UpdateRequest > for EntryData {
108
110
fn update_with ( & self , e : UpdateRequest ) -> RecordAPIResult < EntryData > {
109
111
Ok ( EntryData {
110
- name : if !e. name . is_some ( ) { self . name . to_owned ( ) } else { e. name . to_owned ( ) . unwrap ( ) } ,
111
- image : if e. image . is_undefined ( ) { self . image . to_owned ( ) } else { e. image . to_owned ( ) . into ( ) } ,
112
- note : if e. note . is_undefined ( ) { self . note . to_owned ( ) } else { e. note . to_owned ( ) . into ( ) } ,
113
- default_unit_of_effort : if e. default_unit_of_effort . is_undefined ( ) { self . default_unit_of_effort . to_owned ( ) } else { e. default_unit_of_effort . to_owned ( ) . into ( ) } ,
114
- default_unit_of_resource : if e. default_unit_of_resource . is_undefined ( ) { self . default_unit_of_resource . to_owned ( ) } else { e. default_unit_of_resource . to_owned ( ) . into ( ) } ,
112
+ name : if !e. name . is_some ( ) {
113
+ self . name . to_owned ( )
114
+ } else {
115
+ e. name . to_owned ( ) . unwrap ( )
116
+ } ,
117
+ image : if e. image . is_undefined ( ) {
118
+ self . image . to_owned ( )
119
+ } else {
120
+ e. image . to_owned ( ) . into ( )
121
+ } ,
122
+ note : if e. note . is_undefined ( ) {
123
+ self . note . to_owned ( )
124
+ } else {
125
+ e. note . to_owned ( ) . into ( )
126
+ } ,
127
+ default_unit_of_effort : if e. default_unit_of_effort . is_undefined ( ) {
128
+ self . default_unit_of_effort . to_owned ( )
129
+ } else {
130
+ e. default_unit_of_effort . to_owned ( ) . into ( )
131
+ } ,
132
+ default_unit_of_resource : if e. default_unit_of_resource . is_undefined ( ) {
133
+ self . default_unit_of_resource . to_owned ( )
134
+ } else {
135
+ e. default_unit_of_resource . to_owned ( ) . into ( )
136
+ } ,
137
+ substitutable : if e. substitutable . is_undefined ( ) {
138
+ self . substitutable . to_owned ( )
139
+ } else {
140
+ e. substitutable . to_owned ( ) . into ( )
141
+ } ,
115
142
_nonce : self . _nonce . to_owned ( ) ,
116
143
} )
117
144
}
0 commit comments