aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 10:16:44 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 10:20:38 +0200
commit96f29c0f6d2e623fb088e88200934c5df8da9924 (patch)
treef11e52c12f56733bef70ac7bbde5179c5a5ecc40 /server/models/video
parentad76628b17ff8f25d3402d6d669b274116bbf76c (diff)
downloadPeerTube-96f29c0f6d2e623fb088e88200934c5df8da9924.tar.gz
PeerTube-96f29c0f6d2e623fb088e88200934c5df8da9924.tar.zst
PeerTube-96f29c0f6d2e623fb088e88200934c5df8da9924.zip
Optimize SQL requests of videos AP endpoints
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-format-utils.ts5
-rw-r--r--server/models/video/video.ts2
2 files changed, 4 insertions, 3 deletions
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts
index fae38507b..a9a58624d 100644
--- a/server/models/video/video-format-utils.ts
+++ b/server/models/video/video-format-utils.ts
@@ -112,12 +112,13 @@ function videoModelToFormattedDetailsJSON (video: VideoModel): VideoDetails {
112 } 112 }
113 }) 113 })
114 114
115 const tags = video.Tags ? video.Tags.map(t => t.name) : []
115 const detailsJson = { 116 const detailsJson = {
116 support: video.support, 117 support: video.support,
117 descriptionPath: video.getDescriptionPath(), 118 descriptionPath: video.getDescriptionAPIPath(),
118 channel: video.VideoChannel.toFormattedJSON(), 119 channel: video.VideoChannel.toFormattedJSON(),
119 account: video.VideoChannel.Account.toFormattedJSON(), 120 account: video.VideoChannel.Account.toFormattedJSON(),
120 tags: video.Tags.map(t => t.name), 121 tags,
121 commentsEnabled: video.commentsEnabled, 122 commentsEnabled: video.commentsEnabled,
122 waitTranscoding: video.waitTranscoding, 123 waitTranscoding: video.waitTranscoding,
123 state: { 124 state: {
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index c7cd2890c..ce2153f87 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1406,7 +1406,7 @@ export class VideoModel extends Model<VideoModel> {
1406 return getVideoFileResolution(originalFilePath) 1406 return getVideoFileResolution(originalFilePath)
1407 } 1407 }
1408 1408
1409 getDescriptionPath () { 1409 getDescriptionAPIPath () {
1410 return `/api/${API_VERSION}/videos/${this.uuid}/description` 1410 return `/api/${API_VERSION}/videos/${this.uuid}/description`
1411 } 1411 }
1412 1412