From c03d1ab00dd4a0f3239dac8429404a123037e5c9 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Fri, 6 May 2022 23:15:30 +0800 Subject: [PATCH] fix: fix get recent documents --- packages/client/src/pages/index.tsx | 18 ++++++++++++++- .../server/src/services/document.service.ts | 22 ++++++++++--------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/packages/client/src/pages/index.tsx b/packages/client/src/pages/index.tsx index f58cbfa8..3224f970 100644 --- a/packages/client/src/pages/index.tsx +++ b/packages/client/src/pages/index.tsx @@ -2,7 +2,7 @@ import type { NextPage } from 'next'; import type { IDocument } from '@think/domains'; import Link from 'next/link'; import React, { useMemo } from 'react'; -import { Typography, Button, Table, List } from '@douyinfe/semi-ui'; +import { Typography, Button, Table, List, Avatar } from '@douyinfe/semi-ui'; import { useToggle } from 'hooks/use-toggle'; import { Seo } from 'components/seo'; import { DataRender } from 'components/data-render'; @@ -37,6 +37,7 @@ const RecentDocs = () => { title="标题" dataIndex="title" key="title" + width={200} render={(_, document: IDocument) => { return ( @@ -46,6 +47,21 @@ const RecentDocs = () => { }} />, , + { + return ( +
+ + {createUser.name.slice(0, 1)} + + {createUser.name} +
+ ); + }} + />, instanceToPlain(doc)); + query.take(20); + + const documentIds = await (await query.getMany()).map((docAuth) => docAuth.documentId); + const documents = await this.documentRepo.findByIds(documentIds, { order: { updatedAt: 'DESC' } }); + const docs = documents.filter((doc) => !doc.isWikiHome).map((doc) => instanceToPlain(doc)); const res = await Promise.all( docs.map(async (doc) => {