diff options
author | Chocobozzz <me@florianbigard.com> | 2019-01-02 16:37:43 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-01-09 11:15:15 +0100 |
commit | dc13348070d808d0ba3feb56a435b835c2e7e791 (patch) | |
tree | 887202a33f1aa680fd8ece6ee465381f3931c64e /server/models/video | |
parent | 6e7e63b83f08ba68edc2bb9f72ff03d1802e45df (diff) | |
download | PeerTube-dc13348070d808d0ba3feb56a435b835c2e7e791.tar.gz PeerTube-dc13348070d808d0ba3feb56a435b835c2e7e791.tar.zst PeerTube-dc13348070d808d0ba3feb56a435b835c2e7e791.zip |
Add import finished and video published notifs
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-file.ts | 2 | ||||
-rw-r--r-- | server/models/video/video-import.ts | 4 | ||||
-rw-r--r-- | server/models/video/video.ts | 10 |
3 files changed, 14 insertions, 2 deletions
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 3fd2d5a99..0fd868cd6 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { values } from 'lodash' | ||
2 | import { | 1 | import { |
3 | AllowNull, | 2 | AllowNull, |
4 | BelongsTo, | 3 | BelongsTo, |
@@ -20,7 +19,6 @@ import { | |||
20 | isVideoFileSizeValid, | 19 | isVideoFileSizeValid, |
21 | isVideoFPSResolutionValid | 20 | isVideoFPSResolutionValid |
22 | } from '../../helpers/custom-validators/videos' | 21 | } from '../../helpers/custom-validators/videos' |
23 | import { CONSTRAINTS_FIELDS } from '../../initializers' | ||
24 | import { throwIfNotValid } from '../utils' | 22 | import { throwIfNotValid } from '../utils' |
25 | import { VideoModel } from './video' | 23 | import { VideoModel } from './video' |
26 | import * as Sequelize from 'sequelize' | 24 | import * as Sequelize from 'sequelize' |
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index 8d442b3f8..c723e57c0 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts | |||
@@ -144,6 +144,10 @@ export class VideoImportModel extends Model<VideoImportModel> { | |||
144 | }) | 144 | }) |
145 | } | 145 | } |
146 | 146 | ||
147 | getTargetIdentifier () { | ||
148 | return this.targetUrl || this.magnetUri || this.torrentName | ||
149 | } | ||
150 | |||
147 | toFormattedJSON (): VideoImport { | 151 | toFormattedJSON (): VideoImport { |
148 | const videoFormatOptions = { | 152 | const videoFormatOptions = { |
149 | completeDescription: true, | 153 | completeDescription: true, |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index fc200e5d1..80a6c7832 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -94,6 +94,7 @@ import { | |||
94 | import * as validator from 'validator' | 94 | import * as validator from 'validator' |
95 | import { UserVideoHistoryModel } from '../account/user-video-history' | 95 | import { UserVideoHistoryModel } from '../account/user-video-history' |
96 | import { UserModel } from '../account/user' | 96 | import { UserModel } from '../account/user' |
97 | import { VideoImportModel } from './video-import' | ||
97 | 98 | ||
98 | // FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation | 99 | // FIXME: Define indexes here because there is an issue with TS and Sequelize.literal when called directly in the annotation |
99 | const indexes: Sequelize.DefineIndexesOptions[] = [ | 100 | const indexes: Sequelize.DefineIndexesOptions[] = [ |
@@ -785,6 +786,15 @@ export class VideoModel extends Model<VideoModel> { | |||
785 | }) | 786 | }) |
786 | VideoBlacklist: VideoBlacklistModel | 787 | VideoBlacklist: VideoBlacklistModel |
787 | 788 | ||
789 | @HasOne(() => VideoImportModel, { | ||
790 | foreignKey: { | ||
791 | name: 'videoId', | ||
792 | allowNull: true | ||
793 | }, | ||
794 | onDelete: 'set null' | ||
795 | }) | ||
796 | VideoImport: VideoImportModel | ||
797 | |||
788 | @HasMany(() => VideoCaptionModel, { | 798 | @HasMany(() => VideoCaptionModel, { |
789 | foreignKey: { | 799 | foreignKey: { |
790 | name: 'videoId', | 800 | name: 'videoId', |