This commit is contained in:
Yaman Qalieh 2016-08-13 17:33:40 -04:00
commit 83214bec01
2 changed files with 8 additions and 4 deletions

View File

@ -29,8 +29,9 @@ work.schema = new SimpleSchema({
name: {type: String}, name: {type: String},
class: {type: String}, class: {type: String},
dueDate: {type: Date}, dueDate: {type: Date},
description: {type: String},
creator: {type: String}, creator: {type: String},
comments: {type: [String]}, comments: {type: [String], optional: true},
confirmations: {type: [String], optional: true}, confirmations: {type: [String], optional: true},
reports: {type: [String], optional: true}, reports: {type: [String], optional: true},
attachments: {type: [String], optional: true}, attachments: {type: [String], optional: true},

View File

@ -163,13 +163,13 @@ Meteor.methods({
var ref = new Date().getTime(); var ref = new Date().getTime();
input.creator = Meteor.userId(); input.creator = Meteor.userId();
work.schema.validate(input); work.schema.validate(input);
var found = Meteor.findOne({ var found = classes.findOne({
_id: input.class _id: input.class
}); });
console.log(input);
if (Meteor.user() !== null && if (Meteor.user() !== null &&
found !== null && found !== null &&
found.subscribers.indexOf(Meteor.userId()) != -1 && Meteor.user().profile.classes.indexOf(input.class) !== -1 &&
found.banned.indexOf(Meteor.userId()) === -1 && found.banned.indexOf(Meteor.userId()) === -1 &&
found.blockEdit.indexOf(Meteor.userId()) === -1 && found.blockEdit.indexOf(Meteor.userId()) === -1 &&
input.dueDate.getTime() >= ref && worktype.indexOf(type) != -1 && input.dueDate.getTime() >= ref && worktype.indexOf(type) != -1 &&
@ -180,6 +180,7 @@ Meteor.methods({
input.done = []; input.done = [];
input.numberdone = 0; input.numberdone = 0;
input.comments = []; input.comments = [];
console.log(input);
work.insert(input); work.insert(input);
} }
@ -207,6 +208,7 @@ Meteor.methods({
$set: { $set: {
name: change.name, name: change.name,
dueDate: change.dueDate, dueDate: change.dueDate,
description: change.description,
comments: change.comments, comments: change.comments,
attachments: change.attachments, attachments: change.attachments,
type: change.type, type: change.type,
@ -224,6 +226,7 @@ Meteor.methods({
$set: { $set: {
name: change.name, name: change.name,
dueDate: change.dueDate, dueDate: change.dueDate,
description: change.description,
attachments: change.attachments, attachments: change.attachments,
type: change.type type: change.type
} }