aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/sql
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-05-05 10:29:35 +0200
committerChocobozzz <me@florianbigard.com>2022-05-05 10:29:35 +0200
commitbae616273d455d225d131eb17c56db6c20a0b6b3 (patch)
treeed2174122d092320cea34c4ae522da6f2131f968 /server/models/video/sql
parentd493e2d4bf0ace177d15e9173d1c02df8c100558 (diff)
downloadPeerTube-bae616273d455d225d131eb17c56db6c20a0b6b3.tar.gz
PeerTube-bae616273d455d225d131eb17c56db6c20a0b6b3.tar.zst
PeerTube-bae616273d455d225d131eb17c56db6c20a0b6b3.zip
Convert followers/following in raw SQL queries
Prevent weird bug in SQL generation
Diffstat (limited to 'server/models/video/sql')
-rw-r--r--server/models/video/sql/video/videos-id-list-query-builder.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/server/models/video/sql/video/videos-id-list-query-builder.ts b/server/models/video/sql/video/videos-id-list-query-builder.ts
index 09cb791db..8692a436a 100644
--- a/server/models/video/sql/video/videos-id-list-query-builder.ts
+++ b/server/models/video/sql/video/videos-id-list-query-builder.ts
@@ -2,7 +2,7 @@ import { Sequelize } from 'sequelize'
2import validator from 'validator' 2import validator from 'validator'
3import { exists } from '@server/helpers/custom-validators/misc' 3import { exists } from '@server/helpers/custom-validators/misc'
4import { WEBSERVER } from '@server/initializers/constants' 4import { WEBSERVER } from '@server/initializers/constants'
5import { buildDirectionAndField, createSafeIn } from '@server/models/utils' 5import { buildDirectionAndField, createSafeIn, parseRowCountResult } from '@server/models/utils'
6import { MUserAccountId, MUserId } from '@server/types/models' 6import { MUserAccountId, MUserId } from '@server/types/models'
7import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models' 7import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models'
8import { AbstractRunQuery } from '../../../shared/abstract-run-query' 8import { AbstractRunQuery } from '../../../shared/abstract-run-query'
@@ -105,7 +105,7 @@ export class VideosIdListQueryBuilder extends AbstractRunQuery {
105 countVideoIds (countOptions: BuildVideosListQueryOptions): Promise<number> { 105 countVideoIds (countOptions: BuildVideosListQueryOptions): Promise<number> {
106 this.buildIdsListQuery(countOptions) 106 this.buildIdsListQuery(countOptions)
107 107
108 return this.runQuery().then(rows => rows.length !== 0 ? rows[0].total : 0) 108 return this.runQuery().then(rows => parseRowCountResult(rows))
109 } 109 }
110 110
111 getQuery (options: BuildVideosListQueryOptions) { 111 getQuery (options: BuildVideosListQueryOptions) {