wb_cache/test/simulation/scriptwriter/entity/
order.rs

1use fieldx::fxstruct;
2use sea_orm::prelude::Uuid;
3
4use crate::test::simulation::types::OrderStatus;
5
6#[fxstruct(no_new, builder, get(copy))]
7#[derive(Clone, Debug)]
8pub struct Order {
9    /// The order id.
10    pub id:          Uuid,
11    /// The customer id.
12    pub customer_id: i32,
13    /// The product id.
14    pub product_id:  i32,
15    /// The quantity of the product.
16    pub quantity:    i32,
17    /// The status of the order.
18    pub status:      OrderStatus,
19}
20
21impl From<Order> for crate::test::simulation::db::entity::Order {
22    fn from(order: Order) -> Self {
23        Self {
24            id:           order.id,
25            customer_id:  order.customer_id,
26            product_id:   order.product_id,
27            quantity:     order.quantity,
28            status:       order.status,
29            purchased_on: 0, // Placeholder, as this field is not present in the struct
30        }
31    }
32}