From 73deb5e54e085f4a6e7aa61cd719c7ed0cc75ce5 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Sun, 5 Jun 2022 21:11:11 +0800 Subject: [PATCH] server: order docs --- packages/server/src/services/document.service.ts | 4 ++++ packages/server/src/services/wiki.service.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/server/src/services/document.service.ts b/packages/server/src/services/document.service.ts index 59a9a5f..f5d5187 100644 --- a/packages/server/src/services/document.service.ts +++ b/packages/server/src/services/document.service.ts @@ -563,6 +563,8 @@ export class DocumentService { return lodash.omit(item, ['content', 'state']); }); + docs.sort((a, b) => a.index - b.index); + // const docsWithCreateUser = await Promise.all( // docs.map(async (doc) => { // const createUser = await this.userService.findById(doc.createUserId); @@ -617,6 +619,8 @@ export class DocumentService { return lodash.omit(item, ['content', 'state']); }); + docs.sort((a, b) => a.index - b.index); + // const docsWithCreateUser = await Promise.all( // docs.map(async (doc) => { // const createUser = await this.userService.findById(doc.createUserId); diff --git a/packages/server/src/services/wiki.service.ts b/packages/server/src/services/wiki.service.ts index af72aa8..349a530 100644 --- a/packages/server/src/services/wiki.service.ts +++ b/packages/server/src/services/wiki.service.ts @@ -622,6 +622,8 @@ export class WikiService { return lodash.omit(item, ['content', 'state']); }); + docs.sort((a, b) => a.index - b.index); + const docsWithCreateUser = await Promise.all( docs.map(async (doc) => { const createUser = await this.userService.findById(doc.createUserId);