From b405e3de436986e6fbe96da13bf55d8c366ed56b Mon Sep 17 00:00:00 2001
From: falyhery <32633685+falyhery@users.noreply.github.com>
Date: Wed, 12 Aug 2020 16:21:47 +0200
Subject: [PATCH] Update lib.rs
- Implement section entry definitions
- Implement section CRUD methods
- Implement content entry definitions
- Implement content CRUD methods
---
dna/course/zomes/courses/code/src/lib.rs | 83 ++++++++++++++++++++++--
1 file changed, 77 insertions(+), 6 deletions(-)
diff --git a/dna/course/zomes/courses/code/src/lib.rs b/dna/course/zomes/courses/code/src/lib.rs
index 541ce29..620b73a 100644
--- a/dna/course/zomes/courses/code/src/lib.rs
+++ b/dna/course/zomes/courses/code/src/lib.rs
@@ -102,11 +102,82 @@ mod courses {
course::handlers::get_my_enrolled_courses()
}
- // Section
- // TODO: implement section entry definitions
- // TODO: implement section CRUD methods
+ // ====================== Section definitions
+ #[entry_def]
+ fn section_anchor_definition() -> ValidatingEntryType {
+ section::anchor::section_anchor_def()
+ }
+
+ #[entry_def]
+ fn section_entry_definition() -> ValidatingEntryType {
+ section::entry::section_entry_def()
+ }
+
+ #[zome_fn("hc_public")]
+ fn create_section(title: String, timestamp: u64) -> ZomeApiResult
{
+ section::handlers::create(title, timestamp)
+ }
+
+ #[zome_fn("hc_public")]
+ fn get_latest_section_entry(
+ section_anchor_address: Address,
+ ) -> ZomeApiResult