1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-31 23:31:48 +09:00

enhance(server): アンケートを新しい順にソート

This commit is contained in:
syuilo 2022-07-02 12:34:22 +09:00
parent b773d516d3
commit 52a1ec9af1

View File

@ -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, {