forked from generalassembly-atx/tunely-angular
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathseed.js
72 lines (62 loc) · 1.94 KB
/
seed.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// This file allows us to seed our application with data
// simply run: `node seed.js` from the root of this project folder.
var db = require("./models");
var albumList =[];
albumList.push({
artistName: 'Nine Inch Nails',
name: 'The Downward Spiral',
releaseDate: '1994, March 8',
genres: [ 'industrial', 'industrial metal' ]
});
albumList.push({
artistName: 'Metallica',
name: 'Metallica',
releaseDate: '1991, August 12',
genres: [ 'heavy metal' ]
});
albumList.push({
artistName: 'The Prodigy',
name: 'Music for the Jilted Generation',
releaseDate: '1994, July 4',
genres: [ 'electronica', 'breakbeat hardcore', 'rave', 'jungle' ]
});
albumList.push({
artistName: 'Johnny Cash',
name: 'Unchained',
releaseDate: '1996, November 5',
genres: [ 'country', 'rock' ]
});
var sampleSongs = [];
sampleSongs.push({ name: 'Swamped',
trackNumber: 1
});
sampleSongs.push({ name: "Heaven's a Lie",
trackNumber: 2
});
sampleSongs.push({ name: 'Daylight Dancer',
trackNumber: 3
});
sampleSongs.push({ name: 'Humane',
trackNumber: 4
});
sampleSongs.push({ name: 'Self Deception',
trackNumber: 5
});
sampleSongs.push({ name: 'Aeon',
trackNumber: 6
});
sampleSongs.push({ name: 'Tight Rope',
trackNumber: 7
});
// populate each albums song list
albumList.forEach(function(album) {
album.songs = sampleSongs;
});
db.Album.remove({}, function(err, albums){
db.Album.create(albumList, function(err, albums){
if (err) { return console.log('ERROR', err); }
console.log("all albums:", albums);
console.log("created", albums.length, "albums");
process.exit();
});
});