Skip to content

Commit

Permalink
correct unit fields
Browse files Browse the repository at this point in the history
  • Loading branch information
LeosPrograms committed Dec 9, 2024
1 parent 801c99b commit 71e05f5
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 30 deletions.
2 changes: 1 addition & 1 deletion modules/graphql-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@leosprograms/graphql-client-holochain",
"version": "0.6.18",
"version": "0.6.19",
"description": "ValueFlows GraphQLClient configurations, providing pluggable backend datasources for different distributed, federated and client/server infrastructure.",
"type": "module",
"main": "build/index.js",
Expand Down
4 changes: 2 additions & 2 deletions modules/vf-graphql-holochain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@leosprograms/vf-graphql-holochain",
"version": "0.6.18",
"version": "0.6.19",
"type": "module",
"main": "build/index.js",
"types": "build/index.d.ts",
Expand Down Expand Up @@ -42,7 +42,7 @@
"@graphql-tools/schema": "^9.0.14",
"@graphql-tools/utils": "^9.1.4",
"@holochain/client": "^0.18.0-dev.13",
"@leosprograms/vf-graphql": "0.9.0-alpha.11",
"@leosprograms/vf-graphql": "0.9.0-alpha.12",
"big.js": "^6.2.1",
"buffer": "^6.0.3",
"dataloader": "^1.4.0",
Expand Down
17 changes: 13 additions & 4 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@babel/eslint-parser": "^7.18.2",
"@holochain-playground/cli": "0.0.8",
"@holochain/tryorama": "=0.17.0-dev.5",
"@leosprograms/vf-graphql": "0.9.0-alpha.11",
"@leosprograms/vf-graphql": "0.9.0-alpha.12",
"@leosprograms/vf-graphql-holochain": "workspace:*",
"@holochain/client": "^0.18.0-dev.13",
"assert": "^2.0.0",
Expand Down
4 changes: 1 addition & 3 deletions zomes/rea_unit/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ fn construct_response<'a>(
meta: read_revision_metadata_abbreviated(meta)?,
label: e.label.to_owned(),
symbol: e.symbol.to_owned(),
override_label: e.override_label.to_owned(),
override_symbol: e.override_symbol.to_owned(),
om_unit_identifier: e.om_unit_identifier.to_owned(),
classified_as: e.classifiedAs.to_owned(),
classified_as: e.classified_as.to_owned(),
}
})
}
20 changes: 9 additions & 11 deletions zomes/rea_unit/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub use vf_attributes_hdk::{
UnitId,
UnitInternalAddress as UnitAddress,
ByRevision, RecordMeta, RevisionMeta,
ExternalURL,
};

pub use holo_hash::ActionHash;
Expand All @@ -36,10 +37,9 @@ pub struct Response {
pub meta: RecordMeta,
pub label: String,
pub symbol: String,
pub override_label: String,
pub override_symbol: String,
pub om_unit_identifier: String,
pub classified_as: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub classified_as: Option<Vec<ExternalURL>>,
}

impl<'a> Response {
Expand Down Expand Up @@ -68,11 +68,10 @@ pub struct ResponseData {
pub struct CreateRequest {
pub label: String,
pub symbol: String,
pub override_label: String,
pub override_symbol: String,
pub om_unit_identifier: String,
pub classified_as: String,
}
#[serde(default)]
#[serde(skip_serializing_if = "MaybeUndefined::is_undefined")]
pub classified_as: MaybeUndefined<Vec<ExternalURL>>,}

impl<'a> CreateRequest {
pub fn get_symbol(&'a self) -> &str {
Expand All @@ -96,11 +95,10 @@ pub struct UpdateRequest {
pub revision_id: ActionHash,
pub label: MaybeUndefined<String>,
pub symbol: MaybeUndefined<String>,
pub override_label: MaybeUndefined<String>,
pub override_symbol: MaybeUndefined<String>,
pub om_unit_identifier: MaybeUndefined<String>,
pub classified_as: MaybeUndefined<String>,
}
#[serde(default)]
#[serde(skip_serializing_if = "MaybeUndefined::is_undefined")]
pub classified_as: MaybeUndefined<Vec<ExternalURL>>,}

impl<'a> UpdateRequest {
pub fn get_revision_id(&'a self) -> &ActionHash {
Expand Down
14 changes: 6 additions & 8 deletions zomes/rea_unit/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ use hdk_records::{
record_interface::{ Updateable },
};

use vf_attributes_hdk::{
ExternalURL,
};

use hc_zome_rea_unit_rpc::{ CreateRequest, UpdateRequest };

pub use vf_attributes_hdk::{ UnitInternalAddress };
Expand All @@ -41,10 +45,8 @@ pub struct UnitZomeConfig {
pub struct EntryData {
pub label: String,
pub symbol: String,
pub override_label: String,
pub override_symbol: String,
pub om_unit_identifier: String,
pub classified_as: String,
pub classified_as: Option<Vec<ExternalURL>>,
}

impl<'a> EntryData {
Expand Down Expand Up @@ -100,8 +102,6 @@ impl TryFrom<CreateRequest> for EntryData {
Ok(EntryData {
label: e.label.into(),
symbol: e.symbol.into(),
override_label: e.override_label.into(),
override_symbol: e.override_symbol.into(),
om_unit_identifier: e.om_unit_identifier.into(),
classified_as: e.classified_as.into(),
})
Expand All @@ -116,10 +116,8 @@ impl Updateable<UpdateRequest> for EntryData {
Ok(EntryData {
label: if !e.label.is_some() { self.label.to_owned() } else { e.label.to_owned().unwrap() },
symbol: if !e.symbol.is_some() { self.symbol.to_owned() } else { e.symbol.to_owned().unwrap() },
override_label: if !e.override_label.is_some() { self.override_label.to_owned() } else { e.override_label.to_owned().unwrap() },
override_symbol: if !e.override_symbol.is_some() { self.override_symbol.to_owned() } else { e.override_symbol.to_owned().unwrap() },
om_unit_identifier: if !e.om_unit_identifier.is_some() { self.om_unit_identifier.to_owned() } else { e.om_unit_identifier.to_owned().unwrap() },
classified_as: if !e.classified_as.is_some() { self.classified_as.to_owned() } else { e.classified_as.to_owned().unwrap() },
classified_as: if !e.classified_as.is_some() { self.classified_as.to_owned() } else { e.classified_as.to_owned().into() },
})
}
}

0 comments on commit 71e05f5

Please sign in to comment.