improve and add models
This commit is contained in:
@@ -2,7 +2,7 @@ use rhai::plugin::*;
|
||||
use rhai::{Engine, EvalAltResult, Position, Module, INT, Dynamic, Array};
|
||||
use std::sync::Arc;
|
||||
use std::mem;
|
||||
use chrono::{DateTime, Utc};
|
||||
use chrono::Utc;
|
||||
|
||||
use super::account::Account;
|
||||
use super::asset::{Asset, AssetType};
|
||||
@@ -10,7 +10,6 @@ use super::marketplace::{Listing, Bid, ListingStatus, ListingType, BidStatus};
|
||||
|
||||
use crate::db::hero::OurDB;
|
||||
use crate::db::{Collection, Db};
|
||||
use heromodels_core::Model;
|
||||
|
||||
type RhaiAccount = Account;
|
||||
type RhaiAsset = Asset;
|
||||
@@ -689,18 +688,8 @@ mod bid_module {
|
||||
Ok(bid.clone())
|
||||
}
|
||||
}
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Mutex;
|
||||
use rhai::ImmutableString;
|
||||
|
||||
// Custom error type for Rhai
|
||||
struct RhaiStringError(String);
|
||||
impl std::fmt::Debug for RhaiStringError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
// Register all Rhai functions for the finance module
|
||||
pub fn register_finance_rhai_module(engine: &mut Engine, db: Arc<OurDB>) {
|
||||
// --- Register model-specific modules with the engine ---
|
||||
|
Reference in New Issue
Block a user