Created
June 17, 2015 14:55
-
-
Save benstr/5e7eb0127ea2855d0e68 to your computer and use it in GitHub Desktop.
user schema
This file contains hidden or 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
UserProfileSchema = new SimpleSchema({ | |
orgId : { | |
type: String, | |
regEx: /^[a-z0-9A-z .]{3,30}$/, | |
optional: true | |
}, | |
staffId : { | |
type: String, | |
regEx: /^[a-z0-9A-z .]{3,30}$/, | |
optional: true | |
}, | |
userStatus: { | |
type: Boolean, | |
label: 'Status' | |
} | |
}); | |
UserSchema = new SimpleSchema({ | |
username: { | |
type: String, | |
regEx: /^[a-z0-9A-Z_]{3,15}$/ | |
}, | |
emails: { | |
type: [Object], | |
label: 'Emails' | |
}, | |
"emails.$.address": { | |
type: String, | |
regEx: SimpleSchema.RegEx.Email | |
}, | |
"emails.$.verified": { | |
type: Boolean | |
}, | |
createdAt: { | |
type: Date | |
}, | |
profile: { | |
type: UserProfileSchema, | |
optional: true | |
}, | |
services: { | |
type: Object, | |
optional: true, | |
blackbox: true | |
}, | |
// Add `roles` to your schema if you use the meteor-roles package. | |
// Note that when using this package, you must also specify the | |
// `Roles.GLOBAL_GROUP` group whenever you add a user to a role. | |
// Roles.addUsersToRoles(userId, ["admin"], Roles.GLOBAL_GROUP); | |
// You can't mix and match adding with and without a group since | |
// you will fail validation in some cases. | |
roles: { | |
type: Object, | |
optional: true, | |
blackbox: true | |
} | |
}); | |
Meteor.users.attachSchema(UserSchema); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment