Fix offset/limit on some SQL queries 🤦
This commit is contained in:
parent
4555697f21
commit
9a4a9b6c4e
|
@ -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
|
||||||
|
|
|
@ -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: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
},
|
},
|
||||||
|
|
|
@ -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')
|
||||||
|
|
Loading…
Reference in New Issue