mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
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.
33 lines
980 B
JavaScript
33 lines
980 B
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { Mongo } from 'meteor/mongo';
|
|
import { check } from 'meteor/check';
|
|
import { Products } from './products';
|
|
|
|
export const MenuProdLinks = new Mongo.Collection('menuProdLinks');
|
|
|
|
MenuProdLinks.allow({
|
|
insert: function(userId, doc){
|
|
// if use id exists, allow insert
|
|
return !!userId;
|
|
},
|
|
});
|
|
|
|
Meteor.methods({
|
|
'add.menuProdLinks' (menuItemId, menuItemName, prodNameArray) {
|
|
check(menuItemId, String);
|
|
check(menuItemName, String);
|
|
check(prodNameArray, [Object]);
|
|
|
|
if (!this.userId) {
|
|
throw new Meteor.Error('You are not allowed to add menu and product links. Make sure you are logged in with valid user credentials.');
|
|
};
|
|
|
|
MenuProdLinks.insert({
|
|
menuItemId: menuItemId,
|
|
menuItemName: menuItemName,
|
|
products: prodNameArray,
|
|
dateCreated: Date(),
|
|
createdBy: this.userId
|
|
});
|
|
}
|
|
});
|