Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Schema = {};
- Schema.UserProfile = new SimpleSchema({
- //LOTS OF FIELDS WORKING FINE
- });
- Schema.User = new SimpleSchema({
- username: {
- type: String,
- optional: true
- },
- emails: {
- type: Array,
- },
- "emails.$": {
- type: Object
- },
- "emails.$.address": {
- type: String,
- regEx: SimpleSchema.RegEx.Email
- },
- "emails.$.verified": {
- type: Boolean
- },
- createdAt: {
- type: Date
- },
- profile: {
- type: Schema.UserProfile,
- label: "Perfil",
- optional: false
- },
- services: {
- type: Object,
- blackbox: true
- },
- "services.$": {
- type: Object,
- blackbox: true
- },
- "services.$.password": { // IS IT RIGHT?
- type: String,
- label: "Senha",
- min: 8
- },
- roles: {
- type: String,
- optional: true
- }
- });
- Meteor.users.attachSchema(Schema.User);
- let company = {};
- company = {
- email: $('#email').val(),
- password: $('#password').val(),
- roles: 'company',
- profile: companyProfile
- }
- Meteor.call('saveUser', company, function(error, result) {
- if ( error ) {
- console.log(error);
- }
- }
- Meteor.methods({
- saveUser: function(data) {
- return Accounts.createUser(data);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement