Skip to content

Commit

Permalink
perf: chat logs sort
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Aug 27, 2023
1 parent d0d9bdc commit b892e53
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/src/pages/api/app/getChatLogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const [data, total] = await Promise.all([
Chat.aggregate([
{ $match: where },
{ $sort: { updateTime: -1 } },
{ $skip: (pageNum - 1) * pageSize },
{ $limit: pageSize },
{
$lookup: {
from: 'chatitems',
Expand Down Expand Up @@ -63,6 +60,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
}
},
{ $sort: { feedbackCount: -1, updateTime: -1 } },
{ $skip: (pageNum - 1) * pageSize },
{ $limit: pageSize },
{
$project: {
id: '$chatId',
Expand Down

0 comments on commit b892e53

Please sign in to comment.