2016-08-07 19:26:08 +09:00
|
|
|
import PublicationUtils from 'meteor/utilities:smart-publications';
|
|
|
|
import Posts from "meteor/nova:posts";
|
|
|
|
import Users from "meteor/nova:users";
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-08-07 19:26:08 +09:00
|
|
|
Users.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'telescope.subscribedItems',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Object,
|
|
|
|
optional: true,
|
|
|
|
blackbox: true,
|
|
|
|
autoform: {
|
|
|
|
omit: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'telescope.subscribers',
|
|
|
|
fieldSchema: {
|
|
|
|
type: [String],
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
omit: true
|
|
|
|
},
|
|
|
|
publish: true,
|
|
|
|
join: {
|
|
|
|
joinAs: "subscribersArray",
|
|
|
|
collection: () => Users
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'telescope.subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
omit: true
|
|
|
|
}
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
2016-08-07 19:26:08 +09:00
|
|
|
]);
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-07-27 18:00:40 +02:00
|
|
|
Posts.addField([
|
2016-07-27 10:38:43 +02:00
|
|
|
{
|
|
|
|
fieldName: 'subscribers',
|
|
|
|
fieldSchema: {
|
|
|
|
type: [String],
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
2016-07-27 10:42:36 +02:00
|
|
|
omit: true
|
2016-07-27 10:38:43 +02:00
|
|
|
},
|
|
|
|
publish: true,
|
|
|
|
join: {
|
|
|
|
joinAs: "subscribersArray",
|
|
|
|
collection: () => Users
|
|
|
|
}
|
|
|
|
}
|
2016-07-27 18:00:40 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
omit: true
|
|
|
|
}
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
2016-07-27 18:00:40 +02:00
|
|
|
]);
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-08-07 19:26:08 +09:00
|
|
|
PublicationUtils.addToFields(Users.publishedFields.list, ["telescope.subscribedItems", "telescope.subscribers", "telescope.subscriberCount"]);
|
2016-07-27 18:00:40 +02:00
|
|
|
PublicationUtils.addToFields(Posts.publishedFields.list, ["subscribers", "subscriberCount"]);
|