mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-04 07:24:13 +00: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を初期化しないように
 | 
			
		||||
 | 
			
		||||
### Server
 | 
			
		||||
-
 | 
			
		||||
- Fix: APIのオフセットが壊れていたせいで「もっと見る」でもっと見れない問題を修正
 | 
			
		||||
 | 
			
		||||
## 13.14.1
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
		});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 [];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 });
 | 
			
		||||
		});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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(),
 | 
			
		||||
					);
 | 
			
		||||
				}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue