forked from openhab/openhab-cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeinvites.js
33 lines (29 loc) · 982 Bytes
/
makeinvites.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
var config = require('./config.json'),
mongoose = require('mongoose'),
uuid = require('uuid'),
mongooseTypes = require('mongoose-types'),
Invitation = require('./models/invitation'),
system = require('./system'),
MongoConnect = require('./system/mongoconnect'),
mongoConnect;
system.setConfiguration(config);
mongoConnect = new MongoConnect(system);
mongoConnect.connect(mongoose);
mongooseTypes.loadTypes(mongoose);
console.log('Making 10 invitations!');
for (i=0; i<10; i++) {
var invitationCode,
invite;
invitationCode = uuid.v1();
invite = new Invitation({code: invitationCode, email: '[email protected]'});
console.log('openHAB-cloud: New invitation code ' + invitationCode);
invite.save(function (err, invitation) {
console.log('callback');
if (err) {
console.log('Error');
} else {
console.log('Saved: ' + invitation);
}
});
}
console.log('Complete!');