diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-15 17:56:21 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | d846501818c2d29e66e6fd141789cb04fd55a437 (patch) | |
tree | 9b807a84459edd400fd36325c49c4adfbd6c4fd2 /server/models/video/video-channel-share.ts | |
parent | 8e10cf1a5a438a00e5f7e0691cb830769867cffc (diff) | |
download | PeerTube-d846501818c2d29e66e6fd141789cb04fd55a437.tar.gz PeerTube-d846501818c2d29e66e6fd141789cb04fd55a437.tar.zst PeerTube-d846501818c2d29e66e6fd141789cb04fd55a437.zip |
Handle announces in inbox
Diffstat (limited to 'server/models/video/video-channel-share.ts')
-rw-r--r-- | server/models/video/video-channel-share.ts | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/server/models/video/video-channel-share.ts b/server/models/video/video-channel-share.ts new file mode 100644 index 000000000..b6199279f --- /dev/null +++ b/server/models/video/video-channel-share.ts | |||
@@ -0,0 +1,49 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | import { addMethodsToModel } from '../utils' | ||
4 | import { VideoChannelShareAttributes, VideoChannelShareInstance } from './video-channel-share-interface' | ||
5 | |||
6 | let VideoChannelShare: Sequelize.Model<VideoChannelShareInstance, VideoChannelShareAttributes> | ||
7 | |||
8 | export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { | ||
9 | VideoChannelShare = sequelize.define<VideoChannelShareInstance, VideoChannelShareAttributes>('VideoChannelShare', | ||
10 | { }, | ||
11 | { | ||
12 | indexes: [ | ||
13 | { | ||
14 | fields: [ 'accountId' ] | ||
15 | }, | ||
16 | { | ||
17 | fields: [ 'videoChannelId' ] | ||
18 | } | ||
19 | ] | ||
20 | } | ||
21 | ) | ||
22 | |||
23 | const classMethods = [ | ||
24 | associate | ||
25 | ] | ||
26 | addMethodsToModel(VideoChannelShare, classMethods) | ||
27 | |||
28 | return VideoChannelShare | ||
29 | } | ||
30 | |||
31 | // ------------------------------ METHODS ------------------------------ | ||
32 | |||
33 | function associate (models) { | ||
34 | VideoChannelShare.belongsTo(models.Account, { | ||
35 | foreignKey: { | ||
36 | name: 'accountId', | ||
37 | allowNull: false | ||
38 | }, | ||
39 | onDelete: 'cascade' | ||
40 | }) | ||
41 | |||
42 | VideoChannelShare.belongsTo(models.VideoChannel, { | ||
43 | foreignKey: { | ||
44 | name: 'videoChannelId', | ||
45 | allowNull: true | ||
46 | }, | ||
47 | onDelete: 'cascade' | ||
48 | }) | ||
49 | } | ||