Open asclines opened 7 years ago
@asclines Would this mainly be used to validate input?
Yes, primarily validation
I like it. This would let me keep the client-side validation in sync with the server-side more easily
I'm considering keeping the schema just in server code. Do you think it would be better to have the whole app use it?
If you're going to be using them in the server code, then I don't think it'd be necessary.
Is this issue updated? If it is, how do we plan on splitting it up into micros if the models are the same?
Currently, I plan on dividing things into micros along schema lines. Each micro should only touch its own schema. If the micros need to access some functionality on another schema, we'll have to provide functionality through that schema's micro-based API.
We could still consider moving schemas to common if they help with data validation. However, I haven't done any research on whether Mongoose can be used on the front-end.
It should be relatively easy to move Report and Event models to Common as both sides use the same data, but users may be a little different given that after login, the front end shouldn't retain a password.
In any event, having the models in Common allows for easy validation and consistency of data objects without duplicate code.
@NilsG-S your thoughts, as always, are much appreciated.