Enabling Collection2 (validation doesn't work yet)

This commit is contained in:
Sacha Greif 2014-05-15 15:18:17 +09:00
parent d073a6dfd3
commit 7812d65c6c
2 changed files with 131 additions and 109 deletions

View file

@ -1,51 +1,54 @@
Comments = new Meteor.Collection('comments');
// Comments = new Meteor.Collection("comments", {
// schema: new SimpleSchema({
// body: {
// type: String,
// },
// baseScore: {
// type: Number
// },
// score: {
// type: Number
// }
// baseScore: {
// type: Number
// },
// upvotes: {
// type: Number
// },
// upvoters: {
// type: []
// },
// downvotes: {
// type: Number
// },
// downvoters: {
// type: []
// }
// score: {
// type: Number
// },
// author: {
// type: String
// },
// inactive: {
// type: Boolean
// },
// createdAt: {
// type: Date
// },
// postId: {
// type: "???"
// },
// userId: {
// type: "???"
// }
// })
// });
Comments = new Meteor.Collection("comments", {
schema: new SimpleSchema({
body: {
type: String,
},
baseScore: {
type: Number,
optional: true
},
score: {
type: Number,
optional: true
},
upvotes: {
type: Number,
optional: true
},
upvoters: {
type: [String], // XXX
optional: true
},
downvotes: {
type: Number,
optional: true
},
downvoters: {
type: [String], // XXX
optional: true
},
author: {
type: String,
optional: true
},
inactive: {
type: Boolean,
optional: true
},
createdAt: {
type: Date,
optional: true
},
postId: {
type: String, // XXX
optional: true
},
userId: {
type: String, // XXX
optional: true
}
})
});
Comments.deny({
update: function(userId, post, fieldNames) {

View file

@ -1,65 +1,84 @@
Posts = new Meteor.Collection('posts');
// Posts = new Meteor.Collection('posts');
// Posts = new Meteor.Collection("posts", {
// schema: new SimpleSchema({
// headline: {
// type: String,
// label: "Title",
// },
// url: {
// type: String,
// label: "URL"
// },
// body: {
// type: String,
// },
// author: {
// type: String
// },
// comments: {
// type: Number
// },
// baseScore: {
// type: Number
// },
// upvotes: {
// type: Number
// },
// upvoters: {
// type: []
// },
// downvotes: {
// type: Number
// },
// downvoters: {
// type: []
// }
// score: {
// type: Number
// },
// status: {
// type: Number
// },
// createdAt: {
// type: Date
// },
// submitted: {
// type: Date
// },
// sticky: {
// type: Boolean
// },
// inactive: {
// type: Boolean
// },
// categories: {
// type: []
// },
// userId: {
// type: "???"
// }
// })
// });
// Note: XXX = change this
Posts = new Meteor.Collection("posts", {
schema: new SimpleSchema({
headline: {
type: String,
label: "Title",
},
url: {
type: String,
label: "URL",
optional: true
},
body: {
type: String,
optional: true
},
author: {
type: String,
optional: true
},
comments: {
type: Number,
optional: true
},
baseScore: {
type: Number,
optional: true
},
upvotes: {
type: Number,
optional: true
},
upvoters: {
type: [String], // XXX
optional: true
},
downvotes: {
type: Number,
optional: true
},
downvoters: {
type: [String], // XXX
optional: true
},
score: {
type: Number,
optional: true
},
status: {
type: Number,
optional: true
},
createdAt: {
type: Date,
optional: true
},
submitted: {
type: Date,
optional: true
},
sticky: {
type: Boolean,
optional: true
},
inactive: {
type: Boolean,
optional: true
},
categories: {
type: [String], // XXX
optional: true
},
userId: {
type: String, // XXX
optional: true
}
})
});
STATUS_PENDING=1;
STATUS_APPROVED=2;