diff --git a/packages/nova-voting/lib/custom_fields.js b/packages/nova-voting/lib/custom_fields.js index d9278b0b9..0dcf366a9 100644 --- a/packages/nova-voting/lib/custom_fields.js +++ b/packages/nova-voting/lib/custom_fields.js @@ -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) */