mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
45 lines
783 B
JavaScript
45 lines
783 B
JavaScript
![]() |
Telescope.newsletter = {};
|
||
|
|
||
|
var campaignSchema = new SimpleSchema({
|
||
|
_id: {
|
||
|
type: String,
|
||
|
optional: true
|
||
|
},
|
||
|
createdAt: {
|
||
|
type: Date,
|
||
|
optional: true
|
||
|
},
|
||
|
sentAt: {
|
||
|
type: String,
|
||
|
optional: true
|
||
|
},
|
||
|
status: {
|
||
|
type: String,
|
||
|
optional: true
|
||
|
},
|
||
|
posts: {
|
||
|
type: [String],
|
||
|
optional: true
|
||
|
},
|
||
|
webHits: {
|
||
|
type: Number,
|
||
|
optional: true
|
||
|
},
|
||
|
});
|
||
|
|
||
|
Campaigns = new Meteor.Collection("campaigns", {
|
||
|
schema: campaignSchema
|
||
|
});
|
||
|
|
||
|
// create new "campaign" view for all posts from the past X days that haven't been scheduled yet
|
||
|
Posts.views.add("campaign", function (terms) {
|
||
|
return {
|
||
|
find: {
|
||
|
scheduledAt: {$exists: false},
|
||
|
postedAt: {
|
||
|
$gte: terms.after
|
||
|
}
|
||
|
},
|
||
|
options: {sort: {baseScore: -1}}
|
||
|
};
|
||
|
});
|