Leap (Learning Pathways) is a peer-to-peer Udemy inspired learning application built on Holochain.
This particular version of leap is built for the community-ran Holochain DevCamp 7.
See Homework for guidelines related to DevCamp homework assignments.
There are multiple parts in this repository where the code is located:
dna/course/zomes/courses/code
contains Rust backend codedna/course/test
contains backend integration tests
You can either open these directories manually or you can use leap.code-workspace
file to open the Microsoft Visual Studio Code workspace that would:
- automatically open directories with zome code and integration tests;
- prompt you to install the recommended extensions if they're not already present;
- configure code formatting on each save for Rust files.
To open the workspace file, you can use two ways:
- open Microsoft Visual Studio Code separately and then go to File > Open Workspace and select the
leap.code-workspace
file in the root of this repo. This would run Visual Studio outside of Holochain shell and it will be loading system level Rust tools - start Holochain shell in the root of this repository and inside it run
code .
. This will run Visual Studio inside the Holochain shell and it will be loading Rust tools provided by it.
This is applicable for users of Microsoft Visual Studio Code.
There's a great extension rust-analyzer that simplifies working with the code in many different ways. It requires build files to be present to work properly so we suggest to run cargo build
in the dna/course/zomes/courses/code/
directory to obtain them.
NOTE: if you're running on MacOS this command wouldn't succeed with a linker error due to reasons that we can't explain in detail here. Don't worry about it though because you would still able to build & package your application by running hc package
from the dna/course
directory.
All code building needs to be done in a Holochain shell which you can start by running from the root of this repo:
nix-shell
NOTE: it is important to run nix-shell
specifically from this repository root because it contains config.nix
and default.nix
files that define a fixed environment version. Using holochain.love
shell would most likely lead to a version mismatch and potential errors.
If you don't have it installed, please refer to the official doc.
This will build Rust project for every zome in DNA (we have just one) and then package it all into a Holochain format.
- go to
dna/course
- run
hc package
This will just build a Rust project using Rust toolchain.
- go to a zome directory
dna/course/zomes/courses/code
- run
cargo build
NOTE: this command would fail with a linker error when running on MacOS. This is a known and expected issue and it just means you should be building using hc package
command.
To run the integration tests:
- From the repository root run
nix-shell
- Start sim2h server by executing:
sim2h_server
. It won't print anything and will just block your terminal -- that's ok and what is expected - Open another terminal and run
nix-shell
- Navigate to the
dna/course
folder - Run the
hc test
If you want to have less verbose output for the testing run it like TRYORAMA_LOG_LEVEL=error hc test
. NOTE: when running with this option, your calls to hdk::debug
in the backend code won't be displayed.
If you want to skip building the hApp before the tests are ran (for example, you're sure it's already the version you want to use) run it like this: hc test -s
If you just want to quickly test some ideas and interact with your backend API, we recommend you to use the Insomnia tool. You can import the configuration for it from the file insomnia_learning_pathways.json
in this repository root: it already defines API calls with arguments and you don't have to do that manually.
- A user should be able to view 3 tabs: enrolled courses, my courses and all courses
- In enrolled courses, a user should be able to see all the courses in which the user is enrolled
- In my courses, a user should be able to see all the courses in which the user is the teacher, with a "Create course" button and a "Delete course" button, and an Edit button inlined
- In all courses, a user should be able to see all courses with an "Enrol" button if the user is not its teacher
- The teacher for a course should be able to create/edit/delete a section in the course from each course view inside "My courses" tab
- The teacher for a course should be able to create/edit/delete contents for each section from the section's view inside "My courses" tab
- The teacher for a course should be able to see all the students for that course