diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-05-06 12:49:49 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-05-06 12:49:49 +0900 |
| commit | 1a4b4348a9d340d89869825a84a4d727c92d4894 (patch) | |
| tree | 332b5d7052130c972cefee0c1eb257289dc1efd5 /packages/backend/src/core/SearchService.ts | |
| parent | fix test (diff) | |
| download | sharkey-1a4b4348a9d340d89869825a84a4d727c92d4894.tar.gz sharkey-1a4b4348a9d340d89869825a84a4d727c92d4894.tar.bz2 sharkey-1a4b4348a9d340d89869825a84a4d727c92d4894.zip | |
fix(backend): sort notes
Fix #10776
Diffstat (limited to 'packages/backend/src/core/SearchService.ts')
| -rw-r--r-- | packages/backend/src/core/SearchService.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/backend/src/core/SearchService.ts b/packages/backend/src/core/SearchService.ts index 05052620ed..1c18a52fae 100644 --- a/packages/backend/src/core/SearchService.ts +++ b/packages/backend/src/core/SearchService.ts @@ -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); |