mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
initial commit
This commit is contained in:
parent
b7c7d8b449
commit
750811a81f
52 changed files with 25204 additions and 92 deletions
42
imports/api/messages.js
Normal file
42
imports/api/messages.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export const Messages = new Mongo.Collection('messages');
|
||||
|
||||
Messages.allow({
|
||||
insert: function(userId, doc){
|
||||
// if use id exists, allow insert
|
||||
return !!userId;
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.message' (entityId, messageText, imageData, intendedRecipient, isGroupRecipient) {
|
||||
check(entityId, String);
|
||||
check(messageText, String);
|
||||
check(imageData, String);
|
||||
check(intendedRecipient, String);
|
||||
check(isGroupRecipient, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('User is not allowed to add new messages in the system, make sure you are logged in.');
|
||||
}
|
||||
|
||||
// need to get the userId and role, and ensure the message is sent properly to the appropriate person / people
|
||||
|
||||
},
|
||||
'delete.message' (messageId) {
|
||||
check(messageId, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('User is not allowed to add new messages in the system, make sure you are logged in.');
|
||||
}
|
||||
|
||||
return Messages.update({ _id: messageId }, {
|
||||
$set: {
|
||||
isDeleted: true,
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
79
imports/api/serviceentities.js
Normal file
79
imports/api/serviceentities.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export const ServiceEntities = new Mongo.Collection('serviceEntities');
|
||||
|
||||
ServiceEntities.allow({
|
||||
insert: function(userId, doc){
|
||||
// if use id exists, allow insert
|
||||
return !!userId;
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.serviceEntity' (name, code, address, city, state, zip, phone, email, type) {
|
||||
check(name, String);
|
||||
check(code, String);
|
||||
check(address, String);
|
||||
check(city, String);
|
||||
check(state, String);
|
||||
check(zip, String);
|
||||
check(phone, String);
|
||||
check(email, String);
|
||||
check(type, String);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('User is not allowed to add new Service Entities, make sure you are logged in.');
|
||||
}
|
||||
|
||||
return ServiceEntities.insert({
|
||||
name: name,
|
||||
code: code,
|
||||
address: address,
|
||||
city: city,
|
||||
state: state,
|
||||
zip: zip,
|
||||
phone: phone,
|
||||
email: email,
|
||||
type: type,
|
||||
isActive: true,
|
||||
addedOn: new Date(),
|
||||
addedBy: Meteor.user().emails[0].address,
|
||||
});
|
||||
},
|
||||
'edit.serviceEntities' (entityId, name, code, address, city, state, zip, phone, email, type, isActive) {
|
||||
check(entityId, String);
|
||||
check(name, String);
|
||||
check(code, String);
|
||||
check(address, String);
|
||||
check(city, String);
|
||||
check(state, String);
|
||||
check(zip, String);
|
||||
check(phone, String);
|
||||
check(email, String);
|
||||
check(type, String);
|
||||
check(isActive, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('User is not allowed to add new Service Entities, make sure you are logged in.');
|
||||
}
|
||||
|
||||
return ServiceEntities.update({ _id: entityId }, {
|
||||
$set: {
|
||||
name: name,
|
||||
code: code,
|
||||
address: address,
|
||||
city: city,
|
||||
state: state,
|
||||
zip: zip,
|
||||
phone: phone,
|
||||
email: email,
|
||||
type: type,
|
||||
isActive: isActive,
|
||||
updatedOn: new Date(),
|
||||
updatedBy: Meteor.user().emails[0].address,
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
34
imports/api/systemConfig.js
Normal file
34
imports/api/systemConfig.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export const SysConfig = new Mongo.Collection('sysConfig');
|
||||
|
||||
SysConfig.allow({
|
||||
insert: function(userId, doc){
|
||||
// if use id exists, allow insert
|
||||
return !!userId;
|
||||
},
|
||||
});
|
||||
|
||||
Meteor.methods({
|
||||
'add.noSysAdminReg' () {
|
||||
return SysConfig.insert({
|
||||
canReg: false,
|
||||
dateAdded: new Date(),
|
||||
});
|
||||
},
|
||||
'edit.noSysAdminReg' (canReg) {
|
||||
check(canReg, Boolean);
|
||||
|
||||
if (!this.userId) {
|
||||
throw new Meteor.Error('Not able to change registration setting. Make sure you are logged in with valid system administrator credentials.');
|
||||
}
|
||||
return SysConfig.update({ _id: configId }, {
|
||||
$set: {
|
||||
canReg: canReg,
|
||||
dateUpdated: new Date(),
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue