forked from persnickety-opossum/kraken-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mockData.js
132 lines (117 loc) · 2.91 KB
/
mockData.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
var mongoose = require('mongoose');
var Comment = require('./db/Comment');
var User = require('./db/User');
var Venue = require('./db/Venue');
if (!process.env.production) var config = require('./config');
var dbURI = process.env.DB_URI || config.dbURI
mongoose.connect(dbURI);
Venue.find().remove().exec();
User.find().remove().exec();
Comment.find().remove().exec();
var user1 = new User({
token: 'lol',
coordinates: '37.783699,-122.409023'
});
user1.save();
var user2 = new User({
token: 'wat',
coordinates: '37.781175,-122.406243'
});
user2.save();
var hackreactor = new Venue({
title: 'Hack Reactor',
attendees: {},
ratings: {},
description: 'The CS degree for the 21st century',
address: '944 Market St. #8, San Francisco, CA',
latitude: 37.783585,
longitude: -122.408955,
creator: user1.id,
datetime: new Date().toISOString()
});
hackreactor.ratings[user1.id] = 10;
hackreactor.ratings[user2.id] = 8;
hackreactor.save();
var tempest = new Venue({
title: 'Tempest',
attendees: {},
ratings: {},
description: 'No-frills watering hole',
address: '431 Natoma St., San Francisco, CA',
latitude: 37.7811679,
longitude: -122.4062895,
creator: user2.id,
datetime: new Date().toISOString()
});
tempest.ratings[user1.id] = 5;
tempest.ratings[user2.id] = 9;
tempest.save();
var comment1 = new Comment({
creator: user1.id,
icon: 'hourglass',
content: "Allen's hair is amazing.",
venue: hackreactor.id,
datetime: new Date().toISOString(),
atVenue: true,
votes: 1337
});
comment1.save();
var comment2 = new Comment({
creator: user2.id,
icon: 'hourglass',
content: 'OMG pictures?',
venue: hackreactor.id,
datetime: new Date().toISOString(),
atVenue: false,
votes: 0
});
comment2.save();
var comment3 = new Comment({
creator: user1.id,
icon: 'hourglass',
content: 'JavaScript!',
venue: hackreactor.id,
datetime: new Date().toISOString(),
atVenue: true,
votes: 1
});
comment3.save();
var comment4 = new Comment({
creator: user2.id,
icon: 'hourglass',
content: 'Very chill',
venue: tempest.id,
datetime: new Date().toISOString(),
atVenue: true,
votes: 1
});
comment4.save();
var comment5 = new Comment({
creator: user1.id,
icon: 'hourglass',
content: 'arglebargle',
venue: tempest.id,
datetime: new Date().toISOString(),
atVenue: false,
votes: -1
});
comment5.save();
var comment6 = new Comment({
creator: user2.id,
icon: 'hourglass',
content: 'O_O;',
venue: tempest.id,
datetime: new Date().toISOString(),
atVenue: true,
votes: 2
});
comment6.save();
hackreactor.comments = [comment1.id, comment2.id, comment3.id];
hackreactor.attendees[user1.id] = comment3.datetime;
hackreactor.attendees[user2.id] = comment2.datetime;
hackreactor.save();
tempest.comments = [comment4.id, comment5.id, comment6.id];
hackreactor.attendees[user1.id] = comment3.datetime;
hackreactor.attendees[user2.id] = comment3.datetime;
tempest.save();
mongoose.connection.close();