This repository was archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdb.js
More file actions
76 lines (68 loc) · 1.39 KB
/
db.js
File metadata and controls
76 lines (68 loc) · 1.39 KB
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
var mongoose = require("mongoose");
var passportLocalMongoose = require('passport-local-mongoose');
var uristring = process.env.MONGODB_URI || process.env.MONGOLAB_URI || 'mongodb://localhost/FinalFourVolunteer';
var mongoOptions = {
db : {
safe : true
}
};
var db = mongoose.connect(uristring, mongoOptions, function(err, res) {
// if (err) {
// console.log('ERROR connecting to: ' + uristring + '. ' + err);
// } else {
// console.log('Succeeded connected to: ' + uristring);
// }
});
var Schema = mongoose.Schema, ObjectId = Schema.ObjectId;
var userSchema = new Schema({
username : {
type : String
},
password : {
type : String
}
})
var groupSchema = new Schema({
name : {
type : String
},
dateCreated : {
type : Date
},
recipients : {
type : Array
},
valid : {
type : Boolean
}
})
//Account.plugin(passportLocalMongoose);
var alertSchema = new Schema({
alertText : {
type : String,
},
alertTime : {
type : Date,
},
alertStatus : {
type : Boolean,
}
})
var tripSchema = new Schema({
pickupLocation : {
type : String,
},
dropoffLocation : {
type : String,
},
pickupTime : {
type : Date
},
dropoffTime : {
type : Date
}
})
exports.Group = mongoose.model('groups', groupSchema);
exports.User = mongoose.model('users', userSchema);
exports.ShuttleTrips = mongoose.model('shuttleTrips', tripSchema);
exports.Alert = mongoose.model('alerts', alertSchema);