Example #1
0
func (r *Report) Validate(col *bongo.Collection) []error {
	_, err := valid.ValidateStruct(r)
	errs := util.ConvertGovalidatorErrors(err)
	if r.Type != REQUEST && r.Type != COMPLAIN {
		errs = append(errs, errors.New("Type: invalid type of report"))
	}
	return errs
}
Example #2
0
func (u *User) Validate(col *bongo.Collection) []error {
	_, errs := valid.ValidateStruct(u)
	return util.ConvertGovalidatorErrors(errs)
}