add barcodes
This commit is contained in:
parent
64e23cc4ab
commit
b057c46cbe
1 changed files with 7 additions and 1 deletions
|
@ -43,6 +43,8 @@ pub struct Variant {
|
|||
pub min: Option<i64>,
|
||||
/// Days until expiry
|
||||
pub expiry: Option<i64>,
|
||||
/// Associated barcodes
|
||||
pub barcodes: Option<Vec<i64>>
|
||||
}
|
||||
|
||||
impl Variant {
|
||||
|
@ -69,6 +71,9 @@ impl Variant {
|
|||
.unwrap()
|
||||
.get("expiry")
|
||||
.map(|x| x.as_i64().unwrap()),
|
||||
barcodes: json.as_mapping().unwrap().get("barcodes").map(|x| {
|
||||
x.as_sequence().unwrap().into_iter().map(|x| x.as_i64().unwrap()).collect()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,7 +299,8 @@ impl Variant {
|
|||
"variant": self.variant,
|
||||
"name": self.name,
|
||||
"min": self.min,
|
||||
"expiry": self.expiry
|
||||
"expiry": self.expiry,
|
||||
"barcodes": self.barcodes
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue