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:
tamaina 2023-07-25 19:21:50 +09:00 committed by GitHub
parent ac6a8edf0b
commit c1a19ff900
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 11 deletions

View file

@ -20,7 +20,7 @@
- リストTLで、ユーザーが追加・削除されてもTLを初期化しないように
### Server
-
- Fix: APIのオフセットが壊れていたせいで「もっと見る」でもっと見れない問題を修正
## 13.14.1

View file

@ -60,7 +60,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
query.limit(ps.limit);
query.skip(ps.offset);
query.offset(ps.offset);
const tickets = await query.getMany();

View file

@ -105,7 +105,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
}
query.limit(ps.limit);
query.skip(ps.offset);
query.offset(ps.offset);
const users = await query.getMany();

View file

@ -126,7 +126,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
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);
});

View file

@ -42,7 +42,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
.orderBy('tag.count', 'DESC')
.groupBy('tag.id')
.limit(ps.limit)
.skip(ps.offset)
.offset(ps.offset)
.getMany();
return hashtags.map(tag => tag.name);

View file

@ -83,7 +83,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const polls = await query
.orderBy('poll.noteId', 'DESC')
.limit(ps.limit)
.skip(ps.offset)
.offset(ps.offset)
.getMany();
if (polls.length === 0) return [];

View file

@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
if (me) this.queryService.generateBlockQueryForUsers(query, me);
query.limit(ps.limit);
query.skip(ps.offset);
query.offset(ps.offset);
const users = await query.getMany();

View file

@ -70,7 +70,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
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 });
});

View file

@ -75,7 +75,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
users = await usernameQuery
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
.limit(ps.limit)
.skip(ps.offset)
.offset(ps.offset)
.getMany();
} else {
const nameQuery = this.usersRepository.createQueryBuilder('user')
@ -102,7 +102,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
users = await nameQuery
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
.limit(ps.limit)
.skip(ps.offset)
.offset(ps.offset)
.getMany();
if (users.length < ps.limit) {
@ -128,7 +128,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
users = users.concat(await query
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
.limit(ps.limit)
.skip(ps.offset)
.offset(ps.offset)
.getMany(),
);
}