...
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
use chrono::{DateTime, Utc, Duration};
 | 
			
		||||
use serde::{Deserialize, Serialize};
 | 
			
		||||
use crate::core::{SledModel, Storable}; // Import Sled traits from new location
 | 
			
		||||
use crate::db::base::{SledModel, Storable}; // Import Sled traits from db module
 | 
			
		||||
 | 
			
		||||
/// Currency represents a monetary value with amount and currency code
 | 
			
		||||
#[derive(Debug, Clone, Serialize, Deserialize)]
 | 
			
		||||
@@ -54,3 +54,18 @@ impl CurrencyBuilder {
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Implement Storable trait (provides default dump/load)
 | 
			
		||||
impl Storable for Currency {}
 | 
			
		||||
 | 
			
		||||
// Implement SledModel trait
 | 
			
		||||
impl SledModel for Currency {
 | 
			
		||||
    fn get_id(&self) -> String {
 | 
			
		||||
        // Use the currency code as the ID
 | 
			
		||||
        self.currency_code.clone()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn db_prefix() -> &'static str {
 | 
			
		||||
        "currency"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
use chrono::{DateTime, Utc, Duration};
 | 
			
		||||
use serde::{Deserialize, Serialize};
 | 
			
		||||
use crate::core::{SledModel, Storable}; // Import Sled traits from new location
 | 
			
		||||
use crate::db::base::{SledModel, Storable}; // Import Sled traits from db module
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/// ProductType represents the type of a product
 | 
			
		||||
@@ -355,4 +355,4 @@ impl SledModel for Product {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Import Currency from the currency module
 | 
			
		||||
use super::Currency;
 | 
			
		||||
use crate::models::biz::Currency;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
use super::product::Currency; // Use super:: for sibling module
 | 
			
		||||
use crate::core::{SledModel, Storable}; // Import Sled traits from new location
 | 
			
		||||
use crate::models::biz::Currency; // Use crate:: for importing from the module
 | 
			
		||||
use crate::db::base::{SledModel, Storable}; // Import Sled traits from db module
 | 
			
		||||
// use super::db::Model; // Removed old Model trait import
 | 
			
		||||
use chrono::{DateTime, Utc};
 | 
			
		||||
use serde::{Deserialize, Serialize};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user