diff --git a/hourglass/collections/main.js b/hourglass/collections/main.js index 7c714b6..06cc43d 100644 --- a/hourglass/collections/main.js +++ b/hourglass/collections/main.js @@ -29,8 +29,9 @@ work.schema = new SimpleSchema({ name: {type: String}, class: {type: String}, dueDate: {type: Date}, + description: {type: String}, creator: {type: String}, - comments: {type: [String]}, + comments: {type: [String], optional: true}, confirmations: {type: [String], optional: true}, reports: {type: [String], optional: true}, attachments: {type: [String], optional: true}, diff --git a/hourglass/server/main.js b/hourglass/server/main.js index 0bfdaa4..0171ac8 100644 --- a/hourglass/server/main.js +++ b/hourglass/server/main.js @@ -163,13 +163,13 @@ Meteor.methods({ var ref = new Date().getTime(); input.creator = Meteor.userId(); work.schema.validate(input); - var found = Meteor.findOne({ + var found = classes.findOne({ _id: input.class }); - + console.log(input); if (Meteor.user() !== null && found !== null && - found.subscribers.indexOf(Meteor.userId()) != -1 && + Meteor.user().profile.classes.indexOf(input.class) !== -1 && found.banned.indexOf(Meteor.userId()) === -1 && found.blockEdit.indexOf(Meteor.userId()) === -1 && input.dueDate.getTime() >= ref && worktype.indexOf(type) != -1 && @@ -180,6 +180,7 @@ Meteor.methods({ input.done = []; input.numberdone = 0; input.comments = []; + console.log(input); work.insert(input); } @@ -207,6 +208,7 @@ Meteor.methods({ $set: { name: change.name, dueDate: change.dueDate, + description: change.description, comments: change.comments, attachments: change.attachments, type: change.type, @@ -224,6 +226,7 @@ Meteor.methods({ $set: { name: change.name, dueDate: change.dueDate, + description: change.description, attachments: change.attachments, type: change.type }