createClass backbone

This commit is contained in:
yamanq 2016-08-08 21:05:25 -04:00
parent cf7a586cf2
commit 701c964083
2 changed files with 9 additions and 6 deletions

View File

@ -16,7 +16,7 @@ classes.schema = new SimpleSchema({
admin: {type: String, optional: true}, admin: {type: String, optional: true},
status: {type: Boolean, defaultValue: false}, status: {type: Boolean, defaultValue: false},
code: {type: String, defaultValue: ""}, code: {type: String, defaultValue: ""},
privacy: {type: String}, privacy: {type: Boolean},
category: {type: String}, category: {type: String},
moderators: {type: [String], optional: true}, moderators: {type: [String], optional: true},
banned: {type: [String], optional: true}, banned: {type: [String], optional: true},

View File

@ -10,13 +10,16 @@ Meteor.methods({
'genCode': function() { 'genCode': function() {
return 'xxxxxx'.replace(/[x]/g, _uuid4); return 'xxxxxx'.replace(/[x]/g, _uuid4);
}, },
//NOT COMPLETE V //No Security
'createClass': function(input) { 'createClass': function(input) {
if(Meteor.user() != null && Meteor.classes.find({status:true, admin:Meteor.userId()}).length < 5 && // if(Meteor.user() != null && classes.find({status:true, admin:Meteor.userId()}).length < 5 &&
schools.find({name:input.school}).fetch().length > 0){ // schools.find({name:input.school}).fetch().length > 0){
classes.schema.validate(input); // classes.schema.validate(input);
classes.insert(input); classes.insert(input);
} // return 1;
// } else {
// return 0;
// }
}, },
'editProfile': function(change) { 'editProfile': function(change) {
current = Meteor.user().profile; current = Meteor.user().profile;