Compare commits

..

No commits in common. "28e3da0bbc76140c68833662971740090c18c103" and "1660da90a7a743b69bf420c00970900add9ee992" have entirely different histories.

4 changed files with 6 additions and 59 deletions

View file

@ -39,24 +39,6 @@ impl View<Category> for CategoryView {
self.store_id = *val.store_id();
self.deleted = false;
}
match &event.payload {
InventoryEvent::CategoryAdded(e) => {
self.name = e.name().into();
self.description = e.description().clone();
self.category_id = *e.category_id();
self.store_id = *e.store_id();
self.deleted = false;
}
InventoryEvent::CategoryUpdated(e) => {
let new_category = e.new_category();
self.name = new_category.name().into();
self.description = new_category.description().clone();
self.category_id = *new_category.category_id();
self.store_id = *new_category.store_id();
}
_ => (),
}
}
}

View file

@ -55,12 +55,6 @@ impl View<Customization> for CustomizationView {
self.deleted = false;
}
InventoryEvent::CustomizationUpdated(e) => {
let new = e.new_customization();
self.name = new.name().into();
self.product_id = *new.product_id();
self.customization_id = *new.customization_id();
}
_ => (),
}
}

View file

@ -112,25 +112,6 @@ impl View<Product> for ProductView {
self.deleted = false;
}
InventoryEvent::ProductUpdated(e) => {
let val = e.new_product();
self.name = val.name().into();
self.description = val.description().clone();
self.image = val.image().clone();
self.product_id = *val.product_id();
self.category_id = *val.category_id();
self.sku_able = *val.sku_able();
self.price_minor = *val.price().minor() as i32;
self.price_major = *val.price().major() as i32;
self.price_currency = val.price().currency().to_string();
self.quantity_major_number = *val.quantity().major().number() as i32;
self.quantity_minor_number = *val.quantity().minor().number() as i32;
self.quantity_major_unit = val.quantity().major().unit().to_string();
self.quantity_minor_unit = val.quantity().minor().unit().to_string();
}
_ => (),
}
}

View file

@ -32,22 +32,12 @@ pub struct StoreView {
// design the events to carry the balance information instead.
impl View<Store> for StoreView {
fn update(&mut self, event: &EventEnvelope<Store>) {
match &event.payload {
InventoryEvent::StoreAdded(val) => {
self.name = val.name().into();
self.address = val.address().clone();
self.store_id = *val.store_id();
self.owner = *val.owner();
self.deleted = false;
}
InventoryEvent::StoreUpdated(e) => {
let new_store = e.new_store();
self.name = new_store.name().clone();
self.address = new_store.address().clone();
self.store_id = *new_store.store_id();
self.owner = *new_store.owner();
}
_ => (),
if let InventoryEvent::StoreAdded(val) = &event.payload {
self.name = val.name().into();
self.address = val.address().clone();
self.store_id = *val.store_id();
self.owner = *val.owner();
self.deleted = false;
}
}
}