Fix offset/limit on some SQL queries 🤦

pull/632/merge
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) {
const query = {
start,
count,
offset: start,
limit: count,
where: {
videoId,
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') {
const query = {
order: [ [ 'createdAt', order ] ],
start,
count,
offset: start,
limit: count,
where: {
videoId
},
@ -343,8 +343,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
static listForFeed (start: number, count: number, videoId?: number) {
const query = {
order: [ [ 'createdAt', 'DESC' ] ],
start,
count,
offset: start,
limit: count,
where: {},
include: [
{

View File

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

View File

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