Blame view

imports/api/documents/documents.js 749 Bytes
cac7cbc73   tmcdeveloper   4.1.0 release
1
2
3
  import { Mongo } from 'meteor/mongo';
  import { SimpleSchema } from 'meteor/aldeed:simple-schema';
  import { Factory } from 'meteor/dburles:factory';
d1f05315d   tmcdeveloper   wip adding API an...
4

c42d4eeac   themeteorchef   handful of changes
5
6
  const Documents = new Mongo.Collection('Documents');
  export default Documents;
f0c912bf1   tmcdeveloper   add method tests ...
7

ccf91da0a   tmcdeveloper   add allow/deny ru...
8
9
10
11
12
13
14
15
16
17
18
  Documents.allow({
    insert: () => false,
    update: () => false,
    remove: () => false,
  });
  
  Documents.deny({
    insert: () => true,
    update: () => true,
    remove: () => true,
  });
f0c912bf1   tmcdeveloper   add method tests ...
19
20
21
22
23
  Documents.schema = new SimpleSchema({
    title: {
      type: String,
      label: 'The title of the document.',
    },
c42d4eeac   themeteorchef   handful of changes
24
25
26
27
    body: {
      type: String,
      label: 'The body of the document.',
    },
f0c912bf1   tmcdeveloper   add method tests ...
28
29
30
31
32
  });
  
  Documents.attachSchema(Documents.schema);
  
  Factory.define('document', Documents, {
c42d4eeac   themeteorchef   handful of changes
33
34
    title: () => 'Factory Title',
    body: () => 'Factory Body',
f0c912bf1   tmcdeveloper   add method tests ...
35
  });