24 lines
561 B
JavaScript
24 lines
561 B
JavaScript
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({
|
|
async 'set.ScriptRun' (scriptName) {
|
|
check(scriptName, String);
|
|
|
|
return await MScripts.insertAsync({
|
|
scriptName: scriptName,
|
|
hasRun: true,
|
|
runOn: new Date(),
|
|
});
|
|
},
|
|
});
|