wip Pup 1.0.0
This commit is contained in:
commit
cdc15f019d
48 changed files with 1100 additions and 0 deletions
51
imports/api/Documents/Documents.js
Normal file
51
imports/api/Documents/Documents.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* eslint-disable consistent-return */
|
||||
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
|
||||
const Documents = new Mongo.Collection('Documents');
|
||||
|
||||
Documents.allow({
|
||||
insert: () => false,
|
||||
update: () => false,
|
||||
remove: () => false,
|
||||
});
|
||||
|
||||
Documents.deny({
|
||||
insert: () => true,
|
||||
update: () => true,
|
||||
remove: () => true,
|
||||
});
|
||||
|
||||
Documents.schema = new SimpleSchema({
|
||||
owner: {
|
||||
type: String,
|
||||
label: 'The ID of the user this document belongs to.',
|
||||
},
|
||||
createdAt: {
|
||||
type: String,
|
||||
label: 'The date this document was created.',
|
||||
autoValue() {
|
||||
if (this.isInsert) return (new Date()).toISOString();
|
||||
},
|
||||
},
|
||||
updatedAt: {
|
||||
type: String,
|
||||
label: 'The date this document was last updated.',
|
||||
autoValue() {
|
||||
if (this.isInsert || this.isUpdate) return (new Date()).toISOString();
|
||||
},
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
label: 'The title of the document.',
|
||||
},
|
||||
body: {
|
||||
type: String,
|
||||
label: 'The body of the document.',
|
||||
},
|
||||
});
|
||||
|
||||
Documents.attachSchema(Documents.schema);
|
||||
|
||||
export default Documents;
|
||||
Loading…
Add table
Add a link
Reference in a new issue