Fix offset/limit on some SQL queries 🤦

This commit is contained in:
Chocobozzz 2018-06-13 17:43:30 +02:00
parent 4555697f21
commit 9a4a9b6c4e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 9 additions and 9 deletions

View File

@ -70,8 +70,8 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
static listAndCountAccountUrlsByVideoId (rateType: VideoRateType, videoId: number, start: number, count: number, t?: Transaction) { static listAndCountAccountUrlsByVideoId (rateType: VideoRateType, videoId: number, start: number, count: number, t?: Transaction) {
const query = { const query = {
start, offset: start,
count, limit: count,
where: { where: {
videoId, videoId,
type: rateType type: rateType

View File

@ -329,8 +329,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') { static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') {
const query = { const query = {
order: [ [ 'createdAt', order ] ], order: [ [ 'createdAt', order ] ],
start, offset: start,
count, limit: count,
where: { where: {
videoId videoId
}, },
@ -343,8 +343,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
static listForFeed (start: number, count: number, videoId?: number) { static listForFeed (start: number, count: number, videoId?: number) {
const query = { const query = {
order: [ [ 'createdAt', 'DESC' ] ], order: [ [ 'createdAt', 'DESC' ] ],
start, offset: start,
count, limit: count,
where: {}, where: {},
include: [ include: [
{ {

View File

@ -190,8 +190,8 @@ export class VideoShareModel extends Model<VideoShareModel> {
static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) { static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) {
const query = { const query = {
start, offset: start,
count, limit: count,
where: { where: {
videoId videoId
}, },

View File

@ -138,7 +138,7 @@ describe('Test handle downs', function () {
await waitJobs(servers[0]) await waitJobs(servers[0])
// Wait scheduler // Wait scheduler
await wait(3000) await wait(11000)
const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt') const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt')
expect(res.body.data).to.be.an('array') expect(res.body.data).to.be.an('array')