diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-05 10:29:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-05 10:29:35 +0200 |
commit | bae616273d455d225d131eb17c56db6c20a0b6b3 (patch) | |
tree | ed2174122d092320cea34c4ae522da6f2131f968 /server/models/video/sql | |
parent | d493e2d4bf0ace177d15e9173d1c02df8c100558 (diff) | |
download | PeerTube-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.ts | 4 |
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' | |||
2 | import validator from 'validator' | 2 | import validator from 'validator' |
3 | import { exists } from '@server/helpers/custom-validators/misc' | 3 | import { exists } from '@server/helpers/custom-validators/misc' |
4 | import { WEBSERVER } from '@server/initializers/constants' | 4 | import { WEBSERVER } from '@server/initializers/constants' |
5 | import { buildDirectionAndField, createSafeIn } from '@server/models/utils' | 5 | import { buildDirectionAndField, createSafeIn, parseRowCountResult } from '@server/models/utils' |
6 | import { MUserAccountId, MUserId } from '@server/types/models' | 6 | import { MUserAccountId, MUserId } from '@server/types/models' |
7 | import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models' | 7 | import { VideoInclude, VideoPrivacy, VideoState } from '@shared/models' |
8 | import { AbstractRunQuery } from '../../../shared/abstract-run-query' | 8 | import { 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) { |