mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
- Added a permission to show or hide update version information on that dashboard as a card that will only show when new update info is available and not yet dismissed.
- Updated Lists so list items added will have their fist letter auto-capitalized
- Updated Lists so list items are searched against the products before being added to the list, so we have store info more commonly in lists
- Updated Products so new products will have their first letter capitalized automatically
- Updated the dashboard to show the Update Available card if this is enbaled in permissions.
- The dashboard card only shows for System Admin roles.
- The dashboard card is enabled by default
- The dashboard card is pulled from the GitLab releases RSS feed.
- The RSS Feed is only checked every 30 minutes using node-cron
- Updated System Configuration to have a toggle for the update available card
- Added a bell icon to the top and slide out navigation, shown when a new update is available, if update available is enabled in system configuration.
66 lines
1.9 KiB
JavaScript
66 lines
1.9 KiB
JavaScript
import { Meteor } from 'meteor/meteor';
|
|
import { Mongo } from 'meteor/mongo';
|
|
import { check } from 'meteor/check';
|
|
|
|
export const Products = new Mongo.Collection('products');
|
|
|
|
Products.allow({
|
|
insert: function(userId, doc){
|
|
// if use id exists, allow insert
|
|
return !!userId;
|
|
},
|
|
});
|
|
|
|
Meteor.methods({
|
|
'add.product' (prodName, prodStore) {
|
|
check(prodName, String);
|
|
check(prodStore, [String]);
|
|
|
|
if (!this.userId) {
|
|
throw new Meteor.Error('You are not allowed to add products. Make sure you are logged in with valid user credentials.');
|
|
}
|
|
|
|
let pname = prodName.charAt(0).toUpperCase() + prodName.slice(1);
|
|
|
|
// first does this product already exist?
|
|
|
|
let prodExists = Products.findOne({ prodName: pname });
|
|
|
|
if (!prodExists) {
|
|
return Products.insert({
|
|
prodName: pname,
|
|
prodOwner: this.userId,
|
|
prodStore: prodStore,
|
|
});
|
|
} else {
|
|
console.log(" ---- Product exsits in database already.");
|
|
}
|
|
},
|
|
'edit.product' (prodId, prodName, prodStore) {
|
|
check(prodId, String);
|
|
check(prodName, String);
|
|
check(prodStore, [String]);
|
|
|
|
if (!this.userId) {
|
|
throw new Meteor.Error('You are not allowed to edit products. Make sure you are logged in with valid user credentials.');
|
|
}
|
|
|
|
let pname = prodName.charAt(0).toUpperCase() + prodName.slice(1);
|
|
|
|
return Products.update({ _id: prodId }, {
|
|
$set: {
|
|
prodName: pname,
|
|
prodStore: prodStore,
|
|
}
|
|
});
|
|
},
|
|
'delete.product' (prodId) {
|
|
check(prodId, String);
|
|
|
|
if (!this.userId) {
|
|
throw new Meteor.Error('You are not allowed to delete products. Make sure you are logged in with valid user credentials.');
|
|
}
|
|
|
|
return Products.remove({ _id: prodId });
|
|
}
|
|
});
|