31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import Measures from "./Measure.js";
|
|
import Venues from "./Venue.js";
|
|
import Products from "./Product.js";
|
|
import ProductTags from "./ProductTag.js";
|
|
import Sales from "./Sale.js";
|
|
import SalesSheets from "./SalesSheet.js";
|
|
import Logs from "./Logs.js";
|
|
import Users from "./User.js";
|
|
import UserRoles from "./Roles.js";
|
|
import Workers from "./Worker.js";
|
|
import './Reports.js';
|
|
|
|
//Save the collections in the Meteor.collections property for easy access without name conflicts.
|
|
Meteor.collections = {Measures, Venues, Products, ProductTags, Sales, SalesSheets, Logs, Users, UserRoles, Workers};
|
|
|
|
//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]);
|
|
}
|
|
catch(err) {
|
|
console.log(err);
|
|
}
|
|
}
|
|
} |