Stackle is an web communication portal aimed at providing Open Source organizations a platform to have discussions on their github projects and their issues. It provides Github intergration which allows adminstrator of an organization to create a forum thread for the particualr organization. Users signing in is able to view forums of the organizations they contribute to and engage in the forum discussions.
In file validator.js some validation function can be improved.
Presently it only checks if a particular key is present in sent input irrespective of key value. Following input object will also pass the validation function ideally which should not. It works now as required validation is set on mongoose schema. But validation on mongoose schema only works before save. So if in future project needs to reuse this validation function for update route then this will not work. So It's better to have check for Object keys value not equal to null.
Type of issue:
Short description on the issue
In file validator.js some validation function can be improved. Presently it only checks if a particular key is present in sent input irrespective of key value. Following input object will also pass the validation function ideally which should not. It works now as
required
validation is set on mongoose schema. But validation on mongoose schema only works beforesave
. So if in future project needs to reuse this validation function for update route then this will not work. So It's better to have check forObject keys value not equal to null
.Possible fix
Add check for
Object keys value
must not be null.