This week, I will continue on completing the compare logic for synchronisation and the mock testings. I attempt to call the API from the retail to retrieve user details but encounter some issues. Initially, I try inserting data into the retail database and executing actions through Swagger, but the API calls consistently failed. Meanwhile, I also have no clue about how can I compare the logic, I consulted with Mr. Peter about it, he then introduced me to Postman to test API calls. He firstly guided me on calling the warehouse database to retrieve user details that we created previous week. Despite this, there were errors fetching user details, Mr. Peter decide to address these issues later that evening.
Moreover, Mr. Peter left a message of instructions for using Postman to call APIs and guided me further on API calls through Postman. After manually syncing and clicking “continue” to execute the API calls, I could retrieve the user details for both lists and specific details by ID. Following his instructions and using breakpoints, I understand how the code execute step by step. I then create a new command and handler, “SyncUser,” but encounter errors with API calls from the retail database as well. I try to debug with breakpoints but couldn’t locate the issue.
Besides that, I continue developing the compare logic, created service and controller to distinguish different function calls from user query of retail. I add two controllers to retrieve user lists and specific usernames by user ID from the warehouse. However, API calls from retail still face errors. My colleague and I try in troubleshooting but couldn’t identify the problem, so I consult Mr. Peter again. He then detected a connection error with the PostgreSQL database and guided me on debugging methods like F10 and F11 for stepping through code. Together, we identified several issues such as typos, incorrect password and capitalisation errors. After resolving these and setting PublishAot library to false, we achieved a successful connection.
Apart from that, I face challenges creating the sync command and handler. I initially try to store each call detail into a file or in a table database, and fetch the retail data and compare them foreach. But then I find out it was unnecessary, as it was only for synchronisation. With guidance from my colleague, I restructure the compare logic by deleting and redoing the sync command and handler. I try Meanwhile, my friends also encountered similar API call issues, we discussed together and found out it also a connection error. In addition, Mr. Peter advised me to keep the sync task simple and also guided me on mock testing.
Additionally, I creat a new sync command and handler, I successfully synchronise user data and implement the compare logic. I’m grateful for my colleague and Mr. Peter guidance and patience on teaching me. Mr. Peter further assisted me with mock tests and emphasised the importance of documentation for code consistency. He then recommended reading Clean Code to deepen my understanding and improve my skills.
Conclusion
This week, I focus on troubleshooting API call and connection issues between the warehouse and retail databases, working through synchronisation and compare logic for user data. With guidance from Mr. Peter and support from colleagues, I improve my debugging skills, use tools like Postman and implement effective mock testing.
