Replace mquandalle:collection-mutations with collection helpers

This commit is contained in:
Harry Adel 2026-01-21 19:22:54 +02:00
parent aca661583d
commit 94a3575e2c
35 changed files with 718 additions and 1321 deletions

View file

@ -3,16 +3,6 @@ import { Meteor } from 'meteor/meteor';
Triggers = new Mongo.Collection('triggers');
Triggers.mutations({
rename(description) {
return {
$set: {
description,
},
};
},
});
Triggers.before.insert((userId, doc) => {
doc.createdAt = new Date();
doc.updatedAt = doc.createdAt;
@ -36,6 +26,12 @@ Triggers.allow({
});
Triggers.helpers({
async rename(description) {
return await Triggers.updateAsync(this._id, {
$set: { description },
});
},
description() {
return this.desc;
},