-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsupportModel.js
47 lines (43 loc) · 894 Bytes
/
supportModel.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
const mongoose = require('mongoose');
// Create schema
const Schema = mongoose.Schema;
// Setup support request schema
const supportSchema = new Schema({
firstName: {
type: String,
},
lastName: {
type: String,
},
email: {
type: String,
},
storeUrl: {
type: String,
},
storePassword: {
type: String,
},
theme: {
type: String,
},
subject: {
type: String,
},
message: {
type: String,
},
file: Schema.Types.Mixed,
filePath: {
type: String,
},
browser: Schema.Types.Mixed,
location: Schema.Types.Mixed,
helpScoutResponse: Schema.Types.Mixed,
});
// Extend Support as a mongoose model for saving the db
const Support = (module.exports = mongoose.model('support', supportSchema));
// Wrapper for finding and limiting DB calls
module.exports.get = function(callback, limit) {
Support.find(callback).limit(limit);
};