From c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2 Mon Sep 17 00:00:00 2001 From: clementbrizard Date: Sat, 12 Jan 2019 13:41:45 +0000 Subject: Change models --- server/models/video/video-format-utils.ts | 4 ++++ server/models/video/video.ts | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'server/models') diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index de0747f22..7a9513cbe 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -60,6 +60,7 @@ function videoModelToFormattedJSON (video: VideoModel, options?: VideoFormatting createdAt: video.createdAt, updatedAt: video.updatedAt, publishedAt: video.publishedAt, + originallyPublishedAt: video.originallyPublishedAt, account: { id: formattedAccount.id, uuid: formattedAccount.uuid, @@ -264,6 +265,9 @@ function videoModelToActivityPubObject (video: VideoModel): VideoTorrentObject { state: video.state, commentsEnabled: video.commentsEnabled, published: video.publishedAt.toISOString(), + originallyPublishedAt: video.originallyPublishedAt ? + video.originallyPublishedAt.toISOString() : + null, updated: video.updatedAt.toISOString(), mediaType: 'text/markdown', content: video.getTruncatedDescription(), diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 80a6c7832..806b6e046 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -102,6 +102,7 @@ const indexes: Sequelize.DefineIndexesOptions[] = [ { fields: [ 'createdAt' ] }, { fields: [ 'publishedAt' ] }, + { fields: [ 'originallyPublishedAt' ] }, { fields: [ 'duration' ] }, { fields: [ 'views' ] }, { fields: [ 'channelId' ] }, @@ -684,6 +685,9 @@ export class VideoModel extends Model { @Column publishedAt: Date + @Column + originallyPublishedAt: Date + @ForeignKey(() => VideoChannelModel) @Column channelId: number -- cgit v1.2.3