Created
December 21, 2017 19:12
-
-
Save steve-ross/e3a7c9621c0ca09dbabbde7a3a121405 to your computer and use it in GitHub Desktop.
Simple Schema Example for a user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Validator } from '../../imports/schemas/validators'; | |
Schemas.UserProfile = new SimpleSchema({ | |
name : { | |
type : String, | |
autoform: { | |
label: 'Full Name' | |
}, | |
custom: Validator.twoOrMoreWords | |
}, | |
phone : { | |
type : String, | |
regEx: SimpleSchema.RegEx.Phone, | |
autoform: { | |
type: 'tel', | |
label: 'Mobile' | |
} | |
}, | |
alt_phone : { | |
type : String, | |
optional: true, | |
regEx: SimpleSchema.RegEx.Phone, | |
autoform: { | |
label: 'Alternate', | |
type: 'tel' | |
} | |
}, | |
address : { | |
type : String, | |
}, | |
unit_or_apt : { | |
type : String, | |
optional: true, | |
autoform: { | |
label: 'Unit / Apt' | |
} | |
}, | |
city : { | |
type : String, | |
}, | |
state : { | |
type : String, | |
allowedValues : StatesAbbreviations.values, | |
autoform: { | |
type: 'select', | |
options: StatesAbbreviations.options | |
} | |
}, | |
postcode : { | |
type : String, | |
regEx : SimpleSchema.RegEx.ZipCode, | |
autoform: { | |
label: 'Zip' | |
} | |
}, | |
notes: { // deprecated: migration 15 moves these up to the user doc for security | |
type: String, | |
optional: true | |
}, | |
office: { | |
type: String, | |
allowedValues: ['Somewhere', 'Anywhere', 'Nowhere'], | |
optional: true, | |
autoform: { | |
type: 'select' | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment