mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Replaced deprecated "schema" property with "attachSchema" method.
This commit is contained in:
parent
a13ce3f0a9
commit
b3806468f1
4 changed files with 49 additions and 50 deletions
|
@ -1,77 +1,78 @@
|
|||
Comments = new Meteor.Collection("comments", {
|
||||
schema: new SimpleSchema({
|
||||
CommentsSchema = new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
optional: true
|
||||
type: String,
|
||||
optional: true
|
||||
},
|
||||
parentCommentId: {
|
||||
type: String,
|
||||
optional: true
|
||||
type: String,
|
||||
optional: true
|
||||
},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
optional: true
|
||||
type: Date,
|
||||
optional: true
|
||||
},
|
||||
postedAt: { // for now, comments are always created and posted at the same time
|
||||
type: Date,
|
||||
optional: true
|
||||
type: Date,
|
||||
optional: true
|
||||
},
|
||||
body: {
|
||||
type: String
|
||||
type: String
|
||||
},
|
||||
htmlBody: {
|
||||
type: String,
|
||||
optional: true
|
||||
type: String,
|
||||
optional: true
|
||||
},
|
||||
baseScore: {
|
||||
type: Number,
|
||||
decimal: true,
|
||||
optional: true
|
||||
type: Number,
|
||||
decimal: true,
|
||||
optional: true
|
||||
},
|
||||
score: {
|
||||
type: Number,
|
||||
decimal: true,
|
||||
optional: true
|
||||
type: Number,
|
||||
decimal: true,
|
||||
optional: true
|
||||
},
|
||||
upvotes: {
|
||||
type: Number,
|
||||
optional: true
|
||||
type: Number,
|
||||
optional: true
|
||||
},
|
||||
upvoters: {
|
||||
type: [String], // XXX
|
||||
optional: true
|
||||
type: [String], // XXX
|
||||
optional: true
|
||||
},
|
||||
downvotes: {
|
||||
type: Number,
|
||||
optional: true
|
||||
type: Number,
|
||||
optional: true
|
||||
},
|
||||
downvoters: {
|
||||
type: [String], // XXX
|
||||
optional: true
|
||||
type: [String], // XXX
|
||||
optional: true
|
||||
},
|
||||
author: {
|
||||
type: String,
|
||||
optional: true
|
||||
type: String,
|
||||
optional: true
|
||||
},
|
||||
inactive: {
|
||||
type: Boolean,
|
||||
optional: true
|
||||
type: Boolean,
|
||||
optional: true
|
||||
},
|
||||
postId: {
|
||||
type: String, // XXX
|
||||
optional: true
|
||||
type: String, // XXX
|
||||
optional: true
|
||||
},
|
||||
userId: {
|
||||
type: String, // XXX
|
||||
optional: true
|
||||
type: String, // XXX
|
||||
optional: true
|
||||
},
|
||||
isDeleted: {
|
||||
type: Boolean,
|
||||
optional: true
|
||||
type: Boolean,
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Comments = new Meteor.Collection("comments");
|
||||
Comments.attachSchema(CommentsSchema);
|
||||
|
||||
Comments.deny({
|
||||
update: function(userId, post, fieldNames) {
|
||||
if(isAdminById(userId))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
InviteSchema = new SimpleSchema({
|
||||
InvitesSchema = new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
optional: true
|
||||
|
@ -17,9 +17,8 @@ InviteSchema = new SimpleSchema({
|
|||
}
|
||||
});
|
||||
|
||||
Invites = new Meteor.Collection("invites", {
|
||||
schema: InviteSchema
|
||||
});
|
||||
Invites = new Meteor.Collection("invites");
|
||||
Invites.attachSchema(InvitesSchema);
|
||||
|
||||
|
||||
// invites are managed through Meteor method
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
postSchemaObject = {
|
||||
PostsSchema = new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
optional: true
|
||||
|
@ -86,16 +86,15 @@ postSchemaObject = {
|
|||
type: String, // XXX
|
||||
optional: true
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// add any extra properties to postSchemaObject (provided by packages for example)
|
||||
_.each(addToPostSchema, function(item){
|
||||
postSchemaObject[item.propertyName] = item.propertySchema;
|
||||
});
|
||||
|
||||
Posts = new Meteor.Collection("posts", {
|
||||
schema: new SimpleSchema(postSchemaObject)
|
||||
});
|
||||
Posts = new Meteor.Collection("posts");
|
||||
Posts.attachSchema(PostsSchema);
|
||||
|
||||
STATUS_PENDING=1;
|
||||
STATUS_APPROVED=2;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
settingsSchemaObject = {
|
||||
SettingsSchema = new SimpleSchema({
|
||||
title: {
|
||||
type: String,
|
||||
label: "Title",
|
||||
|
@ -160,7 +160,7 @@ settingsSchemaObject = {
|
|||
type: String,
|
||||
optional: true
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
// add any extra properties to settingsSchemaObject (provided by packages for example)
|
||||
_.each(addToSettingsSchema, function(item){
|
||||
|
@ -168,7 +168,7 @@ _.each(addToSettingsSchema, function(item){
|
|||
});
|
||||
|
||||
Settings = new Meteor.Collection("settings");
|
||||
Settings.attachSchema(new SimpleSchema(settingsSchemaObject));
|
||||
Settings.attachSchema(SettingsSchema);
|
||||
|
||||
Settings.allow({
|
||||
insert: isAdminById,
|
||||
|
|
Loading…
Add table
Reference in a new issue