mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 04:13:09 +02:00
fix(backend): Use OFFSET instead of SKIP when using LIMIT (#11379)
* fix(backend): Use OFFSET instead of SKIP when using LIMIT * update CHANGELOG.md
This commit is contained in:
parent
ac6a8edf0b
commit
c1a19ff900
9 changed files with 11 additions and 11 deletions
|
@ -20,7 +20,7 @@
|
||||||
- リストTLで、ユーザーが追加・削除されてもTLを初期化しないように
|
- リストTLで、ユーザーが追加・削除されてもTLを初期化しないように
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
-
|
- Fix: APIのオフセットが壊れていたせいで「もっと見る」でもっと見れない問題を修正
|
||||||
|
|
||||||
## 13.14.1
|
## 13.14.1
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
query.limit(ps.limit);
|
query.limit(ps.limit);
|
||||||
query.skip(ps.offset);
|
query.offset(ps.offset);
|
||||||
|
|
||||||
const tickets = await query.getMany();
|
const tickets = await query.getMany();
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
}
|
}
|
||||||
|
|
||||||
query.limit(ps.limit);
|
query.limit(ps.limit);
|
||||||
query.skip(ps.offset);
|
query.offset(ps.offset);
|
||||||
|
|
||||||
const users = await query.getMany();
|
const users = await query.getMany();
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
query.andWhere('instance.host like :host', { host: '%' + sqlLikeEscape(ps.host.toLowerCase()) + '%' });
|
query.andWhere('instance.host like :host', { host: '%' + sqlLikeEscape(ps.host.toLowerCase()) + '%' });
|
||||||
}
|
}
|
||||||
|
|
||||||
const instances = await query.limit(ps.limit).skip(ps.offset).getMany();
|
const instances = await query.limit(ps.limit).offset(ps.offset).getMany();
|
||||||
|
|
||||||
return await this.instanceEntityService.packMany(instances);
|
return await this.instanceEntityService.packMany(instances);
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
.orderBy('tag.count', 'DESC')
|
.orderBy('tag.count', 'DESC')
|
||||||
.groupBy('tag.id')
|
.groupBy('tag.id')
|
||||||
.limit(ps.limit)
|
.limit(ps.limit)
|
||||||
.skip(ps.offset)
|
.offset(ps.offset)
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
return hashtags.map(tag => tag.name);
|
return hashtags.map(tag => tag.name);
|
||||||
|
|
|
@ -83,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
const polls = await query
|
const polls = await query
|
||||||
.orderBy('poll.noteId', 'DESC')
|
.orderBy('poll.noteId', 'DESC')
|
||||||
.limit(ps.limit)
|
.limit(ps.limit)
|
||||||
.skip(ps.offset)
|
.offset(ps.offset)
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
if (polls.length === 0) return [];
|
if (polls.length === 0) return [];
|
||||||
|
|
|
@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
if (me) this.queryService.generateBlockQueryForUsers(query, me);
|
if (me) this.queryService.generateBlockQueryForUsers(query, me);
|
||||||
|
|
||||||
query.limit(ps.limit);
|
query.limit(ps.limit);
|
||||||
query.skip(ps.offset);
|
query.offset(ps.offset);
|
||||||
|
|
||||||
const users = await query.getMany();
|
const users = await query.getMany();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
|
||||||
query.setParameters(followingQuery.getParameters());
|
query.setParameters(followingQuery.getParameters());
|
||||||
|
|
||||||
const users = await query.limit(ps.limit).skip(ps.offset).getMany();
|
const users = await query.limit(ps.limit).offset(ps.offset).getMany();
|
||||||
|
|
||||||
return await this.userEntityService.packMany(users, me, { detail: true });
|
return await this.userEntityService.packMany(users, me, { detail: true });
|
||||||
});
|
});
|
||||||
|
|
|
@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
users = await usernameQuery
|
users = await usernameQuery
|
||||||
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
|
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
|
||||||
.limit(ps.limit)
|
.limit(ps.limit)
|
||||||
.skip(ps.offset)
|
.offset(ps.offset)
|
||||||
.getMany();
|
.getMany();
|
||||||
} else {
|
} else {
|
||||||
const nameQuery = this.usersRepository.createQueryBuilder('user')
|
const nameQuery = this.usersRepository.createQueryBuilder('user')
|
||||||
|
@ -102,7 +102,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
users = await nameQuery
|
users = await nameQuery
|
||||||
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
|
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
|
||||||
.limit(ps.limit)
|
.limit(ps.limit)
|
||||||
.skip(ps.offset)
|
.offset(ps.offset)
|
||||||
.getMany();
|
.getMany();
|
||||||
|
|
||||||
if (users.length < ps.limit) {
|
if (users.length < ps.limit) {
|
||||||
|
@ -128,7 +128,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
users = users.concat(await query
|
users = users.concat(await query
|
||||||
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
|
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
|
||||||
.limit(ps.limit)
|
.limit(ps.limit)
|
||||||
.skip(ps.offset)
|
.offset(ps.offset)
|
||||||
.getMany(),
|
.getMany(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue