aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorclementbrizard <clementbrizard53@gmail.com>2019-01-12 13:41:45 +0000
committerclementbrizard <clementbrizard53@gmail.com>2019-01-12 13:41:45 +0000
commitc80341655fce5e70ad6da7d812e2ddeb1f8ef7f2 (patch)
tree9f0415756552c5e4d4b18aee50bccbfaa75dd4c3 /server/models/video
parent94a680c095b3007179820ac091189f639dd39e6b (diff)
downloadPeerTube-c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2.tar.gz
PeerTube-c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2.tar.zst
PeerTube-c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2.zip
Change models
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-format-utils.ts4
-rw-r--r--server/models/video/video.ts4
2 files changed, 8 insertions, 0 deletions
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
60 createdAt: video.createdAt, 60 createdAt: video.createdAt,
61 updatedAt: video.updatedAt, 61 updatedAt: video.updatedAt,
62 publishedAt: video.publishedAt, 62 publishedAt: video.publishedAt,
63 originallyPublishedAt: video.originallyPublishedAt,
63 account: { 64 account: {
64 id: formattedAccount.id, 65 id: formattedAccount.id,
65 uuid: formattedAccount.uuid, 66 uuid: formattedAccount.uuid,
@@ -264,6 +265,9 @@ function videoModelToActivityPubObject (video: VideoModel): VideoTorrentObject {
264 state: video.state, 265 state: video.state,
265 commentsEnabled: video.commentsEnabled, 266 commentsEnabled: video.commentsEnabled,
266 published: video.publishedAt.toISOString(), 267 published: video.publishedAt.toISOString(),
268 originallyPublishedAt: video.originallyPublishedAt ?
269 video.originallyPublishedAt.toISOString() :
270 null,
267 updated: video.updatedAt.toISOString(), 271 updated: video.updatedAt.toISOString(),
268 mediaType: 'text/markdown', 272 mediaType: 'text/markdown',
269 content: video.getTruncatedDescription(), 273 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[] = [
102 102
103 { fields: [ 'createdAt' ] }, 103 { fields: [ 'createdAt' ] },
104 { fields: [ 'publishedAt' ] }, 104 { fields: [ 'publishedAt' ] },
105 { fields: [ 'originallyPublishedAt' ] },
105 { fields: [ 'duration' ] }, 106 { fields: [ 'duration' ] },
106 { fields: [ 'views' ] }, 107 { fields: [ 'views' ] },
107 { fields: [ 'channelId' ] }, 108 { fields: [ 'channelId' ] },
@@ -684,6 +685,9 @@ export class VideoModel extends Model<VideoModel> {
684 @Column 685 @Column
685 publishedAt: Date 686 publishedAt: Date
686 687
688 @Column
689 originallyPublishedAt: Date
690
687 @ForeignKey(() => VideoChannelModel) 691 @ForeignKey(() => VideoChannelModel)
688 @Column 692 @Column
689 channelId: number 693 channelId: number