Started adding async calls for upgrading to Meteor 3.0. Numerous other fixes.

This commit is contained in:
2025-07-02 11:18:09 -07:00
parent e1216741d6
commit 2e99ad007c
32 changed files with 549 additions and 373 deletions

View File

@@ -20,26 +20,28 @@ Meteor.collections = {Measures, Venues, Products, ProductTags, Sales, SalesSheet
//If this is the server then setup the default admin user if none exist.
if(Meteor.isServer) {
//Change this to find admin users, create a default admin user if none exists.
if(Users.find({}).count() === 0) {
try {
console.log("Creating a default admin user: admin/admin");
let id = Accounts.createUser({password: 'admin', username: 'admin'});
//Requires the alanning:roles package.
Roles.addUsersToRoles(id, [Meteor.UserRoles.ROLE_MANAGE, Meteor.UserRoles.ROLE_UPDATE]);
Users.countDocuments({}).then((userCount) => {
if(userCount === 0) {
try {
console.log("Creating a default admin user: admin/admin");
let id = Accounts.createUser({password: 'admin', username: 'admin'});
//Requires the alanning:roles package.
Roles.addUsersToRoles(id, [Meteor.UserRoles.ROLE_MANAGE, Meteor.UserRoles.ROLE_UPDATE]);
}
catch(err) {
console.log(err);
}
}
catch(err) {
console.log(err);
}
}
Meteor.validators = {};
Meteor.validators.ObjectID = Match.Where(function(id) {
if(id instanceof Mongo.ObjectID) {
id = id._str;
}
check(id, String);
return /[0-9a-fA-F]{24}/.test(id);
});
Meteor.validators = {};
Meteor.validators.ObjectID = Match.Where(function(id) {
if(id instanceof Mongo.ObjectID) {
id = id._str;
}
check(id, String);
return /[0-9a-fA-F]{24}/.test(id);
});
})
}