|
@@ -8,27 +8,57 @@
|
|
|
*/
|
|
|
|
|
|
if (Posts.find().count() === 0) {
|
|
|
- var data = [
|
|
|
- {
|
|
|
- title: "Introducing Telescope",
|
|
|
- url: "http://sachagreif.com/introducing-telescope",
|
|
|
- author: "Sacha Greif"
|
|
|
- },
|
|
|
- {
|
|
|
- title: "Meteor",
|
|
|
- url: "http://meteor.com",
|
|
|
- author: "Tom Coleman"
|
|
|
- },
|
|
|
- {
|
|
|
- title: "The Meteor book",
|
|
|
- url: "http://themeteorbook.com",
|
|
|
- author: "Meteor Inc."
|
|
|
- }
|
|
|
- ];
|
|
|
-
|
|
|
- data.forEach(function (post) {
|
|
|
- Meteor._debug("Inserting", post);
|
|
|
- Posts.insert(post);
|
|
|
+ var now = new Date().getTime();
|
|
|
+
|
|
|
+ // Create two users.
|
|
|
+ var tomId = Meteor.users.insert({
|
|
|
+ profile: {name: 'Tom Coleman'}
|
|
|
+ });
|
|
|
+ var tom = Meteor.users.findOne(tomId);
|
|
|
+
|
|
|
+ var sachaId = Meteor.users.insert({
|
|
|
+ profile: {name: 'Sacha Greif'}
|
|
|
+ });
|
|
|
+ var sacha = Meteor.users.findOne(sachaId);
|
|
|
+
|
|
|
+ var telescopeId = Posts.insert({
|
|
|
+ title: "Introducing Telescope",
|
|
|
+ userId: sacha._id,
|
|
|
+ author: sacha.profile.name,
|
|
|
+ url: "http://sachagreif.com/introducing-telescope",
|
|
|
+ submitted: new Date(now - 7 * 3600 * 1000)
|
|
|
+ });
|
|
|
+
|
|
|
+ Comments.insert({
|
|
|
+ postId: telescopeId,
|
|
|
+ userId: tom._id,
|
|
|
+ author: tom.profile.name,
|
|
|
+ submitted: new Date(now - 5 * 3600 * 1000),
|
|
|
+ body: 'Interesting project Sacha, can I get involved?'
|
|
|
+ });
|
|
|
+
|
|
|
+ Comments.insert({
|
|
|
+ postId: telescopeId,
|
|
|
+ userId: sacha._id,
|
|
|
+ author: sacha.profile.name,
|
|
|
+ submitted: new Date(now - 3 * 3600 * 1000),
|
|
|
+ body: 'You sure can Tom!'
|
|
|
+ });
|
|
|
+
|
|
|
+ Posts.insert({
|
|
|
+ title: "Meteor",
|
|
|
+ userId: tom._id,
|
|
|
+ author: tom.profile.name,
|
|
|
+ url: "http://meteor.com",
|
|
|
+ submitted: new Date(now - 10 * 3600 * 1000)
|
|
|
+ });
|
|
|
+
|
|
|
+ Posts.insert({
|
|
|
+ title: "The Meteor book",
|
|
|
+ userId: tom._id,
|
|
|
+ author: tom.profile.name,
|
|
|
+ url: "http://themeteorbook.com",
|
|
|
+ submitted: new Date(now - 12 * 3600 * 1000)
|
|
|
});
|
|
|
}
|
|
|
else {
|