scorelab / Stackle

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.
Apache License 2.0
104 stars 146 forks source link

Validation can be improved #153

Closed kartikpandey2 closed 5 years ago

kartikpandey2 commented 5 years ago

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 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.

{
  title: null,
  description: null,
  repository: null,
  org_name: null,
  tags: null,
  linkIssue: null,
  date: null,
}

Possible fix

Add check for Object keys value must not be null.