Boss Machine - Code review

Here is my solution to the Boss Machine project:
Boss Machine Project Github

Like a lot of people I had initial issues with react/redux dependencies. I was able to find the solution for this in other posts about the topic so I will not go into it here.

Initially I struggled with this project but a lot of things became much clearer by going into the db.js file and really reading everything in there and understanding what was going on.

Once I had grasped this it simplified the routes a lot, as the db functions incorporate a lot of the error checking that has been hard coded into the routes until this point. You dont need to extract values and test them. Generally passing in objects and handling the results is all that is required. Doing so I ended up with something very similar to the project solution.

One major difference is that within the db.js file, any fuction that peforms a “isValid” check can throw an error. This is done on any minion, work or idea that is passed into it (any created meetings should be automatically valid). Handling this error gracefully with a try/catch block and an error-handler will handle any input problems for you. This only applies to update/put or create/post requests.

This seem’s to be the most sensible and intended way to handle this. Thoughts?

Then one minor detail is that all the database functions take as a first argument a type. minions/ideas/meetings/work. The solution has these hard coded as strings into the functions. I feel this is bad practise. And instead used a constant TYPE. Doing so makes minions and ideas routes practically identical. The programmer in me therefor sees this as ani-DRY and wants to make them into one file that takes a type in. I have no real idea if this is a good idea or not or how you would therefor handle the work section at the bottom of minions if you did. Or at least I feel I have spent too much time tinkering with this already and am ready to move on.