Skip to content

Instantly share code, notes, and snippets.

@acomito
Created December 8, 2016 14:16
Show Gist options
  • Save acomito/1615fe53f936f5272543ca6266c7d54d to your computer and use it in GitHub Desktop.
Save acomito/1615fe53f936f5272543ca6266c7d54d to your computer and use it in GitHub Desktop.
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