diff options
Diffstat (limited to 'server/models/requestToPod.js')
-rw-r--r-- | server/models/requestToPod.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/server/models/requestToPod.js b/server/models/requestToPod.js new file mode 100644 index 000000000..378c2bdcf --- /dev/null +++ b/server/models/requestToPod.js | |||
@@ -0,0 +1,30 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | // --------------------------------------------------------------------------- | ||
4 | |||
5 | module.exports = function (sequelize, DataTypes) { | ||
6 | const RequestToPod = sequelize.define('RequestToPod', {}, { | ||
7 | classMethods: { | ||
8 | removePodOf | ||
9 | } | ||
10 | }) | ||
11 | |||
12 | return RequestToPod | ||
13 | } | ||
14 | |||
15 | // --------------------------------------------------------------------------- | ||
16 | |||
17 | function removePodOf (requestsIds, podId, callback) { | ||
18 | if (!callback) callback = function () {} | ||
19 | |||
20 | const query = { | ||
21 | where: { | ||
22 | requestId: { | ||
23 | $in: requestsIds | ||
24 | }, | ||
25 | podId: podId | ||
26 | } | ||
27 | } | ||
28 | |||
29 | this.destroy(query).asCallback(callback) | ||
30 | } | ||