fixtures.js
898 Bytes
import { Meteor } from 'meteor/meteor';
import { Roles } from 'meteor/alanning:roles';
import { Accounts } from 'meteor/accounts-base';
import { Orgs } from '/imports/collections/orgs/index';
if (!Meteor.isProduction) {
const users = [{
email: 'admin@admin.com',
password: 'password',
profile: {
name: { first: 'Carl', last: 'Winslow' },
},
roles: ['admin'],
}];
users.forEach(({ email, password, profile, roles }) => {
const userExists = Meteor.users.findOne({ 'emails.address': email });
if (!userExists) {
const userId = Accounts.createUser({ email, password, profile });
Roles.addUsersToRoles(userId, roles);
const org = [{
name: 'yd',
slug: 'yd',
"users.userId": userId
}];
Orgs.inser
}
});
}