open-health/imports/api/mScripts.js

25 lines
561 B
JavaScript
Raw Normal View History

2025-12-06 15:44:43 -06:00
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({
2026-02-03 16:03:34 -06:00
async 'set.ScriptRun' (scriptName) {
2025-12-06 15:44:43 -06:00
check(scriptName, String);
2026-02-03 16:03:34 -06:00
return await MScripts.insertAsync({
2025-12-06 15:44:43 -06:00
scriptName: scriptName,
hasRun: true,
runOn: new Date(),
});
},
});