Skip to content

Commit

Permalink
Scaffolded orders zome
Browse files Browse the repository at this point in the history
  • Loading branch information
guillemcordoba committed Jul 8, 2024
1 parent b0a6677 commit aba18fa
Show file tree
Hide file tree
Showing 18 changed files with 597 additions and 79 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ path = "dnas/plenty/zomes/coordinator/households"
[workspace.dependencies.households_integrity]
path = "dnas/plenty/zomes/integrity/households"

[workspace.dependencies.orders]
path = "dnas/plenty/zomes/coordinator/orders"

[workspace.dependencies.orders_integrity]
path = "dnas/plenty/zomes/integrity/orders"

[workspace.dependencies.producers]
path = "dnas/plenty/zomes/coordinator/producers"

Expand Down
4 changes: 3 additions & 1 deletion dnas/plenty/dna.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
dnaManifest = ./workdir/dna.yaml;
holochain = inputs'.holochain;
zomes = {
tasks_integrity = inputs'.tasks.packages.tasks_integrity;
tasks_integrity = inputs'.tasks.packages.tasks_integrity;
tasks = inputs'.tasks.packages.tasks;
notifications_integrity =
inputs'.notifications.packages.notifications_integrity;
Expand All @@ -32,6 +32,8 @@
households = self'.packages.households;
producers_integrity = self'.packages.producers_integrity;
producers = self'.packages.producers;
orders_integrity = self'.packages.orders_integrity;
orders = self'.packages.orders;
};
};
};
Expand Down
162 changes: 87 additions & 75 deletions dnas/plenty/workdir/dna.yaml
Original file line number Diff line number Diff line change
@@ -1,86 +1,98 @@
manifest_version: '1'
---
manifest_version: "1"
name: plenty
integrity:
network_seed: null
properties: null
network_seed: ~
properties: ~
origin_time: 1712757789015560
zomes:
- name: profiles_integrity
hash: null
bundled: <NIX_PACKAGE>
dependencies: null
dylib: null
- name: roles_integrity
hash: null
bundled: <NIX_PACKAGE>
dependencies: null
dylib: null
- name: file_storage_integrity
hash: null
bundled: <NIX_PACKAGE>
dependencies: null
dylib: null
- name: households_integrity
hash: null
bundled: ../../../target/wasm32-unknown-unknown/release/households_integrity.wasm
dependencies: null
dylib: null
- name: notifications_integrity
hash: null
bundled: <NIX_PACKAGE>
dependencies: null
dylib: null
- name: producers_integrity
hash: null
bundled: ../../../target/wasm32-unknown-unknown/release/producers_integrity.wasm
dependencies: null
dylib: null
- name: tasks_integrity
hash: null
bundled: <NIX_PACKAGE>
dependencies: null
dylib: null
coordinator:
zomes:
- name: profiles
hash: null
bundled: <NIX_PACKAGE>
dependencies:
- name: profiles_integrity
dylib: null
- name: roles
hash: null
bundled: <NIX_PACKAGE>
dependencies:
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies: ~
dylib: ~
- name: roles_integrity
dylib: null
- name: file_storage
hash: null
bundled: <NIX_PACKAGE>
dependencies:
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies: ~
dylib: ~
- name: file_storage_integrity
dylib: null
- name: households
hash: null
bundled: ../../../target/wasm32-unknown-unknown/release/households.wasm
dependencies:
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies: ~
dylib: ~
- name: households_integrity
dylib: null
- name: notifications
hash: null
bundled: <NIX_PACKAGE>
dependencies:
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/households_integrity.wasm"
dependencies: ~
dylib: ~
- name: notifications_integrity
dylib: null
- name: producers
hash: null
bundled: ../../../target/wasm32-unknown-unknown/release/producers.wasm
dependencies:
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies: ~
dylib: ~
- name: producers_integrity
dylib: null
- name: tasks
hash: null
bundled: <NIX_PACKAGE>
dependencies:
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/producers_integrity.wasm"
dependencies: ~
dylib: ~
- name: tasks_integrity
dylib: null
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies: ~
dylib: ~
- name: orders_integrity
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/orders_integrity.wasm"
dependencies: ~
dylib: ~
coordinator:
zomes:
- name: profiles
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies:
- name: profiles_integrity
dylib: ~
- name: roles
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies:
- name: roles_integrity
dylib: ~
- name: file_storage
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies:
- name: file_storage_integrity
dylib: ~
- name: households
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/households.wasm"
dependencies:
- name: households_integrity
dylib: ~
- name: notifications
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies:
- name: notifications_integrity
dylib: ~
- name: producers
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/producers.wasm"
dependencies:
- name: producers_integrity
dylib: ~
- name: tasks
hash: ~
bundled: "<NIX_PACKAGE>"
dependencies:
- name: tasks_integrity
dylib: ~
- name: orders
hash: ~
bundled: "../../../target/wasm32-unknown-unknown/release/orders.wasm"
dependencies:
- name: orders_integrity
dylib: ~
24 changes: 24 additions & 0 deletions dnas/plenty/zomes/coordinator/orders/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "orders"
version = "0.0.1"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]
name = "orders"

