本文整理汇总了TypeScript中meteor/meteor.Meteor.users.attachSchema方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Meteor.users.attachSchema方法的具体用法?TypeScript Meteor.users.attachSchema怎么用?TypeScript Meteor.users.attachSchema使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类meteor/meteor.Meteor.users
的用法示例。
在下文中一共展示了Meteor.users.attachSchema方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addTestUser
roles: {
type: [String],
optional: true
},
// In order to avoid an 'Exception in setInterval callback' from Meteor
heartbeat: {
type: Date,
optional: true
},
presence: {
type: String,
optional: true
}
});
Meteor.users.attachSchema(Schema.User);
function addTestUser(username:string, email:string, role:string) {
let existsUser:any = Accounts.findUserByEmail(email) ? true : false;
if (existsUser) {
Meteor.users.remove({_id: existsUser._id});
}
const password = "1234";
log.info("Created Username:" + username + ", email: " + email +", password:" + password + ", role:" + role );
var user = Accounts.createUser({username: username, email: email, password: password});
Roles.addUsersToRoles(user, [role]);
}
function checkOrCreateRole(roleName) {
let roles:{}[] = Meteor.roles.find().fetch();
let roleIndex = _.find(roles, (role)=>{