Created
December 8, 2016 14:16
-
-
Save acomito/1615fe53f936f5272543ca6266c7d54d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Mongo } from 'meteor/mongo'; | |
import { SimpleSchema } from 'meteor/aldeed:simple-schema'; | |
import { Factory } from 'meteor/dburles:factory'; | |
const Video = new Mongo.Collection('Video'); | |
export default Video; | |
Video.allow({ | |
insert: () => false, | |
update: () => false, | |
remove: () => false, | |
}); | |
Video.deny({ | |
insert: () => true, | |
update: () => true, | |
remove: () => true, | |
}); | |
Video.schema = new SimpleSchema({ | |
sessionOn: { | |
type: Boolean, | |
autoValue: function() { | |
if (this.isInsert && (!this.isSet || this.value.length === 0)) { // only set on insert | |
return false | |
} | |
} | |
}, | |
currentSessionId: { | |
type: String, | |
optional: true | |
} | |
}); | |
Video.attachSchema(Video.schema); | |
Factory.define('video', Video, { | |
title: () => 'Factory Title', | |
body: () => 'Factory Body', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment