aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/request-to-pod.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-16 09:45:46 +0200
commit74889a71fe687dda74f2a687653122327807af36 (patch)
treee938e8b6401b74fbec80513a877d9967f2c0dbcd /server/models/request-to-pod.ts
parent15a302943d84bc0978b84fe33110c4daa451d311 (diff)
downloadPeerTube-74889a71fe687dda74f2a687653122327807af36.tar.gz
PeerTube-74889a71fe687dda74f2a687653122327807af36.tar.zst
PeerTube-74889a71fe687dda74f2a687653122327807af36.zip
Reorganize model files
Diffstat (limited to 'server/models/request-to-pod.ts')
-rw-r--r--server/models/request-to-pod.ts54
1 files changed, 0 insertions, 54 deletions
diff --git a/server/models/request-to-pod.ts b/server/models/request-to-pod.ts
deleted file mode 100644
index d2f31463c..000000000
--- a/server/models/request-to-pod.ts
+++ /dev/null
@@ -1,54 +0,0 @@
1import * as Sequelize from 'sequelize'
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: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) {
16 RequestToPod = sequelize.define<RequestToPodInstance, RequestToPodAttributes>('RequestToPod', {}, {
17 indexes: [
18 {
19 fields: [ 'requestId' ]
20 },
21 {
22 fields: [ 'podId' ]
23 },
24 {
25 fields: [ 'requestId', 'podId' ],
26 unique: true
27 }
28 ]
29 })
30
31 const classMethods = [
32 removeByRequestIdsAndPod
33 ]
34 addMethodsToModel(RequestToPod, classMethods)
35
36 return RequestToPod
37}
38
39// ---------------------------------------------------------------------------
40
41removeByRequestIdsAndPod = function (requestsIds: number[], podId: number, callback?: RequestToPodMethods.RemoveByRequestIdsAndPodCallback) {
42 if (!callback) callback = function () { /* empty */ }
43
44 const query = {
45 where: {
46 requestId: {
47 $in: requestsIds
48 },
49 podId: podId
50 }
51 }
52
53 RequestToPod.destroy(query).asCallback(callback)
54}