Refactoring the Item API

I began improving the item API code this week by giving the item a new functionality that allows you to filter the item list based on a characteristic of the item. In its initial iteration, this feature consists of querying the object only by using its name. It will query the objects that, based on the filter, have the same name. I add tests to the testing class to test the API after I’ve created it. I discovered that the feature was operational. Next, I removed the unnecessary details that won’t be shown when querying the item list or querying the item list by details. This details will only be shown in the item detail page. When removing these details, I found out that I only need to remove the details shown in the dto class of the feature, since the dto class is the place that will show which details will be passed for a particular feature. 

I kept refactoring the query item list by API by adding more details to be filtered after eliminating the superfluous details that wouldn’t be displayed in the query item list feature. I have included details like model, uom, brand, and category. I discovered that certain categories might have a parent category, while other categories might not, when I added the category to the details to be filtered. As an illustration, Category B can have a parent category that is Category A. Therefore, I must include the items that belong to Category B when I want to filter the item list that contains Category A. After doing some research on the internet, I managed to find the solution that will query the item list based on the category and its child category.

After I had completed all of the item API and tests, Mr. Peter advised me to create an API that can produce random items based on the number entered by the user. As an illustration, if the user input 1000, 1000 items will be created at random. Front-end testing can be made easier using these API. In addition, he recommended that I include the categories API.

In addition, he has asked me to create a branch from the item feature branch as he has completed the sales order API. The most recent code from sir’s order feature branch will also be pulled into this branch. I will then use the Windows PowerShell to produce the codegen code. I builded up my project and updated it for server after producing the codegen code. Finally, I keep rebuilding the docker file and using Postman to test the updated API. I discovered that every API functioned well.

Leave a Reply