Initial commit

This commit is contained in:
Brian McGonagill 2025-12-06 15:44:43 -06:00
commit 35745a89ec
44 changed files with 3342 additions and 0 deletions

24
imports/api/mScripts.js Normal file
View file

@ -0,0 +1,24 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
export const MScripts = new Mongo.Collection('mScripts');
MScripts.allow({
insert: function(userId, doc){
// if use id exists, allow insert
return !!userId;
},
});
Meteor.methods({
'set.ScriptRun' (scriptName) {
check(scriptName, String);
MScripts.insertAsync({
scriptName: scriptName,
hasRun: true,
runOn: new Date(),
});
},
});

View file

@ -0,0 +1,49 @@
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' (admReg, genReg) {
check(admReg, Boolean);
check(genReg, 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.');
}
console.log("Got here...");
console.log("Adding new.");
return SysConfig.upsertAsync({ ruleNo: 1 }, {
$set: {
ruleNo: 1,
SysAdminReg: admReg,
dateAdded: new Date(),
allowReg: genReg,
allowUpdates: true,
}
});
},
'allow.updateInfo' (allowUpdate) {
check(allowUpdate, Boolean);
if (!this.userId) {
throw new Meteor.Error('Not able to change system update notification settings. Make sure you are logged in with valid system administrator credentials.');
}
return SysConfig.updateAsync({ ruleNo: 1 }, {
$set: {
allowUpdates: allowUpdate,
}
});
},
});

38
imports/api/updateInfo.js Normal file
View file

@ -0,0 +1,38 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
export const UpdateInfo = new Mongo.Collection('updateInfo');
UpdateInfo.allow({
insert: function(userId, doc){
// if use id exists, allow insert
return !!userId;
},
});
Meteor.methods({
'add.updateInfo' (updateObject) {
check(updateObject, Object);
UpdateInfo.insertAsync({
title: updateObject.title,
description: updateObject.description,
dateRelease: updateObject.date,
releaseLink: updateObject.link
});
},
'markUpdate.read' (updateId) {
check(updateId, String);
if (!this.userId) {
throw new Meteor.Error('You are not allowed to mark updates as read. Make sure you are logged in with valid user credentials.');
}
return UpdateInfo.updateAsync({ _id: updateId }, {
$set: {
viewed: true
}
});
}
});

16
imports/api/userInfo.js Normal file
View file

@ -0,0 +1,16 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';
export const UserInfo = new Mongo.Collection('userInfo');
UserInfo.allow({
insert: function(userId, doc){
// if use id exists, allow insert
return !!userId;
},
});
Meteor.methods({
});