diff --git a/collections/comments.js b/collections/comments.js index b5745749e..fccafaed3 100644 --- a/collections/comments.js +++ b/collections/comments.js @@ -1,5 +1,52 @@ 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.deny({ update: function(userId, post, fieldNames) { if(isAdminById(userId)) diff --git a/collections/notifications.js b/collections/notifications.js index 15524b948..7d1739cee 100644 --- a/collections/notifications.js +++ b/collections/notifications.js @@ -1,5 +1,25 @@ Notifications = new Meteor.Collection('notifications'); +// Notifications = new Meteor.Collection("notifications", { +// schema: new SimpleSchema({ +// properties: { +// type: Object +// }, +// event: { +// type: String +// }, +// read: { +// type: Boolean +// }, +// createdAt: { +// type: Date +// }, +// userId: { +// type: "???" +// } +// }) +// }); + Notifications.allow({ insert: function(userId, doc){ // new notifications can only be created via a Meteor method diff --git a/collections/posts.js b/collections/posts.js index aa2815142..67d32956f 100644 --- a/collections/posts.js +++ b/collections/posts.js @@ -1,5 +1,66 @@ 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: "???" +// } +// }) +// }); + STATUS_PENDING=1; STATUS_APPROVED=2; STATUS_REJECTED=3; diff --git a/collections/users.js b/collections/users.js index 586550e00..f8662c105 100644 --- a/collections/users.js +++ b/collections/users.js @@ -1,3 +1,40 @@ +var Schema = {}; + +Schema.User = new SimpleSchema({ + _id: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + username: { + type: String, + regEx: /^[a-z0-9A-Z_]{3,15}$/ + }, + emails: { + type: [Object] + }, + "emails.$.address": { + type: String, + regEx: SimpleSchema.RegEx.Email + }, + "emails.$.verified": { + type: Boolean + }, + createdAt: { + type: Date + }, + profile: { + type: Schema.UserProfile, + optional: true + }, + services: { + type: Object, + optional: true, + blackbox: true + } +}); + +// Meteor.users.attachSchema(Schema.User); + Meteor.users.allow({ update: function(userId, doc){ return isAdminById(userId) || userId == doc._id;