Generate 1 million data
On the first day, I tried to generate 1 million data records for each page on the system. Since this process would take several hours, I asked my colleagues to help by generating the data on their computers and accessing my IP address. After generating all the datasets, I performed some performance testing on API queries for item or user details and created new data after reaching 1,000,000 records. By the end of the tests, all functionalities worked smoothly, ensuring the system could remain operational for many years.
Generate invoice pdf template
While the data was being generated, I researched how to build a PDF template for invoices using HTML and JavaScript. I explored several components like html2pdf, react-pdf-html, and others, but none of them worked for my needs. Some required API calls to generate the PDFs, which would incur extra costs, and others weren’t compatible with Next.js. Eventually, I found a component called PDFMake that met all my requirements. It allowed me to customize the template, and once the PDF was generated, it provided a temporary URL. This feature is very useful when generating large numbers of PDFs, as it prevents storage overload by not saving them to local files. I also added an iframe component to preview the PDF and a print function, which allowed users to print the document without navigating to another tab. However, while coding according to Mr. Peter’s template, I ran into an issue: the component couldn’t import images or draw outlines for certain information. Mr. Peter then advised me to stop working on this task, as he had found a better solution for generating the PDFs.
Syncing users and items data
After completing the previous task, I was assigned a new one: syncing data from MongoDB. My first task was to sync the user data. I called the sync API, which synchronized the data from the retail system with the Mongo database, integrating data from different systems. I then tried to separate the data views: one for the retail system only and one for all users, including those from the other system. However, I discovered that I couldn’t view the details for the “All Users” page. I may need to create a separate API to search for specific data details. Afterward, I worked on syncing item data. Mr. Peter asked me to use the SignalR component to track the progress of the data syncing. This was because when calling the sync API function, there was no way to monitor its progress. By using SignalR, we could connect to the API and receive a progress count, which we could then display as a progress bar.
