Submissions
I use the current module as a template where I made it more featuring a more modular approach, error handling improvements, and an enhanced storage mechanism using a custom data structure for efficient message management. Also add a test file to run the tests and utilise all the features of the contract
FEEDBACK
### Secret Diary App **Project Summary:** This project lets you keep your personal messages private by encrypting them with a secret key, ensuring that only you can read them. It's like having a digital diary with a lock and key to protect your thoughts and memories on the ICP blockchain.
#Hello OT41K! I hope this message finds you well This enhancement aims to provide users with more control over their messages by enabling updates. The improvements in error handling contribute to a more resilient and user-friendly experience.
##Changes Made:
###New Feature: Update Message Added a new function update_message to allow users with the "admin" role to update existing messages.
###Improved do_insert Function: Enhanced the do_insert function with error handling, returning a Result<(), Error> to handle potential insertion failures. This ensures more robust and reliable data insertion.
###Access Control for Updating Messages: Implemented access control checks in the update_message function to ensure that only users with the "admin" role and the correct secret key can update messages.
###New Error Variant: InsertFailed Introduced a new error variant InsertFailed to handle cases where the insertion into the storage fails.
###How to Test: Verify the successful addition of the update functionality by using the new update_message method. Test the improved error handling by intentionally causing insertion failures and confirming that the appropriate error, InsertFailed, is returned.
ICP Quiz System This is an ICP Quiz system where users can create quizzes with multiple options, update, delete, get quizzes, retrieve all quizzes, and answer quizzes based on the options given.
Great work and idea here are the some changes I wanna Share
get_quiz_count
Functionget_quiz_count
in the ic_cdk::query
namespace.STORAGE
map.get_all_quiz
Functionget_all_quiz
function to directly collect values from the STORAGE
map using the values()
iterator method.get_quiz
Functionget_quiz
function to use Option::ok_or_else
for improved error handling.do_insert
FunctionEntry
API for HashMap to simplify the insertion logic.create_quiz
Functionunwrap
method to unwrap_or_else
for safer error handling during id incrementation.do_insert
call by using quiz.clone_from
.Quiz
Structnew
in the Quiz
struct for simplified creation of quizzes with default values for answers.Feel free to test the new features and improvements and provide feedback. Contributions and suggestions are always welcome!
Dacade je platforma s otvorenim kodom i stvorena je u suradnji s višestrukim suradnicima. Posjetite repozitorij kako biste počeli doprinositi.