aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/request.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/models/request.js b/server/models/request.js
index 4d521919a..4e510e18a 100644
--- a/server/models/request.js
+++ b/server/models/request.js
@@ -19,14 +19,15 @@ let timer = null
19 19
20const RequestSchema = mongoose.Schema({ 20const RequestSchema = mongoose.Schema({
21 request: mongoose.Schema.Types.Mixed, 21 request: mongoose.Schema.Types.Mixed,
22 to: [ { type: mongoose.Schema.Types.ObjectId, ref: 'users' } ] 22 to: [ { type: mongoose.Schema.Types.ObjectId, ref: 'Pod' } ]
23}) 23})
24 24
25RequestSchema.statics = { 25RequestSchema.statics = {
26 activate, 26 activate,
27 deactivate, 27 deactivate,
28 flush, 28 flush,
29 forceSend 29 forceSend,
30 list
30} 31}
31 32
32RequestSchema.pre('save', function (next) { 33RequestSchema.pre('save', function (next) {
@@ -53,7 +54,7 @@ mongoose.model('Request', RequestSchema)
53 54
54function activate () { 55function activate () {
55 logger.info('Requests scheduler activated.') 56 logger.info('Requests scheduler activated.')
56 timer = setInterval(makeRequests.bind(this), constants.INTERVAL) 57 timer = setInterval(makeRequests.bind(this), constants.REQUESTS_INTERVAL)
57} 58}
58 59
59function deactivate () { 60function deactivate () {
@@ -72,6 +73,10 @@ function forceSend () {
72 makeRequests.call(this) 73 makeRequests.call(this)
73} 74}
74 75
76function list (callback) {
77 this.find({ }, callback)
78}
79
75// --------------------------------------------------------------------------- 80// ---------------------------------------------------------------------------
76 81
77// Make a requests to friends of a certain type 82// Make a requests to friends of a certain type