perf(backend): use limit() instead of take()
This commit is contained in:
@@ -98,7 +98,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
const emojis = await q
|
||||
.orderBy('emoji.id', 'DESC')
|
||||
.take(ps.limit)
|
||||
.limit(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return this.emojiEntityService.packDetailedMany(emojis);
|
||||
|
@@ -84,7 +84,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
|
||||
if (ps.query) {
|
||||
//q.andWhere('emoji.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` });
|
||||
//const emojis = await q.take(ps.limit).getMany();
|
||||
//const emojis = await q.limit(ps.limit).getMany();
|
||||
|
||||
emojis = await q.getMany();
|
||||
const queryarry = ps.query.match(/\:([a-z0-9_]*)\:/g);
|
||||
@@ -101,7 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||
}
|
||||
emojis.splice(ps.limit + 1);
|
||||
} else {
|
||||
emojis = await q.take(ps.limit).getMany();
|
||||
emojis = await q.limit(ps.limit).getMany();
|
||||
}
|
||||
|
||||
return this.emojiEntityService.packDetailedMany(emojis);
|
||||
|
Reference in New Issue
Block a user