2017-03-23 16:27:59 +09:00
|
|
|
import Users from "meteor/vulcan:users";
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2017-02-16 10:04:00 +01:00
|
|
|
// note: leverage weak dependencies on packages
|
2017-03-23 16:27:59 +09:00
|
|
|
const Posts = Package['vulcan:posts'] ? Package['vulcan:posts'].default : null;
|
|
|
|
const Categories = Package['vulcan:categories'] ? Package['vulcan:categories'].default : null;
|
2017-02-16 10:04:00 +01:00
|
|
|
|
2016-08-07 19:26:08 +09:00
|
|
|
Users.addField([
|
|
|
|
{
|
2017-01-18 10:18:33 +09:00
|
|
|
fieldName: 'subscribedItems',
|
2016-08-07 19:26:08 +09:00
|
|
|
fieldSchema: {
|
|
|
|
type: Object,
|
|
|
|
optional: true,
|
|
|
|
blackbox: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this
|
2016-08-07 19:26:08 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-01-18 10:18:33 +09:00
|
|
|
fieldName: 'subscribers',
|
2016-08-07 19:26:08 +09:00
|
|
|
fieldSchema: {
|
2017-03-16 01:25:08 +08:00
|
|
|
type: Array,
|
|
|
|
optional: true,
|
|
|
|
hidden: true, // never show this,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers.$',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
2016-08-07 19:26:08 +09:00
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this,
|
2016-08-07 19:26:08 +09:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2017-01-18 10:18:33 +09:00
|
|
|
fieldName: 'subscriberCount',
|
2016-08-07 19:26:08 +09:00
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
2016-08-07 19:26:08 +09:00
|
|
|
]);
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2017-03-23 16:27:59 +09:00
|
|
|
// check if vulcan:posts exists, if yes, add the custom fields to Posts
|
2017-02-16 10:04:00 +01:00
|
|
|
if (!!Posts) {
|
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
Posts.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers',
|
|
|
|
fieldSchema: {
|
2017-03-16 01:25:08 +08:00
|
|
|
type: Array,
|
|
|
|
optional: true,
|
|
|
|
hidden: true, // never show this
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers.$',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
2016-08-14 17:59:20 +02:00
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this
|
2016-07-27 18:00:40 +02:00
|
|
|
}
|
2016-07-27 10:38:43 +02:00
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
]);
|
2016-07-27 10:38:43 +02:00
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
2017-03-23 16:27:59 +09:00
|
|
|
// check if vulcan:categories exists, if yes, add the custom fields to Categories
|
2017-02-16 10:04:00 +01:00
|
|
|
if (!!Categories) {
|
2017-03-16 01:25:08 +08:00
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
Categories.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers',
|
|
|
|
fieldSchema: {
|
2017-03-16 01:25:08 +08:00
|
|
|
type: Array,
|
|
|
|
optional: true,
|
|
|
|
hidden: true, // never show this
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscribers.$',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
2016-08-14 17:59:20 +02:00
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this
|
2016-08-12 14:33:51 +02:00
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'subscriberCount',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
2016-11-18 10:03:01 +01:00
|
|
|
hidden: true, // never show this
|
2016-08-12 14:33:51 +02:00
|
|
|
}
|
|
|
|
}
|
2016-08-14 17:59:20 +02:00
|
|
|
]);
|
2016-08-12 14:33:51 +02:00
|
|
|
|
2016-08-14 17:59:20 +02:00
|
|
|
}
|