diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 09:45:46 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-16 09:45:46 +0200 |
commit | 74889a71fe687dda74f2a687653122327807af36 (patch) | |
tree | e938e8b6401b74fbec80513a877d9967f2c0dbcd /server/models/request-to-pod.ts | |
parent | 15a302943d84bc0978b84fe33110c4daa451d311 (diff) | |
download | PeerTube-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.ts | 54 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | import { addMethodsToModel } from './utils' | ||
4 | import { | ||
5 | RequestToPodClass, | ||
6 | RequestToPodInstance, | ||
7 | RequestToPodAttributes, | ||
8 | |||
9 | RequestToPodMethods | ||
10 | } from './request-to-pod-interface' | ||
11 | |||
12 | let RequestToPod: Sequelize.Model<RequestToPodInstance, RequestToPodAttributes> | ||
13 | let removeByRequestIdsAndPod: RequestToPodMethods.RemoveByRequestIdsAndPod | ||
14 | |||
15 | export 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 | |||
41 | removeByRequestIdsAndPod = 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 | } | ||