Open wsdOgawa opened 2 years ago
Looks like we were pretty easily able to get rid of messages
in https://github.com/WebServiceDevelopment/PrivateInvoice/pull/52/commits/cdccd91ac32e73beb1927083ba920659481a5c2d. We might need to put some functionality back later, but the end-points themselves should only be handled by the presentation end-points.
I this case session
can probably be divided into Organization
, Members
and Authentication
. Contacts
, and Tray
can probably be their own modules. The next issue is settings
, which is probably going to use a combination of Organization
and Members
modules.
And then there are the Wallet
related functions like creating a new mnemonic, generating a key pair, or address, signing presentations, signing credentials, verifying presentations, which will probably called from the other modules.
It's hard to get an idea of exactly how everything will fall into place. It seems like the easiest option is to start simple. I think we can look into Tray
or Contacts
, see how that works. And then start tackling some of these other ones.
Under the /tray
route, we have the following end points.
/getCountOfInvoice
/getFolderOfInvoice
/getTotalOfInvoice
And then the same for Archive
and Draft
. I think this means that we can effectively move these functions from the route handler to a new module, move all of the Tray
end points into a single index file. And then update the end pointer handlers to only pass arguments into the module functions.
Two notes that I should mention here. The first is that we should probably avoid doing a deep dive on anything too soon. The first approach should be to get everything into folders and make sure we're not calling database or transactions from any end point handlers.
The next step from there is to look at each module and see what needs to be grouped, simplified or renamed to simplify the application.
The other note to make at this point is that that we probably dont need to bundle this into one massive PR. We can multiple small PR's to address incremental changes.
Before jumping into changing code, I took the time to write two blog posts about the changes that need to be made.
The knee-jerk reaction would be to start making a lot of big changes. We can start to make preparations for larger moves. But we should be focusing on the smaller changes that will continue to make improvements until we need to address the larger ones.
The two easiest places to start would be credentials and tray.
This is a follow up to https://github.com/WebServiceDevelopment/PrivateInvoice/issues/48. Now that we have a narrowly defined list of end points we can start to address how modules will be handled within these end points.
Right now the low hanging fruit is to get rid of
message
. The next will be to identify how the end points can be split up into modules.