Closed mattgstevens closed 8 years ago
Made a commit where the validations returning bools and returning strings are separated into different functions. Now the functions returning error messages returns an Array of strings, so when users upload bad data they will get all errors at once, without having to fix one error and then retry to find their next error.
Also made some small fixes for incorrect validations and removed unused params from functions.
Let's not merge just yet - have some tests and documentation I wanna write
Just pushing my final changes in the branch we have been working on. I made a proposal of how the isValid module can work with many errors. So now, if someone submits a record containing erroneous contentId AND price, they will get 2 (or more) error messages.
Also, this version does not throw, instead always returns lists of strings. I wanted to do so because throwing is a side effect. It can be useful to combine with promise-flow, but it also means it can not be ran twice without dealing with the side effect.
Updated the README with curl instructions for how to publish a new content. That feature works totally on my machine.
If you are happy with the code let me know, and let me know errors I made. Much code has changed, but works pretty similarly.
So, now I think all your concerns have been fixed. A lot of great improvements :)
POST /content
to upload new content to Momona