fix merge issues and rhai examples wip

This commit is contained in:
timurgordon
2025-05-22 23:57:33 +03:00
parent 93950bcab4
commit 0da512484f
28 changed files with 780 additions and 431 deletions

View File

@@ -29,9 +29,9 @@ impl Flow {
/// Create a new flow.
/// The `id` is the database primary key.
/// The `flow_uuid` should be a Uuid::new_v4().to_string().
pub fn new(id: u32, flow_uuid: impl ToString) -> Self {
pub fn new(_id: u32, flow_uuid: impl ToString) -> Self {
Self {
base_data: BaseModelData::new(id),
base_data: BaseModelData::new(),
flow_uuid: flow_uuid.to_string(),
name: String::new(), // Default name, to be set by builder
status: String::from("Pending"), // Default status, to be set by builder

View File

@@ -22,9 +22,9 @@ pub struct FlowStep {
impl FlowStep {
/// Create a new flow step.
pub fn new(id: u32, step_order: u32) -> Self {
pub fn new(_id: u32, step_order: u32) -> Self {
Self {
base_data: BaseModelData::new(id),
base_data: BaseModelData::new(),
description: None,
step_order,
status: String::from("Pending"), // Default status

View File

@@ -103,7 +103,7 @@ pub fn register_flow_rhai_module(engine: &mut Engine, db: Arc<OurDB>) {
let captured_db_for_set_flow = Arc::clone(&db);
engine.register_fn("set_flow", move |flow: Flow| -> Result<(), Box<EvalAltResult>> {
captured_db_for_set_flow.set(&flow).map_err(|e| {
captured_db_for_set_flow.set(&flow).map(|_| ()).map_err(|e| {
Box::new(EvalAltResult::ErrorRuntime(format!("Failed to set Flow (ID: {}): {}", flow.base_data.id, e).into(), Position::NONE))
})
});
@@ -121,7 +121,7 @@ pub fn register_flow_rhai_module(engine: &mut Engine, db: Arc<OurDB>) {
let captured_db_for_set_sig_req = Arc::clone(&db);
engine.register_fn("set_signature_requirement", move |sr: SignatureRequirement| -> Result<(), Box<EvalAltResult>> {
captured_db_for_set_sig_req.set(&sr).map_err(|e| {
captured_db_for_set_sig_req.set(&sr).map(|_| ()).map_err(|e| {
Box::new(EvalAltResult::ErrorRuntime(format!("Failed to set SignatureRequirement (ID: {}): {}", sr.base_data.id, e).into(), Position::NONE))
})
});

View File

@@ -31,9 +31,9 @@ pub struct SignatureRequirement {
impl SignatureRequirement {
/// Create a new signature requirement.
pub fn new(id: u32, flow_step_id: u32, public_key: impl ToString, message: impl ToString) -> Self {
pub fn new(_id: u32, flow_step_id: u32, public_key: impl ToString, message: impl ToString) -> Self {
Self {
base_data: BaseModelData::new(id),
base_data: BaseModelData::new(),
flow_step_id,
public_key: public_key.to_string(),
message: message.to_string(),