Skip to content

Commit

Permalink
fix: bug while scaffolding collection by author (#290)
Browse files Browse the repository at this point in the history
* fix: bug while scaffolding collection by author

* fix initial insert statement
  • Loading branch information
c12i committed May 20, 2024
1 parent a6a57b5 commit f78763e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/scaffold/collection/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ fn add_delete_link_in_delete_function(
let zome_file_tree = ZomeFileTree::from_zome_manifest(dna_file_tree, chosen_coordinator_zome)?;

let snake_case_entry_type = entry_type_reference.entry_type.to_case(Case::Snake);
let pascal_case_entry_type = entry_type_reference.entry_type.to_case(Case::Pascal);

let target_hash_variable = match entry_type_reference.reference_entry_hash {
true =>
Expand Down Expand Up @@ -234,18 +235,18 @@ fn add_delete_link_in_delete_function(
delete_link_stmts.insert(
0,
r#"
let record = match details {{
let record = match details {
Details::Record(details) => Ok(details.record),
_ => Err(wasm_error!(WasmErrorInner::Guest(String::from(
"Malformed get details response"
)))),
}}?;
}?;
"#
.to_string(),
);
delete_link_stmts.insert(0, format!(r#"
let details = get_details(original_{snake_case_entry_type}_hash.clone(), GetOptions::default())?
.ok_or(wasm_error!(WasmErrorInner::Guest(String::from("{{pascal_entry_def_name}} not found"))))?;
.ok_or(wasm_error!(WasmErrorInner::Guest(String::from("{pascal_case_entry_type} not found"))))?;
"#));
delete_link_stmts.push(format!(
r#"let links = get_links(
Expand Down

0 comments on commit f78763e

Please sign in to comment.