get_my/server/publish.js
2022-08-26 17:10:05 -05:00

87 lines
No EOL
2.5 KiB
JavaScript

import { SysConfig } from '../imports/api/systemConfig.js';
import { Stores } from '../imports/api/stores.js';
import { UserConfigOptions } from '../imports/api/userConfigOptions.js';
import { Products } from '../imports/api/products.js';
import { Categories } from '../imports/api/category.js';
import { Locations } from '../imports/api/location.js';
import { Lists } from '../imports/api/lists.js';
import { ListItems } from '../imports/api/listItems.js';
import { Menus } from '../imports/api/menu.js';
import { MenuItems } from '../imports/api/menuItems.js';
Meteor.publish("SystemConfig", function() {
try {
return SysConfig.find({});
} catch (error) {
console.log(" ERROR pulling system config data: " + error);
}
});
Meteor.publish('userList', function() {
return Meteor.users.find({});
});
Meteor.publish("storeInfo", function() {
try {
return Stores.find({});
} catch (error) {
console.log(" ERROR pulling store data: " + error);
}
});
Meteor.publish("myProducts", function() {
try {
return Products.find({});
} catch (error) {
console.log(" ERROR pulling product data: " + error);
}
});
Meteor.publish("myCategories", function() {
try {
return Categories.find({});
} catch (error) {
console.log(" ERROR pulling category data: " + error);
}
});
Meteor.publish("myLocations", function() {
try {
return Locations.find({});
} catch (error) {
console.log(" ERROR pulling location data: " + error);
}
});
Meteor.publish("myLists", function() {
try {
return Lists.find( { $or: [ { listOwner: this.userId, listComplete: false }, { listShared: true, listComplete: false } ] } );
} catch (error) {
console.log(" ERROR pulling list data: " + error);
}
});
Meteor.publish("myListItems", function(listId) {
try {
// console.log("List Id is: " + listId);
return ListItems.find({ listId: listId });
} catch (error) {
console.log(" ERROR pulling list items for this list: " + error);
}
});
Meteor.publish("myMenus", function() {
try {
return Menus.find({ menuComplete: false });
} catch (error) {
console.log(" ERROR pulling menu info: " + error);
}
});
Meteor.publish("myMenuItems", function(menuId) {
try {
return MenuItems.find({ menuId: menuId });
} catch (error) {
console.log(" ERROR pulling list items for this list: " + error);
}
});