From 52a1ec9af12cbd89cf4d3d585b38a9f11894a793 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 2 Jul 2022 12:34:22 +0900 Subject: [PATCH] =?UTF-8?q?enhance(server):=20=E3=82=A2=E3=83=B3=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=82=92=E6=96=B0=E3=81=97=E3=81=84=E9=A0=86?= =?UTF-8?q?=E3=81=AB=E3=82=BD=E3=83=BC=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/endpoints/notes/polls/recommendation.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index 2150efaaf..5a04d68f3 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -60,12 +60,21 @@ export default define(meta, paramDef, async (ps, user) => { query.setParameters(mutingQuery.getParameters()); //#endregion - const polls = await query.take(ps.limit).skip(ps.offset).getMany(); + const polls = await query + .orderBy('poll.noteId', 'DESC') + .take(ps.limit) + .skip(ps.offset) + .getMany(); if (polls.length === 0) return []; - const notes = await Notes.findBy({ - id: In(polls.map(poll => poll.noteId)), + const notes = await Notes.find({ + where: { + id: In(polls.map(poll => poll.noteId)), + }, + order: { + createdAt: 'DESC', + }, }); return await Notes.packMany(notes, user, {