mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00
80 lines
No EOL
1.7 KiB
JavaScript
80 lines
No EOL
1.7 KiB
JavaScript
/*
|
|
|
|
Seed the database with some dummy content.
|
|
|
|
*/
|
|
|
|
import Movies from '../modules/movies/collection.js';
|
|
import Users from 'meteor/vulcan:users';
|
|
import { newMutation } from 'meteor/vulcan:core';
|
|
|
|
const seedData = [
|
|
{
|
|
name: 'Star Wars',
|
|
year: '1973',
|
|
review: `A classic.`,
|
|
privateComments: `Actually, I don't really like Star Wars…`
|
|
},
|
|
{
|
|
name: 'Die Hard',
|
|
year: '1987',
|
|
review: `A must-see if you like action movies.`,
|
|
privateComments: `I love Bruce Willis so much!`
|
|
},
|
|
{
|
|
name: 'Terminator',
|
|
year: '1983',
|
|
review: `Once again, Schwarzenegger shows why he's the boss.`,
|
|
privateComments: `Terminator is my favorite movie ever. `
|
|
},
|
|
{
|
|
name: 'Jaws',
|
|
year: '1971',
|
|
review: 'The original blockbuster.',
|
|
privateComments: `I'm scared of sharks…`
|
|
},
|
|
{
|
|
name: 'Die Hard II',
|
|
year: '1991',
|
|
review: `Another classic.`
|
|
},
|
|
{
|
|
name: 'Rush Hour',
|
|
year: '1993',
|
|
review: `Jackie Chan at his best.`,
|
|
},
|
|
{
|
|
name: 'Citizen Kane',
|
|
year: '1943',
|
|
review: `A disappointing lack of action sequences.`,
|
|
},
|
|
{
|
|
name: 'Commando',
|
|
year: '1983',
|
|
review: 'A good contender for highest kill count ever.',
|
|
},
|
|
];
|
|
|
|
Meteor.startup(function () {
|
|
if (Users.find().fetch().length === 0) {
|
|
Accounts.createUser({
|
|
username: 'DemoUser',
|
|
email: 'dummyuser@telescopeapp.org',
|
|
profile: {
|
|
isDummy: true
|
|
}
|
|
});
|
|
}
|
|
const currentUser = Users.findOne();
|
|
if (Movies.find().fetch().length === 0) {
|
|
seedData.forEach(document => {
|
|
newMutation({
|
|
action: 'movies.new',
|
|
collection: Movies,
|
|
document: document,
|
|
currentUser: currentUser,
|
|
validate: false
|
|
});
|
|
});
|
|
}
|
|
}); |