mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Optimize SQL requests of watch page API endpoints
This commit is contained in:
parent
e972e046db
commit
627621c1e8
15 changed files with 68 additions and 60 deletions
|
@ -293,7 +293,7 @@ async function getUserVideoQuotaUsed (req: express.Request, res: express.Respons
|
|||
}
|
||||
|
||||
async function getUserVideoRating (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const videoId = +req.params.videoId
|
||||
const videoId = res.locals.video.id
|
||||
const accountId = +res.locals.oauth.token.User.Account.id
|
||||
|
||||
const ratingObj = await AccountVideoRateModel.load(accountId, videoId, null)
|
||||
|
|
|
@ -86,7 +86,7 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo
|
|||
let resultList: ResultList<VideoCommentModel>
|
||||
|
||||
if (video.commentsEnabled === true) {
|
||||
resultList = await VideoCommentModel.listThreadCommentsForApi(res.locals.video.id, res.locals.videoCommentThread.id)
|
||||
resultList = await VideoCommentModel.listThreadCommentsForApi(video.id, res.locals.videoCommentThread.id)
|
||||
} else {
|
||||
resultList = {
|
||||
total: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue