-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsettings.model.js
More file actions
35 lines (34 loc) · 884 Bytes
/
settings.model.js
File metadata and controls
35 lines (34 loc) · 884 Bytes
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
"use strict";
const mongoose = require("mongoose");
//describes the data type
const settings = new mongoose.Schema({
openTime: {
type: Date,
default: Date.now() + 2628000000 // One month from now.
},
closeTime: {
type: Date,
default: Date.now() + 31540000000 + 2628000000 // One year and 1 month from now.
},
confirmTime: {
type: Date,
default: Date.now() + 31540000000 + 2628000000 + 2628000000 // 1 year and 2 months from now.
},
isRemote: {
type: Boolean,
default: false
},
checkinOpen: {
type: Boolean,
default: false
}
});
settings.methods.toJSON = function(options) {
const ss = this.toObject(options);
delete ss.__v;
ss.id = ss._id;
delete ss._id;
return ss;
};
//export the model
module.exports = mongoose.model("Settings", settings);