mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Lots of changes and additions to the project. Still early, and not usable.
This commit is contained in:
parent
8636f8cf9b
commit
266dbd0856
41 changed files with 836 additions and 67 deletions
|
|
@ -12,16 +12,16 @@ Categories.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.category' (name) {
|
||||
check(name, String);
|
||||
'add.category' (categoryName) {
|
||||
check(categoryName, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add categories. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
return Categories.insert({
|
||||
categoryName: name,
|
||||
categroyOwner: this.userid,
|
||||
categoryName: categoryName,
|
||||
categoryOwner: this.userId,
|
||||
});
|
||||
},
|
||||
'edit.category' (categoryId, categoryName,) {
|
||||
|
|
|
|||
|
|
@ -12,9 +12,8 @@ Locations.allow({
|
|||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.location' (name, type) {
|
||||
'add.location' (name) {
|
||||
check(name, String);
|
||||
check(type, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to add locations. Make sure you are logged in with valid user credentials.');
|
||||
|
|
@ -22,14 +21,12 @@ Meteor.methods({
|
|||
|
||||
return Locations.insert({
|
||||
locationName: name,
|
||||
locationType: type,
|
||||
owner: this.userid,
|
||||
owner: this.userId,
|
||||
});
|
||||
},
|
||||
'edit.location' (locationId, locationName, locationType) {
|
||||
'edit.location' (locationId, locationName) {
|
||||
check(locationId, String);
|
||||
check(locationName, String);
|
||||
check(locationType, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('You are not allowed to edit locations. Make sure you are logged in with valid user credentials.');
|
||||
|
|
@ -38,7 +35,6 @@ Meteor.methods({
|
|||
return Locations.update({ _id: locationId }, {
|
||||
$set: {
|
||||
locationName: locationName,
|
||||
locationType: locationType,
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ Meteor.methods({
|
|||
throw new Meteor.Error('You are not allowed to add stores. Make sure you are logged in with valid user credentials.');
|
||||
}
|
||||
|
||||
console.log(" ---- userid: " + Meteor.user()._id);
|
||||
|
||||
return Stores.insert({
|
||||
storeName: storeName,
|
||||
storeType: storeType,
|
||||
owner: this.userid,
|
||||
owner: Meteor.user()._id,
|
||||
});
|
||||
},
|
||||
'edit.store' (storeId, storeName, storeType) {
|
||||
|
|
|
|||
32
imports/api/userConfigOptions.js
Normal file
32
imports/api/userConfigOptions.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export const UserConfigOptions = new Mongo.Collection('userConfigOptions');
|
||||
|
||||
UserConfigOptions.allow({
|
||||
insert: function(userId, doc){
|
||||
// if use id exists, allow insert
|
||||
return !!userId;
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.darkPref' (darkPref) {
|
||||
check(darkPref, Boolean);
|
||||
|
||||
return UserConfigOptions.insert({
|
||||
darkPref: darkPref,
|
||||
owner: this.userId
|
||||
});
|
||||
},
|
||||
'edit.darkPref' (darkPref) {
|
||||
check(darkPref, Boolean);
|
||||
|
||||
return UserConfigOptions.update({ owner: this.userId }, {
|
||||
$set: {
|
||||
darkPref: darkPref
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue