Skip to content

Commit

Permalink
configure for we attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
LeosPrograms committed Jan 30, 2024
1 parent 9a2cfeb commit c835a00
Show file tree
Hide file tree
Showing 22 changed files with 952 additions and 113 deletions.
32 changes: 32 additions & 0 deletions dnas/whosin/zomes/coordinator/coordinator/src/all_coordinations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,35 @@ pub fn get_all_coordinations(_: ()) -> ExternResult<Vec<Record>> {
let records: Vec<Record> = records.into_iter().filter_map(|r| r).collect();
Ok(records)
}

#[hdk_extern]
pub fn search_all_coordinations(query: String) -> ExternResult<Vec<ActionHash>> {
let path = Path::from("all_coordinations");
let links = get_links(path.path_entry_hash()?, LinkTypes::AllCoordinations, None)?;
let get_input: Vec<GetInput> = links
.into_iter()
.map(|link| GetInput::new(
// ActionHash::from(link.target).into(),
ActionHash::try_from(link.target).map_err(|_| wasm_error!(WasmErrorInner::Guest("Expected actionhash".into()))).unwrap().into(),
GetOptions::default(),
))
.collect();
let records = HDK.with(|hdk| hdk.borrow().get(get_input))?;
let records: Vec<Record> = records.into_iter().filter_map(|r| r).collect();

let mut output: Vec<ActionHash> = vec![];
for item in records.iter() {
emit_signal(item.clone())?;
let deliberation: Coordination = item
.entry()
.to_app_option()
.map_err(|err| wasm_error!(err))?
.ok_or(wasm_error!(WasmErrorInner::Guest(
"Could not deserialize record to FacetGroup.".into(),
)))?;
if deliberation.title.contains(&query) || deliberation.description.contains(&query) {
output.push(item.signed_action.as_hash().to_owned());
}
}
Ok(output)
}
2 changes: 2 additions & 0 deletions dnas/whosin/zomes/coordinator/coordinator/src/coordination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct CreateCoordinationInput {
reminder_date: Option<Timestamp>,
signup_deadline: Option<Timestamp>,
coordroles: Vec<Coordrole>,
attachments: Option<Vec<HrlB64WithContext>>,
}
#[hdk_extern]
pub fn get_dna_hash(_:()) -> ExternResult<String> {
Expand All @@ -36,6 +37,7 @@ pub fn create_coordination(input: CreateCoordinationInput) -> ExternResult<Recor
reminder_date: input.reminder_date,
signup_deadline: input.signup_deadline,
coordroles: coordrole_hashes.clone(),
attachments: input.attachments,
};
let coordination_hash = create_entry(
&EntryTypes::Coordination(coordination.clone()),
Expand Down
9 changes: 9 additions & 0 deletions dnas/whosin/zomes/integrity/coordinator/src/coordination.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
use hdi::prelude::*;

#[hdk_entry_helper]
#[derive(Clone, PartialEq)]
pub struct HrlB64WithContext {
pub hrl: String,
pub context: Option<String>,
}

#[hdk_entry_helper]
#[derive(Clone, PartialEq)]
pub struct Coordination {
Expand All @@ -8,6 +16,7 @@ pub struct Coordination {
pub signup_deadline: Option<Timestamp>,
pub reminder_date: Option<Timestamp>,
pub coordroles: Vec<ActionHash>,
pub attachments: Option<Vec<HrlB64WithContext>>,
}
pub fn validate_create_coordination(
_action: EntryCreationAction,
Expand Down
30 changes: 25 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
},
"dependencies": {
"@holochain-open-dev/profiles": "^0.17.3",
"@holochain/client": "^0.12.2",
"@lightningrodlabs/we-applet": "0.12.2",
"@holochain/client": "^0.16.7",
"@lightningrodlabs/we-applet": "^0.14.0",
"@material/mwc-button": "^0.27.0",
"@material/mwc-checkbox": "^0.27.0",
"@material/mwc-circular-progress": "^0.27.0",
Expand Down
Loading

0 comments on commit c835a00

Please sign in to comment.