final db models wip

This commit is contained in:
timurgordon
2025-06-03 21:50:08 +03:00
parent 2a2d69dafb
commit abbed9a1a1
43 changed files with 2958 additions and 1410 deletions

View File

@@ -3,7 +3,7 @@ let db = get_db();
// Create a new calendar using the constructor and builder methods
print("Creating a new calendar (ID will be DB-assigned) via registered constructor...");
let calendar = new_calendar(). // ID removed
let calendar = new_calendar("My first calendar"). // ID removed
name("My First Calendar").
description("A calendar for testing Rhai integration");

View File

@@ -1,8 +1,11 @@
use heromodels::db::hero::OurDB;
use heromodels::models::calendar::{Attendee, AttendanceStatus, Calendar, Event};
use heromodels::models::calendar::rhai::register_rhai_engine_functions;
use rhai::Engine;
use std::sync::Arc;
use std::{fs, path::Path};
use rhai_wrapper::wrap_vec_return;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize Rhai engine
@@ -14,6 +17,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Register the Calendar type with Rhai
// This function is generated by the #[rhai_model_export] attribute
Calendar::register_rhai_bindings_for_calendar(&mut engine, db.clone());
register_rhai_engine_functions(&mut engine, db.clone());
// Register a function to get the database instance
engine.register_fn("get_db", move || db.clone());