Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

## Improvements and Fixes #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

FarzeenKist
Copy link

Fixes and Improvements

  1. Implemented input validations across multiple functions in the canister to ensure that the input data from the payload does not contain empty or invalid values
  2. Implemented an if statement to check whether a supplier exists before executing the rest of the code for multiple query functions
  3. Users could create and update orders with invalid client_ids and supplier_ids. I have gone ahead and implemented checks to make sure that these ids belong to existing clients/suppliers.
  4. The _update_ids function didn't properly save the changes to the respective storage, so I've gone ahead and fixed that.
  5. There was a bug in the update_order function where the payload.is_complete could be set to true to force multiple executions of the _update_ids function which would result in duplicated order_ids being pushed to the client and supplier. I've gone ahead and modified the code to not modify the is_complete field to ensure that issues like this no longer occur. Furthermore, I've also moved the logic of the _update_ids into the complete_order function and implemented an additional check on the is_complete value to ensure that the order_id can only be pushed once to the client and supplier.
  6. The checks mentioned in point 3 also prevent the unwrap methods used in the _update_ids function as the complete_order function already checks whether the client and supplier exist earlier on in the code.

Copy link
Owner

@Collins-Ruto Collins-Ruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the improvements made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants