I’m still working on debugging the item API that needs to be connected to the MongoDB server this week. Mr. Peter discovered that my code had a number of issues. First off, I have the MongoDB server that will be used for testing incorrectly identified. I just need to connect to the local MongoDB server, construct the necessary databases, and collections within it since I need to test if the item API is functioning or not. I don’t have to establish a connection with the actual MongoDB server that houses the actual data and item metadata.
Next, Mr. Peter also realized that there is another problem in my code, which is I put the server details and login credentials when committing my work and push my work into the working branch. This is dangerous as other people may steal the server details and login credentials by looking through our codebase. So, Mr. Peter has informed me to use the git command of “git reset HEAD~1” to reset or revert back my commit and “git push origin branch -f” to delete and remove all the problems that I have made in my branch. After removing the file that includes the server details as well as the login credentials, I tried to force commit these changes and I realized that the error that I made in my working branch has been deleted.
Once the connection issues with the MongoDB server are resolved, I begin working on the item’s first feature: using pagination to query the item list based on the item name. Firstly, I tried to add an item class inside the core project that includes the details of the item, for example the id, name, others. Next, I utilized the CQRS design and put the feature of query item list by search name with pagination inside the query folder of the item. I also added mapping between the item and dto class to make sure that the data passed to the dto is correct.
In addition, I made an item controller class that will call the item’s API method inside the API project. In addition, I verified that the API test was successfully completed by testing the item controller within the API test project. Following that, I produced the query item list and details based on the item feature. Additionally, I kept adding tests for these two features, and I discovered that they also functioned properly. I’ll keep refining the item API code next week.
