Skip to content

Commit

Permalink
fix(backend): sort notes
Browse files Browse the repository at this point in the history
Fix #10776
  • Loading branch information
syuilo committed May 6, 2023
1 parent 0735ca0 commit 1a4b434
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/backend/src/core/SearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ export class SearchService {
limit: pagination.limit,
});
if (res.hits.length === 0) return [];
return await this.notesRepository.findBy({
const notes = await this.notesRepository.findBy({
id: In(res.hits.map(x => x.id)),
});
return notes.sort((a, b) => a.id > b.id ? -1 : 1);
} else {
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), pagination.sinceId, pagination.untilId);

Expand Down

0 comments on commit 1a4b434

Please sign in to comment.