While I would prefer to not have to do a deep dive on organizing the modules in Private Invoice, the tray module is one that I made earlier on the process. This means that it was at a point before I was able to learn from lessons later on in the product cycle. While it may take some time to apply those lessons to this module, it's worth it to break it apart and then apply that consistency.
Right now we have nine end-points that query the invoice tray.
/getCountOfInvoice
/getFolderOfInvoice
/getTotalOfInvoice
/getCountOfArchive
/getFolderOfArchive
/getTotalOfArchive
/getCountOfDraft
/getFolderOfDraft
/getTotalOfDraft
While I'm tempted to jump ahead of myself and move all of these into one /tray
end point, that might be taking on too much at once. Effectively we have a table of getCount
, getTotal
, getFolder
and invoice
, archive
, draft
. And the easier place to start is grouping the latter, as admittedly I don't remember what the difference between the first three is. But if we simplify the one aspect of this, it will put us in a better position to address the second aspect.
This means that we're looking at a checklist that looks like the following:
- Reduce the number of end points to
/getCount
,/getTotal
, and/getFolder
with query parameters - Update the postman collection
- Update the OpenAPI documentation
- Update the application
- Test the application
Since writing the first part of this post, I have gone through and updated the code for the tray-related end-points. It's definitely a good thing that I didn't try to do too much at one time. I simplified a lot of code that will be easier to read on another pass. And I don't think I would have been able to do as much as I originally wanted in one go.
As of this point, we've managed to update the end points, update the postman collection, and the next step is to update the OpenAPI documentation. And looking at the documentation, we find that we can further simplify the endpoints into /count
, /total
and /folder
.
Another issue that I found when looking at the documentation is that the flag for archived
likely isn't needed. The only time when this is searched is when the specific folder for complete
and trash
are queried. But rather than doing that right now, we can come back on another pass when we break down and analyze the database.
The actual implementation of the rewrite seemed to work. And it has been addressed in these two pull requests:
- https://github.com/WebServiceDevelopment/PrivateInvoice/pull/59
- https://github.com/WebServiceDevelopment/PrivateInvoice/pull/61
The next step will be to identify and address the next module that needs to be sorted.