summaryrefslogtreecommitdiffstats
path: root/models/rules.js
blob: 2304d2dceed81905faa586fc368fd82d4005e803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Rules = new Mongo.Collection('rules');

Rules.attachSchema(new SimpleSchema({
  title: {
    type: String,
    optional: true,
  },
  description: {
    type: String,
    optional: true,
  },
}));

Rules.mutations({
  rename(description) {
    return { $set: { description } };
  },
});

Rules.allow({
    update: function () {
    // add custom authentication code here
    return true;
  },
});




if (Meteor.isServer) {
  Meteor.startup(() => {
    const rules = Rules.findOne({});
    if(!rules){
      Rules.insert({title: "regola1", description: "bella"});
      Rules.insert({title: "regola2", description: "bella2"});
    }
  });
}