aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/requestToPod.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-11 21:50:51 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-19 21:22:28 +0100
commitfeb4bdfd9b46e87aadfa7c0d5338cde887d1f58c (patch)
tree2abc9fbc9569760e218fd52835850b757344b420 /server/models/requestToPod.js
parent108626609eda75e4ecc0a83a650a4d53c46220e0 (diff)
downloadPeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.gz
PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.tar.zst
PeerTube-feb4bdfd9b46e87aadfa7c0d5338cde887d1f58c.zip
First version with PostgreSQL
Diffstat (limited to 'server/models/requestToPod.js')
-rw-r--r--server/models/requestToPod.js30
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
5module.exports = function (sequelize, DataTypes) {
6 const RequestToPod = sequelize.define('RequestToPod', {}, {
7 classMethods: {
8 removePodOf
9 }
10 })
11
12 return RequestToPod
13}
14
15// ---------------------------------------------------------------------------
16
17function 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}