58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
import { SysConfig } from "../imports/api/systemConfig";
|
|
import { UpdateInfo } from "../imports/api/updateInfo";
|
|
import { MScripts } from "../imports/api/mScripts";
|
|
import { UserInfo } from "../imports/api/userInfo";
|
|
import { Roels } from "meteor/roles";
|
|
import { Workouts } from "../imports/api/workouts";
|
|
import { WorkoutLog } from "../imports/api/workoutLog";
|
|
|
|
Meteor.publish("SystemConfig", function() {
|
|
try {
|
|
return SysConfig.find({});
|
|
} catch (error) {
|
|
console.log(" ERROR pulling system config data: " + error);
|
|
}
|
|
});
|
|
|
|
Meteor.publish("UpdateVersion", function() {
|
|
try {
|
|
return UpdateInfo.find({ viewed: false });
|
|
} catch(error) {
|
|
console.log(" ERROR pulling updated version info: " + error);
|
|
}
|
|
});
|
|
|
|
Meteor.publish("UserInfo", function() {
|
|
try {
|
|
return this.userId;
|
|
} catch(error) {
|
|
console.log(" ERROR getting user Id: " + error);
|
|
}
|
|
});
|
|
|
|
Meteor.publish(null, function () {
|
|
if (this.userId) {
|
|
return Meteor.roleAssignment.find({ "user._id": this.userId });
|
|
}
|
|
this.ready();
|
|
});
|
|
|
|
Meteor.publish("myWorkoutRoutines", function () {
|
|
try {
|
|
if (this.userId) {
|
|
return Workouts.find({ "addedBy": this.userId, "routineActive": true });
|
|
}
|
|
} catch(error) {
|
|
console.log(" ERROR in pulling workout routines: " + error);
|
|
}
|
|
});
|
|
|
|
Meteor.publish("myWorkoutLog", function () {
|
|
try {
|
|
if (this.userId) {
|
|
return WorkoutLog.find({ "addedBy": this.userId, "exerciseActive": true });
|
|
}
|
|
} catch(error) {
|
|
console.log(" ERROR in pulling workout routines: " + error);
|
|
}
|
|
});
|