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"; import { LogEntry } from "../imports/api/logEntry"; import { Measurements } from "../imports/api/measurements"; import { MeasureLogEntry } from "../imports/api/measureLogEntry"; 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); } }); Meteor.publish("myLogEntries", function (routineId) { try { if (this.userId) { return LogEntry.find({ "addedBy": this.userId, "routineId": routineId }); } } catch(error) { console.log(" ERROR in pulling workout routines: " + error); } }); Meteor.publish("allMyLogEntries", function() { try { if (this.userId) { return LogEntry.find({ addedBy: this.userId }); } } catch(error) { console.log(" ERROR returning all of my log entries: " + error); } }); Meteor.publish("myMeasures", function() { try { if (this.userId) { return Measurements.find({ addedBy: this.userId, measurementActive: true }); } } catch(error) { console.log(" ERROR returning all of my measurements: " + error); } }); Meteor.publish("myMeasureLog", function() { try { if (this.userId) { return MeasureLogEntry.find({ addedBy: this.userId }); } } catch(error) { console.log(" ERROR returning all of my measurement log entries: " + error); } });