35 lines
926 B
Rust
35 lines
926 B
Rust
|
// SPDX-FileCopyrightText: 2024 Aravinth Manivannan <realaravinth@batsense.net>
|
||
|
//
|
||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||
|
|
||
|
use cqrs_es::DomainEvent;
|
||
|
use serde::{Deserialize, Serialize};
|
||
|
|
||
|
use super::{
|
||
|
// category_added_event::*,
|
||
|
store_added_event::StoreAddedEvent,
|
||
|
};
|
||
|
|
||
|
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq, Ord, PartialOrd)]
|
||
|
pub enum InventoryEvent {
|
||
|
// CategoryAdded(CategoryAddedEvent),
|
||
|
StoreAdded(StoreAddedEvent),
|
||
|
}
|
||
|
|
||
|
//TODO: define password type that takes string and converts to hash
|
||
|
|
||
|
impl DomainEvent for InventoryEvent {
|
||
|
fn event_version(&self) -> String {
|
||
|
"1.0".to_string()
|
||
|
}
|
||
|
|
||
|
fn event_type(&self) -> String {
|
||
|
let e: &str = match self {
|
||
|
// InventoryEvent::CategoryAdded { .. } => "InventoryCategoryAdded",
|
||
|
InventoryEvent::StoreAdded { .. } => "InventoryStoredded",
|
||
|
};
|
||
|
|
||
|
e.to_string()
|
||
|
}
|
||
|
}
|