Exemplo n.º 1
0
func hasDefinationValidDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"definition-content": rules["definition-content"],
		"definition-source":  rules["source"],
	}
	return wisply.Validate(details, rules)
}
Exemplo n.º 2
0
func isValidLogin(rawData map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"email":    rules["email"],
		"password": rules["password"],
	}
	return wisply.Validate(rawData, rules)
}
Exemplo n.º 3
0
func isValidID(id string) *validity.ValidationResults {
	data := make(map[string]interface{})
	data["id"] = id
	rules := validity.ValidationRules{
		"id": rules["id"],
	}
	return wisply.Validate(data, rules)
}
Exemplo n.º 4
0
func isValidEmail(email string) *validity.ValidationResults {
	data := make(map[string]interface{})
	data["email"] = email
	rules := validity.ValidationRules{
		"email": rules["email"],
	}
	return wisply.Validate(data, rules)
}
Exemplo n.º 5
0
func isValidAdminType(email string) *validity.ValidationResults {
	data := make(map[string]interface{})
	data["email"] = email
	rules := validity.ValidationRules{
		"administrator": rules["administrator"],
	}
	return wisply.Validate(data, rules)
}
Exemplo n.º 6
0
func isValidName(name string) *validity.ValidationResults {
	rawData := make(map[string]interface{})
	rawData["name"] = name
	rules := validity.ValidationRules{
		"name": rules["name"],
	}
	return wisply.Validate(rawData, rules)
}
Exemplo n.º 7
0
func isValidID(ID string) *validity.ValidationResults {
	data := make(map[string]interface{})
	data["id"] = ID
	rules := validity.ValidationRules{
		"id": rules["id"],
	}
	return adapter.Validate(data, rules)
}
Exemplo n.º 8
0
func isValidURL(URL string) *validity.ValidationResults {
	data := make(map[string]interface{})
	data["url"] = URL
	rules := validity.ValidationRules{
		"url": rules["url"],
	}
	return adapter.Validate(data, rules)
}
Exemplo n.º 9
0
func hasKAValidDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"ka-content": rules["ka-content"],
		"ka-source":  rules["source"],
		"ka-code":    rules["ka-code"],
		"ka-title":   rules["ka-title"],
	}
	return wisply.Validate(details, rules)
}
Exemplo n.º 10
0
func hasValidProgramModifyDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"program-title":     rules["program-title"],
		"program-code":      rules["program-code"],
		"program-ucas-code": rules["program-ucas-code"],
		"program-level":     rules["program-level"],
	}
	return adapter.Validate(details, rules)
}
Exemplo n.º 11
0
func hasValidModuleModifyDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"module-title":   rules["program-title"],
		"module-code":    rules["program-code"],
		"module-credits": rules["module-credits"],
		"module-year":    rules["module-year"],
	}
	return adapter.Validate(details, rules)
}
Exemplo n.º 12
0
func isValidDescription(description string) bool {
	rules := validity.ValidationRules{
		"description": rules["description"],
	}
	rawData := make(map[string]interface{})
	rawData["description"] = description

	return wisply.Validate(rawData, rules).IsValid
}
Exemplo n.º 13
0
func hasValidInsertDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"name":        rules["name"],
		"url":         rules["url"],
		"description": rules["description"],
		"institution": rules["institution"],
		"category":    rules["category"],
		"public-url":  rules["url"],
	}
	return adapter.Validate(details, rules)
}
Exemplo n.º 14
0
func hasValidInstitutionModifyDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"name":        rules["name"],
		"description": rules["description"],
		"institution": rules["institution"],
		"logoURL":     rules["url"],
		"wikiURL":     rules["url"],
		"wikiID":      rules["wikiID"],
	}
	return adapter.Validate(details, rules)
}
Exemplo n.º 15
0
func areValidLimits(min, max string) bool {
	rules := validity.ValidationRules{
		"min": rules["limit-min"],
		"max": rules["limit-max"],
	}
	result := wisply.Validate(map[string]interface{}{
		"min": min,
		"max": max,
	}, rules)

	return result.IsValid
}
Exemplo n.º 16
0
func areValidSubjectDetails(details map[string]interface{}) *validity.ValidationResults {
	rules := validity.ValidationRules{
		"name": rules["name"],
	}
	return wisply.Validate(details, rules)
}