aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request-to-pod.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-05-22 20:58:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-05-25 17:32:16 +0200
commite02643f32e4c97ca307f8fc5b69be79c40d70a3b (patch)
treeb7f6269913cd5a0e4f26a9461a043deb0c168be0 /server/models/request-to-pod.ts
parent65fcc3119c334b75dd13bcfdebf186afdc580a8f (diff)
downloadPeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.gz
PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.tar.zst
PeerTube-e02643f32e4c97ca307f8fc5b69be79c40d70a3b.zip
Type models
Diffstat (limited to 'server/models/request-to-pod.ts')
-rw-r--r--server/models/request-to-pod.ts32
1 files changed, 24 insertions, 8 deletions
diff --git a/server/models/request-to-pod.ts b/server/models/request-to-pod.ts
index 479202e40..681f808b7 100644
--- a/server/models/request-to-pod.ts
+++ b/server/models/request-to-pod.ts
@@ -1,5 +1,19 @@
1module.exports = function (sequelize, DataTypes) { 1import * as Sequelize from 'sequelize'
2 const RequestToPod = sequelize.define('RequestToPod', {}, { 2
3import { addMethodsToModel } from './utils'
4import {
5 RequestToPodClass,
6 RequestToPodInstance,
7 RequestToPodAttributes,
8
9 RequestToPodMethods
10} from './request-to-pod-interface'
11
12let RequestToPod: Sequelize.Model<RequestToPodInstance, RequestToPodAttributes>
13let removeByRequestIdsAndPod: RequestToPodMethods.RemoveByRequestIdsAndPod
14
15export default function (sequelize, DataTypes) {
16 RequestToPod = sequelize.define('RequestToPod', {}, {
3 indexes: [ 17 indexes: [
4 { 18 {
5 fields: [ 'requestId' ] 19 fields: [ 'requestId' ]
@@ -11,18 +25,20 @@ module.exports = function (sequelize, DataTypes) {
11 fields: [ 'requestId', 'podId' ], 25 fields: [ 'requestId', 'podId' ],
12 unique: true 26 unique: true
13 } 27 }
14 ], 28 ]
15 classMethods: {
16 removeByRequestIdsAndPod
17 }
18 }) 29 })
19 30
31 const classMethods = [
32 removeByRequestIdsAndPod
33 ]
34 addMethodsToModel(RequestToPod, classMethods)
35
20 return RequestToPod 36 return RequestToPod
21} 37}
22 38
23// --------------------------------------------------------------------------- 39// ---------------------------------------------------------------------------
24 40
25function removeByRequestIdsAndPod (requestsIds, podId, callback) { 41removeByRequestIdsAndPod = function (requestsIds, podId, callback) {
26 if (!callback) callback = function () { /* empty */ } 42 if (!callback) callback = function () { /* empty */ }
27 43
28 const query = { 44 const query = {
@@ -34,5 +50,5 @@ function removeByRequestIdsAndPod (requestsIds, podId, callback) {
34 } 50 }
35 } 51 }
36 52
37 this.destroy(query).asCallback(callback) 53 RequestToPod.destroy(query).asCallback(callback)
38} 54}