Skip to content

Commit

Permalink
Merge pull request #642 from RWDai/fix(flow)--fix-autofill-type-parse
Browse files Browse the repository at this point in the history
fix(flow): fix autofill type parse
  • Loading branch information
RWDai authored Mar 18, 2024
2 parents ebdaf18 + e96d725 commit 69c62b6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions middleware/flow/src/serv/flow_inst_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,12 +1041,20 @@ impl FlowInstServ {
Value::String("".to_string())
}
}
crate::dto::flow_var_dto::DefaultValueType::AutoFill => match FillType::from_str(&default.value.to_string()).map_err(|err| {
funs.err().internal_error("flow_inst", "check_transfer_vars", &err.to_string(), "400-flow-inst-vars-field-missing")
})? {
FillType::Time => Value::String(Utc::now().timestamp_millis().to_string()),
FillType::Person => Value::String(ctx.owner.clone()),
},
crate::dto::flow_var_dto::DefaultValueType::AutoFill => {
match FillType::from_str(&default.value.as_str().ok_or(funs.err().bad_request(
"flow_transitions",
"default_value_type_parse",
"AutoFill default value type is not string",
"400-flow-inst-vars-field-missing",
))?)
.map_err(|err| {
funs.err().internal_error("flow_transitions", "default_value_type_parse", &err.to_string(), "400-flow-inst-vars-field-missing")
})? {
FillType::Time => Value::String(Utc::now().timestamp_millis().to_string()),
FillType::Person => Value::String(ctx.owner.clone()),
}
}
};
var.dyn_default_value = Some(default_value);
};
Expand Down

0 comments on commit 69c62b6

Please sign in to comment.