node simpl-schema + collection2-core: fix vote by specifying the right type of the array (dont use blackbox in the end!)

This commit is contained in:
xavcz 2017-01-11 10:39:52 +01:00
parent c505fcbaac
commit e894c3224c

View file

@ -29,13 +29,18 @@ Users.addField([
fieldName: '__upvotedComments',
fieldSchema: {
type: Array,
blackbox: true,
publish: false,
optional: true,
viewableBy: ['guests'],
resolveAs: '__upvotedComments: [Vote]',
}
},
{
fieldName: "__upvotedComments.$",
fieldSchema: {
type: voteSchema,
}
},
/**
An array containing posts upvotes
*/
@ -43,13 +48,18 @@ Users.addField([
fieldName: '__upvotedPosts',
fieldSchema: {
type: Array,
blackbox: true,
publish: false,
optional: true,
viewableBy: ['guests'],
resolveAs: '__upvotedPosts: [Vote]',
}
},
{
fieldName: "__upvotedPosts.$",
fieldSchema: {
type: voteSchema,
}
},
/**
An array containing comment downvotes
*/
@ -57,13 +67,19 @@ Users.addField([
fieldName: '__downvotedComments',
fieldSchema: {
type: Array,
blackbox: true,
publish: false,
optional: true,
viewableBy: ['guests'],
resolveAs: '__downvotedComments: [Vote]',
}
},
{
fieldName: "__downvotedComments.$",
fieldSchema: {
type: voteSchema,
}
},
/**
An array containing posts downvotes
*/
@ -71,13 +87,18 @@ Users.addField([
fieldName: '__downvotedPosts',
fieldSchema: {
type: Array,
blackbox: true,
publish: false,
optional: true,
viewableBy: ['guests'],
resolveAs: '__downvotedPosts: [Vote]',
}
},
{
fieldName: "__downvotedPosts.$",
fieldSchema: {
type: voteSchema,
}
},
]);
Posts.addField([
@ -101,13 +122,18 @@ Posts.addField([
fieldName: "upvoters",
fieldSchema: {
type: Array,
blackbox: true,
optional: true,
publish: true,
viewableBy: ['guests'],
resolveAs: 'upvoters: [User]',
}
},
{
fieldName: "upvoters.$",
fieldSchema: {
type: String,
}
},
/**
How many downvotes the post has received
*/
@ -128,13 +154,19 @@ Posts.addField([
fieldName: "downvoters",
fieldSchema: {
type: Array,
blackbox: true,
optional: true,
publish: true,
viewableBy: ['guests'],
resolveAs: 'downvoters: [User]',
}
},
{
fieldName: "downvoters.$",
fieldSchema: {
type: String,
}
},
/**
The post's base score (not factoring in the post's age)
*/
@ -184,13 +216,18 @@ Comments.addField([
fieldName: "upvoters",
fieldSchema: {
type: Array,
blackbox: true,
optional: true,
publish: true,
viewableBy: ['guests'],
resolveAs: 'upvoters: [User]',
}
},
{
fieldName: "upvoters.$",
fieldSchema: {
type: String,
}
},
/**
The number of downvotes the comment has received
*/
@ -211,13 +248,18 @@ Comments.addField([
fieldName: "downvoters",
fieldSchema: {
type: Array,
blackbox: true,
optional: true,
publish: true,
viewableBy: ['guests'],
resolveAs: 'downvoters: [User]',
}
},
{
fieldName: "downvoters.$",
fieldSchema: {
type: String,
}
},
/**
The comment's base score (not factoring in the comment's age)
*/