Updated menus to work better with list item linking

Lots of changes made (almost a refactor <--- four letter word to me...
- Menu Items collection is now the "permanent" storage location for menu item for any day.  So, if i set Green Chile Chicken Enchiladas, Beans, and Rice as an item for a day, it will be stored as a Menu Item for later use.
- Linking menu items to items that can be added to a shopping list - This has been updated to be more reusable. So as you re-choose a menu item that's already got list items linked, it just shows up for you to use to build a shopping list as needed.
- Deleting menu items from a menu - changed to delete them only from the menu, and not from the database.
- Dashboard updated to pull today's menu item from the menu, and not the menu item list.
This commit is contained in:
Brian McGonagill 2024-08-14 11:38:13 -05:00
parent 3f6618d906
commit 88fa7c1d22
13 changed files with 216 additions and 149 deletions

View file

@ -88,9 +88,17 @@ Meteor.publish("myMenus", function() {
}
});
Meteor.publish("menuItems", function() {
try {
return MenuItems.find({});
} catch (error) {
console.log(" ERROR pulling menuItem data: " + error);
}
});
Meteor.publish("myMenuItems", function(menuId) {
try {
return MenuItems.find({ menuId: menuId });
return Menus.find({ menuId: menuId });
} catch (error) {
console.log(" ERROR pulling menu items for this list: " + error);
}
@ -108,7 +116,7 @@ Meteor.publish("todayMenuItems", function() {
try {
let todayDate = new Date();
let todaysDate = moment(todayDate).format("MMM DD, YYYY");
return MenuItems.find({ serveDate: todaysDate, itemMade: false });
return Menus.find({ 'menuItems.serveDate': todaysDate });
} catch (error) {
console.log(" ERROR pulling today's menu items: " + error);
}
@ -176,4 +184,4 @@ Meteor.publish("menuProdLinkData", function() {
} catch (error) {
console.log(" ERROR publishing menu product links: " + error);
}
});
});