createSchool() function
This commit is contained in:
parent
e43ceb74f5
commit
9610867f1c
@ -4,6 +4,7 @@ work = new Mongo.Collection("Work");
|
||||
|
||||
schools.schema = new SimpleSchema({
|
||||
name: {type: String},
|
||||
status: {type: Boolean},
|
||||
aliases: {type: [String]}
|
||||
});
|
||||
|
||||
|
||||
@ -8,9 +8,13 @@ _uuid4 = function(cc) {
|
||||
|
||||
Meteor.methods({
|
||||
'genCode': function() {
|
||||
return 'xxxxxx'.replace(/[x]/g, _uuid4);
|
||||
return 'xxxxxx'.replace(/[x]/g, _uuid4);
|
||||
},
|
||||
//No Security
|
||||
'createSchool': function(schoolname) {
|
||||
if (Meteor.user() != null && schools.find({name:input.school}).fetch().length === 0) {
|
||||
schools.insert({name: schoolname, status: false});
|
||||
}
|
||||
},
|
||||
'createClass': function(input) {
|
||||
classes.schema.validate(input);
|
||||
if(Meteor.user() != null && classes.find({status:false, admin:Meteor.userId()}).fetch().length < 5 &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user