Skip to content

Instantly share code, notes, and snippets.

@steve-ross steve-ross/users.js
Created Dec 21, 2017

Embed
What would you like to do?
Simple Schema Example for a user
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
You can’t perform that action at this time.