-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.js
43 lines (36 loc) · 1.23 KB
/
schema.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
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/bot');
var Schema = mongoose.Schema;
var userSchema = new Schema({
token: {type: String, unique: true},
id: {type: String, required:true, unique:true}
})
var dropletSchema = new Schema({
dropletId: {type: String, required: true, unique: true},
dropletName: {type: String, required: true},
memory: {type: String, required: true},
disk: {type:String, required: true},
region:{type:String, required: true},
id: {type: String, required: true}
})
var domainSchema = new Schema({
id: {type: String, required: true},
domainName: {type: String, required: true, unique: true},
ttl: {type: Number, required: true}
})
var domainRecordSchema = new Schema({
id: {type: String, required: true},
domainRecordId: {type: String, required: true, unique: true},
typeR: {type: String, required: true},
name: {type: String, required: true}
})
var Users = mongoose.model('Users', userSchema);
var Droplets = mongoose.model('Droplets', dropletSchema);
var Domains = mongoose.model('Domains', domainSchema);
var domainRecords = mongoose.model('domainRecords', domainRecordSchema);
module.exports = {
Users: Users,
Droplets: Droplets,
Domains: Domains,
domainRecords: domainRecords
};