Starting for the first day of this week, I create various file versions for line items that required for the user to input only the important data to be processed. As these different line items are needed for the specific transfer commands where we discussed last week. Soon after creating, I also update for the relevant name for the services and the commands. Meanwhile, I also update for the validator to ensure only valid property is included. Then, I update the implementation for transfer services by replacing the replaceOne method with the suggested updateOne method. In the method, I also include the updateDefinition for the data updating for the transfer. After that, I test the updated code manually by calling APIs, to determine any potential errors may happen. After successfully testing, I then initialise the data by referencing the other files provided as suggested to use the factory data creation method. Also there some typo error on naming the commands folders, and I rename it with a more suitable names.
Moreover, I try to move the transfer and user logic from handler to service, as mentioned that the logic should be processed under services. I initially move the transfer logic, my approach is that using switch case to match the different commands to pass it to the related method. However, I realise that it may be over coding, so I discard this approach. I then create various task methods so that the command can just call the service method to process the input. After that, I also manually test them as well with API callings, and soon everything is success. Meanwhile, I also update for the user service, and soon I commit my changes and push them to my branch. Moreover, I continue on refining the transfer order services. I also implement a new method for item for transfer, and try to understand what had created and updated. Then I try to continue doing my tests where I just successfully create the success part only for create and update tests.
Furthermore, I start modifying the DO files by adding the suitable logic to create a new DO and the update along with the cancel. I try do this part by this week, where I try to read the manually create data from the collection. Then, I try to create a DO data, as creating will also update for the related transfer order with the quantity and also add the new transfer DO into the list. After creating, I then continue to do the cancel part. So, it can reset the quantity to the transfer order as well as remove the transfer DO form the lists. After these two are succeed, I then realise that, I should prioritise for the transfer order, I then continue on modifying the logic on transfer order. Mr. Peter mentioned that there are some amendment for the naming and also realised that I should complete the tests before proceed to the next part. Mr. Peter also advised that mock test is better that testing from the database.
Apart from that, I continue doing the transfer order testing by adding many possible testing for each commands. Fortunately, all the tests are pass as expected. Mr. Peter then reviewed my tests and suggested that some other tests that I missed. Meanwhile he also guided me on how to test for the new item status for each item. Besides that, I also update all possible testing suggested and passed as expected. Meanwhile, Mr. Peter also push with a new implementation of item status, so I uncommit back my work and stash the staged file in order to pull the new changes. After pulling, I review the changes and also Mr. Peter guide me on the new implementation and initially try for the the RTP. Soon, I try to understand the services and update for the method. However, something errors after updating the method of transfer logic, so I try to look through for the exception and determine it. Then, Mr. Peter reviewed my codes as well and also mentioned that there is unnecessary code updates. During the testing, Mr. Peter suggest to amend for a better transfer order design for the line item. He also found that I haven’t modify the naming where I supposed to do it. Then, after the little modification for the test there are some config error occurs. Soon, I push my works to my branch after some modification and will continue on next week.
Conclusion
In summary, the week is highly productive and focus on refining and optimising various components of the project. I restructure the transfer logic alongside creating and refining methods for transfer order. The rigorous testing and reviews help identify areas for improvement and ensure robust coverage.
