Creating CRUD using CQRS Pattern (part 1)

This week marked the beginning of my opportunity to apply the knowledge that I gained from the courses that I learnt from the previous weeks. Mr. Peter gave me my first task: creating CRUD for an entity using CQRS pattern. However, before diving into the task at hand, it was necessary to set up the environment by launching the SandBox app, which Mr. Peter graciously guided me through. This included various debugging processes essential for successfully launching the system. First, I needed to create a database and import the existing tables into it. Then, cloned a git repository from an existing repository named Sandbox(which is the main solution used for trying out new features first before implementing it on a real application). There’s also another repo for context and modules under the main repository where this is the first I discover that there can be more repositories created under an existing git repository. 

Launching the Sandbox app took quite some time as there’s a bit of debugging needed which most of it was solved by Mr Peter. One of the issues that arose was due to my carelessness in setting up the credentials of the API. I unwittingly included a space in a word that was not supposed to have one, causing the issue of invalid authentication. From this experience, I learned a valuable lesson that even the slightest error, such as a space, can cause significant time wastage during debugging. As a result, I now realize the importance of paying attention to the smallest of details. 

Throughout the week when I’m completely lost on what to and what should I debug, I instead just go through the codes from an existing project to guide me through creating the CRUD for an entity while also watching the courses again to have deeper understanding on how the code works. Moreover, I learned about a new git method known as git stash, which allows you to temporarily shelve changes you’ve made to your working copy so that you can work on something else and then re-apply them later. When it came time to create the CRUD for the entity, I initially created all folders and pages at once for creating, updating, deleting, and getting information. However, Mr. Peter advised that it would be best to create them one by one and test each unit immediately to ensure the stability of the code before moving on to the next feature.

Overall, I am grateful for the opportunity to learn from Mr. Peter this week. While I feel that I did not make significant progress personally, I am eager to continue learning and growing. I look forward to the challenges that lie ahead, particularly in creating the CRUD for an entity next week.

Validating and Granting Access Rights

For new context and module added last week, I imitate some tests from example code provided and add few new tests. I also create some class to build dummy database to ease unit/integration testing. After going through some tests, I found out error when deleting data. Upon deletion, only data from 1 table is deleted, delete function suppose to remove few linked data across the database.

Before I look through into bugs of deletion, I make new implementation to validate user input in required textbox. If textbox is empty for non-nullable textbox, I create validation for system to prompt warning dialog to notify user. such as below :
if (string.IsNullOrEmpty(Wrapper.Variable))
{
_dialogService.ShowDialog( n, p, r );
return false;
}


Besides, Admin role is added to alter availability of buttons in system. I was been told to make initialization of adminUser as variable. Variable adminUser is set to bool = false initially, and will be implement in feature implementation. If bool adminUser = true, user is an admin user; bool adminUser = false, user is normal user. The reason of adding in admin role is to restrict some functionality of normal user. For normal user, the system will hinder user from edit or delete data in the system. In significant, admin user will be granted privilege to edit and delete.