forked from FoundKeyGang/FoundKey
enhance(server): アンケートを新しい順にソート
This commit is contained in:
parent
7bf3ddc608
commit
791063078d
1 changed files with 12 additions and 3 deletions
|
@ -60,12 +60,21 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
query.setParameters(mutingQuery.getParameters());
|
query.setParameters(mutingQuery.getParameters());
|
||||||
//#endregion
|
//#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 [];
|
if (polls.length === 0) return [];
|
||||||
|
|
||||||
const notes = await Notes.findBy({
|
const notes = await Notes.find({
|
||||||
id: In(polls.map(poll => poll.noteId)),
|
where: {
|
||||||
|
id: In(polls.map(poll => poll.noteId)),
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
createdAt: 'DESC',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return await Notes.packMany(notes, user, {
|
return await Notes.packMany(notes, user, {
|
||||||
|
|
Loading…
Reference in a new issue