use backbone_core::write_hooks::DeclaredEvent;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StockReceived {
pub receipt_id: serde_json::Value,
pub company_id: serde_json::Value,
pub warehouse_id: serde_json::Value,
pub source_po_id: serde_json::Value,
pub total_value: serde_json::Value,
}
impl DeclaredEvent for StockReceived {
const NAME: &'static str = "StockReceived";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StockDelivered {
pub delivery_id: serde_json::Value,
pub company_id: serde_json::Value,
pub warehouse_id: serde_json::Value,
pub source_so_id: serde_json::Value,
pub total_cogs: serde_json::Value,
}
impl DeclaredEvent for StockDelivered {
const NAME: &'static str = "StockDelivered";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StockMoved {
pub entry_id: serde_json::Value,
pub company_id: serde_json::Value,
pub from_warehouse_id: serde_json::Value,
pub to_warehouse_id: serde_json::Value,
}
impl DeclaredEvent for StockMoved {
const NAME: &'static str = "StockMoved";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StockReconciled {
pub reconciliation_id: serde_json::Value,
pub company_id: serde_json::Value,
pub warehouse_id: serde_json::Value,
pub net_difference: serde_json::Value,
}
impl DeclaredEvent for StockReconciled {
const NAME: &'static str = "StockReconciled";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct LandedCostValidated {
pub lc_id: serde_json::Value,
pub company_id: serde_json::Value,
pub target_receipt_id: serde_json::Value,
pub amount_total: serde_json::Value,
pub revalued_value: serde_json::Value,
}
impl DeclaredEvent for LandedCostValidated {
const NAME: &'static str = "LandedCostValidated";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MoveConfirmed {
pub move_id: serde_json::Value,
pub company_id: serde_json::Value,
pub item_id: serde_json::Value,
pub demand_qty: serde_json::Value,
pub picking_id: serde_json::Value,
}
impl DeclaredEvent for MoveConfirmed {
const NAME: &'static str = "MoveConfirmed";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MoveAssigned {
pub move_id: serde_json::Value,
pub company_id: serde_json::Value,
pub picking_id: serde_json::Value,
}
impl DeclaredEvent for MoveAssigned {
const NAME: &'static str = "MoveAssigned";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MoveDone {
pub move_id: serde_json::Value,
pub company_id: serde_json::Value,
pub item_id: serde_json::Value,
pub quantity: serde_json::Value,
pub price_unit: serde_json::Value,
pub is_inventory: serde_json::Value,
}
impl DeclaredEvent for MoveDone {
const NAME: &'static str = "MoveDone";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct MoveCancelled {
pub move_id: serde_json::Value,
pub company_id: serde_json::Value,
pub released_qty: serde_json::Value,
}
impl DeclaredEvent for MoveCancelled {
const NAME: &'static str = "MoveCancelled";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct TransferProjected {
pub transfer_id: serde_json::Value,
pub company_id: serde_json::Value,
pub state: serde_json::Value,
pub previous_state: serde_json::Value,
}
impl DeclaredEvent for TransferProjected {
const NAME: &'static str = "TransferProjected";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BackorderCreated {
pub backorder_id: serde_json::Value,
pub company_id: serde_json::Value,
pub origin_id: serde_json::Value,
}
impl DeclaredEvent for BackorderCreated {
const NAME: &'static str = "BackorderCreated";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct OrderpointTriggered {
pub orderpoint_id: serde_json::Value,
pub company_id: serde_json::Value,
pub item_id: serde_json::Value,
pub qty_to_order: serde_json::Value,
pub forecast_qty: serde_json::Value,
}
impl DeclaredEvent for OrderpointTriggered {
const NAME: &'static str = "OrderpointTriggered";
const VERSION: i32 = 1;
const AGGREGATE: &'static str = "";
}
pub const OUTBOX_SCHEMAS: &[&str] = &[];
pub async fn migrate_outbox(pool: &backbone_orm::PgPool) -> anyhow::Result<()> {
for schema in OUTBOX_SCHEMAS {
backbone_core::write_hooks::migrate_outbox(pool, schema).await?;
}
Ok(())
}