Skip to content

Ability to define constraint profiles #37

@lmajano

Description

@lmajano

INtroduce a new key called this.constraintProfiles which is a struct of arrays/lists. Each key is the name of the profile and it's value can be an array or list of fields. This is useful to define all global constraints but actually validate using a profile only.

this.constraintProfiles = {
	new = [ "fname", "lname", "email", "password" ],
	update = "fname,lname,email",
	passUpdate = "password,confirmpassword"
}

Then when calling validation you use the profiles argument

var results = validateModel( target=model, profiles="update" )

Or you can pass multiple profiles

var results = validateModel( target=model, profiles="update,passUpdate" )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions