From 41b795e7f0bd64a14092fbd122b4dd14cc6c935d Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Mon, 12 Sep 2022 07:34:24 -0700 Subject: [PATCH] sample.. what do we think about moving these? --- zomes/rea_plan/rpc/src/lib.rs | 27 +++++++++++++++++++++++++++ zomes/rea_plan/zome/src/lib.rs | 17 ----------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/zomes/rea_plan/rpc/src/lib.rs b/zomes/rea_plan/rpc/src/lib.rs index 208c70d35..5ff189156 100644 --- a/zomes/rea_plan/rpc/src/lib.rs +++ b/zomes/rea_plan/rpc/src/lib.rs @@ -21,6 +21,14 @@ pub use vf_attributes_hdk::{ //---------------- EXTERNAL RECORD STRUCTURE ---------------- +/// I/O struct utilized to read back a single record +/// specified by its hash/address. +/// +#[derive(Debug, Serialize, Deserialize)] +struct ReadParams { + pub address: PlanAddress, +} + /// I/O struct to describe the complete record, including all managed link fields /// #[derive(Clone, Serialize, Deserialize, SerializedBytes, Debug)] @@ -59,6 +67,16 @@ pub struct ResponseData { //---------------- CREATE REQUEST ---------------- +/// I/O struct to describe what is passed in from outside the gateway to create a Plan. +/// This is structured as-is with named attributes in order to leave space +/// for future additional input values. +/// +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct CreateParams { + pub plan: CreateRequest, +} + /// I/O struct to describe the complete input record, including all managed links /// #[derive(Clone, Serialize, Deserialize, SerializedBytes, Debug)] @@ -91,6 +109,15 @@ impl<'a> CreateRequest { //---------------- UPDATE REQUEST ---------------- +/// I/O struct to describe what is passed in from outside the gateway to update a Plan. +/// This is structured as-is with named attributes in order to leave space +/// for future additional input values. +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct UpdateParams { + pub plan: UpdateRequest, +} + /// I/O struct to describe the complete input record, including all managed links /// #[derive(Clone, Serialize, Deserialize, SerializedBytes, Debug)] diff --git a/zomes/rea_plan/zome/src/lib.rs b/zomes/rea_plan/zome/src/lib.rs index a82133520..3614da48e 100644 --- a/zomes/rea_plan/zome/src/lib.rs +++ b/zomes/rea_plan/zome/src/lib.rs @@ -12,22 +12,11 @@ use hdk::prelude::*; use hc_zome_rea_plan_rpc::*; use hc_zome_rea_plan_lib::*; -#[derive(Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -struct CreateParams { - pub plan: CreateRequest, -} - #[hdk_extern] fn create_plan(CreateParams { plan }: CreateParams) -> ExternResult { Ok(handle_create_plan(PLAN_ENTRY_TYPE, plan)?) } -#[derive(Debug, Serialize, Deserialize)] -struct ReadParams { - pub address: PlanAddress, -} - #[hdk_extern] fn get_plan(ReadParams { address }: ReadParams) -> ExternResult { Ok(handle_get_plan(address)?) @@ -38,12 +27,6 @@ fn get_revision(ByRevision { revision_id }: ByRevision) -> ExternResult ExternResult { Ok(handle_update_plan(plan)?)