[dependencies]
hdk = { workspace = true }

serde = { workspace = true }

orders_integrity = { workspace = true }


[dev-dependencies]
fixt = "0.3.1"
futures = { version = "0.3.1", default-features = false }
hdk = { workspace = true, features = ["encoding", "test_utils"] }
holochain = { workspace = true }
tokio = { version = "1.3", features = ["full"] }

32 changes: 32 additions & 0 deletions dnas/plenty/zomes/coordinator/orders/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use hdk::prelude::*;
use orders_integrity::*;


/// Called the first time a zome call is made to the cell containing this zome
#[hdk_extern]
pub fn init() -> ExternResult<InitCallbackResult> {
Ok(InitCallbackResult::Pass)
}

/// Don't modify this enum if you want the scaffolding tool to generate appropriate signals for your entries and links
#[derive(Serialize, Deserialize, Debug)]
#[serde(tag = "type")]
pub enum Signal {
}

/// Whenever an action is committed, we emit a signal to the UI elements to reactively update them
#[hdk_extern(infallible)]
pub fn post_commit(committed_actions: Vec<SignedActionHashed>) {
/// Don't modify this loop if you want the scaffolding tool to generate appropriate signals for your entries and links
for action in committed_actions {
if let Err(err) = signal_action(action) {
error!("Error signaling new action: {:?}", err);
}
}
}

/// Don't modify this function if you want the scaffolding tool to generate appropriate signals for your entries and links
fn signal_action(action: SignedActionHashed) -> ExternResult<()> {
Ok(())
}

5 changes: 5 additions & 0 deletions dnas/plenty/zomes/coordinator/orders/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use hdk::prelude::*;
use holochain::sweettest::*;

use orders_integrity::*;

55 changes: 55 additions & 0 deletions dnas/plenty/zomes/coordinator/orders/zome.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ inputs, ... }:

{
perSystem =
{ inputs'
, self'
, system
, ...
}: {
packages.orders = inputs.hc-infra.outputs.lib.rustZome {
workspacePath = inputs.self.outPath;
holochain = inputs'.holochain;
crateCargoToml = ./Cargo.toml;
cargoArtifacts =
inputs.hc-infra.outputs.lib.zomeCargoArtifacts { inherit system; };
};

# Test only this zome and its integrity in isolation
checks.orders= inputs.hc-infra.outputs.lib.sweettest {
workspacePath = inputs.self.outPath;
holochain = inputs'.holochain;
dna = (inputs.hc-infra.outputs.lib.dna {
dnaManifest = builtins.toFile "dna.yaml" ''
---
manifest_version: "1"
name: test_dna
integrity:
network_seed: ~
properties: ~
origin_time: 1709638576394039
zomes:
- name: orders_integrity
coordinator:
zomes:
- name: orders
hash: ~
dependencies:
- name: orders_integrity
dylib: ~
'';
zomes = {
orders_integrity = self'.packages.orders_integrity;
orders = packages.orders;
};
holochain = inputs'.holochain;
});
crateCargoToml = ./Cargo.toml;
cargoArtifacts = inputs.hc-infra.outputs.lib.holochainCargoArtifacts {
inherit system;
};
};

};
}

13 changes: 13 additions & 0 deletions dnas/plenty/zomes/integrity/orders/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "orders_integrity"
version = "0.0.1"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]
name = "orders_integrity"

[dependencies]
hdi = { workspace = true }

serde = { workspace = true }
Loading

0 comments on commit aba18fa

Please sign in to comment.