mirror of https://github.com/fantasticit/think.git
chore: ssr 阶段1
parent
55f227fae0
commit
b3c7a375ce
|
@ -86,6 +86,7 @@
|
|||
"react-helmet": "^6.1.0",
|
||||
"react-lazy-load-image-component": "^1.5.4",
|
||||
"react-pdf": "^5.7.2",
|
||||
"react-query": "^3.39.0",
|
||||
"react-split-pane": "^0.1.92",
|
||||
"scroll-into-view-if-needed": "^2.2.29",
|
||||
"swr": "^1.2.0",
|
||||
|
|
|
@ -8,7 +8,7 @@ type RenderProps = React.ReactNode | (() => React.ReactNode);
|
|||
|
||||
interface IProps {
|
||||
loading: boolean;
|
||||
error: Error | null;
|
||||
error: Error | null | unknown;
|
||||
empty?: boolean;
|
||||
loadingContent?: RenderProps;
|
||||
errorContent?: RenderProps;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { IconStar } from '@douyinfe/semi-icons';
|
||||
import { Button, Tooltip } from '@douyinfe/semi-ui';
|
||||
import { useDocumentStar } from 'data/document';
|
||||
import { useDocumentCollectToggle } from 'data/refactor/collector';
|
||||
import React from 'react';
|
||||
|
||||
interface IProps {
|
||||
|
@ -9,7 +9,7 @@ interface IProps {
|
|||
}
|
||||
|
||||
export const DocumentStar: React.FC<IProps> = ({ documentId, render }) => {
|
||||
const { data, toggleStar } = useDocumentStar(documentId);
|
||||
const { data, toggle: toggleStar } = useDocumentCollectToggle(documentId);
|
||||
const text = data ? '取消收藏' : '收藏文档';
|
||||
|
||||
return (
|
||||
|
|
|
@ -250,5 +250,6 @@ const MessageBox = () => {
|
|||
|
||||
export const Message = () => {
|
||||
const { loading, error } = useUser();
|
||||
return <DataRender loading={loading} error={error} normalContent={() => <MessageBox />} />;
|
||||
return null;
|
||||
// return <DataRender loading={loading} error={error} normalContent={() => <MessageBox />} />;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { IconArticle, IconChevronLeft } from '@douyinfe/semi-icons';
|
||||
import { Button, Nav, Popconfirm, Popover, Space, Switch, Tooltip, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconChevronLeft } from '@douyinfe/semi-icons';
|
||||
import { Button, Nav, Popconfirm, Space, Switch, Tooltip, Typography } from '@douyinfe/semi-ui';
|
||||
import { ILoginUser, ITemplate } from '@think/domains';
|
||||
import cls from 'classnames';
|
||||
import { DocumentStyle } from 'components/document/style';
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { IconArticle, IconChevronLeft } from '@douyinfe/semi-icons';
|
||||
import { Button, Nav, Popconfirm, Popover, Space, Spin, Switch, Tooltip, Typography } from '@douyinfe/semi-ui';
|
||||
import { IconChevronLeft } from '@douyinfe/semi-icons';
|
||||
import { Button, Nav, Popconfirm, Space, Spin, Switch, Tooltip, Typography } from '@douyinfe/semi-ui';
|
||||
import cls from 'classnames';
|
||||
import { DataRender } from 'components/data-render';
|
||||
import { DocumentStyle } from 'components/document/style';
|
||||
import { Seo } from 'components/seo';
|
||||
import { Theme } from 'components/theme';
|
||||
import { User } from 'components/user';
|
||||
import { useTemplate } from 'data/template';
|
||||
import { useTemplate } from 'data/refactor/template';
|
||||
import { useUser } from 'data/user';
|
||||
import { useDocumentStyle } from 'hooks/use-document-style';
|
||||
import { useWindowSize } from 'hooks/use-window-size';
|
||||
|
@ -25,9 +25,8 @@ const { Text } = Typography;
|
|||
export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
|
||||
const { user } = useUser();
|
||||
const { data, loading, error, updateTemplate, deleteTemplate } = useTemplate(templateId);
|
||||
|
||||
const { width: windowWidth } = useWindowSize();
|
||||
const [title, setTitle] = useState(data.title);
|
||||
const [title, setTitle] = useState(data && data.title);
|
||||
const [isPublic, setPublic] = useState(false);
|
||||
const { width, fontSize } = useDocumentStyle();
|
||||
const editorWrapClassNames = useMemo(() => {
|
||||
|
@ -47,6 +46,7 @@ export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
|
|||
useEffect(() => {
|
||||
if (!data) return;
|
||||
setPublic(data.isPublic);
|
||||
setTitle(data.title);
|
||||
}, [data]);
|
||||
|
||||
return (
|
||||
|
|
|
@ -45,7 +45,7 @@ export const User: React.FC = () => {
|
|||
<Avatar size="extra-extra-small" src={user.avatar}></Avatar>
|
||||
) : (
|
||||
<Avatar size="extra-extra-small" color="orange">
|
||||
{user && user.name[0]}
|
||||
{user && user.name && user.name[0]}
|
||||
</Avatar>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Avatar, Skeleton, Space, Typography } from '@douyinfe/semi-ui';
|
|||
import { IconDocument } from 'components/icons/IconDocument';
|
||||
import { LocaleTime } from 'components/locale-time';
|
||||
import { WikiStar } from 'components/wiki/star';
|
||||
import { IWikiWithIsMember } from 'data/wiki';
|
||||
import { IWikiWithIsMember } from 'data/refactor/collector';
|
||||
import Link from 'next/link';
|
||||
|
||||
import styles from './index.module.scss';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Form, Modal } from '@douyinfe/semi-ui';
|
||||
import { FormApi } from '@douyinfe/semi-ui/lib/es/form';
|
||||
import type { IWiki } from '@think/domains';
|
||||
import { ICreateWiki, useOwnWikis } from 'data/wiki';
|
||||
import { ICreateWiki, useOwnWikis } from 'data/refactor/wiki';
|
||||
import Router from 'next/router';
|
||||
import { Dispatch, SetStateAction, useRef } from 'react';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { IconStar } from '@douyinfe/semi-icons';
|
||||
import { Button, Tooltip } from '@douyinfe/semi-ui';
|
||||
import { useWikiStar } from 'data/wiki';
|
||||
import { useWikiCollectToggle } from 'data/refactor/collector';
|
||||
import React from 'react';
|
||||
|
||||
interface IProps {
|
||||
|
@ -10,13 +10,13 @@ interface IProps {
|
|||
}
|
||||
|
||||
export const WikiStar: React.FC<IProps> = ({ wikiId, render, onChange }) => {
|
||||
const { data, toggleStar } = useWikiStar(wikiId);
|
||||
const { data, toggle } = useWikiCollectToggle(wikiId);
|
||||
const text = data ? '取消收藏' : '收藏知识库';
|
||||
|
||||
return (
|
||||
<>
|
||||
{render ? (
|
||||
render({ star: data, toggleStar, text })
|
||||
render({ star: data, toggleStar: toggle, text })
|
||||
) : (
|
||||
<Tooltip content={text} position="bottom">
|
||||
<Button
|
||||
|
@ -28,7 +28,7 @@ export const WikiStar: React.FC<IProps> = ({ wikiId, render, onChange }) => {
|
|||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
toggleStar().then(onChange);
|
||||
toggle().then(onChange);
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
|
|
@ -0,0 +1,167 @@
|
|||
import { CollectorApiDefinition, CollectorApiTypeDefinition, CollectType, IDocument, IWiki } from '@think/domains';
|
||||
import { useCallback } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
import { HttpClient } from 'services/http-client';
|
||||
|
||||
export type IWikiWithIsMember = IWiki & { isMember?: boolean };
|
||||
|
||||
/**
|
||||
* 获取用户收藏的知识库
|
||||
* @returns
|
||||
*/
|
||||
export const getCollectedWikis = (cookie = null): Promise<IWikiWithIsMember[]> => {
|
||||
return HttpClient.request({
|
||||
method: CollectorApiDefinition.wikis.method,
|
||||
url: CollectorApiDefinition.wikis.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户收藏的知识库
|
||||
* @returns
|
||||
*/
|
||||
export const useCollectedWikis = () => {
|
||||
const { data, error, isLoading, refetch } = useQuery(CollectorApiDefinition.wikis.client(), getCollectedWikis);
|
||||
return { data, error, loading: isLoading, refresh: refetch };
|
||||
};
|
||||
|
||||
/**
|
||||
* 检查知识库是否收藏
|
||||
* @param wikiId
|
||||
* @returns
|
||||
*/
|
||||
export const getWikiIsCollected = (wikiId, cookie = null): Promise<boolean> => {
|
||||
return HttpClient.request({
|
||||
method: CollectorApiDefinition.check.method,
|
||||
url: CollectorApiDefinition.check.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
data: {
|
||||
type: CollectType.wiki,
|
||||
targetId: wikiId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 收藏(或取消收藏)知识库
|
||||
* @param wikiId
|
||||
* @returns
|
||||
*/
|
||||
export const toggleCollectWiki = (wikiId, cookie = null): Promise<boolean> => {
|
||||
return HttpClient.request({
|
||||
method: CollectorApiDefinition.toggle.method,
|
||||
url: CollectorApiDefinition.toggle.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
data: {
|
||||
type: CollectType.wiki,
|
||||
targetId: wikiId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 收藏知识库
|
||||
* @param wikiId
|
||||
* @returns
|
||||
*/
|
||||
export const useWikiCollectToggle = (wikiId) => {
|
||||
const { data, error, refetch } = useQuery(`${CollectorApiDefinition.check.client()}?wikiId=${wikiId}`, () =>
|
||||
getWikiIsCollected(wikiId)
|
||||
);
|
||||
|
||||
const toggle = useCallback(async () => {
|
||||
await toggleCollectWiki(wikiId);
|
||||
refetch();
|
||||
}, [refetch, wikiId]);
|
||||
|
||||
return { data, error, toggle };
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户收藏的文档
|
||||
* @returns
|
||||
*/
|
||||
export const getCollectedDocuments = (cookie = null): Promise<IDocument[]> => {
|
||||
return HttpClient.request({
|
||||
method: CollectorApiDefinition.documents.method,
|
||||
url: CollectorApiDefinition.documents.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户收藏的文档
|
||||
* @returns
|
||||
*/
|
||||
export const useCollectedDocuments = () => {
|
||||
const { data, error, isLoading, refetch } = useQuery(
|
||||
CollectorApiDefinition.documents.client(),
|
||||
getCollectedDocuments
|
||||
);
|
||||
return { data, error, loading: isLoading, refresh: refetch };
|
||||
};
|
||||
|
||||
/**
|
||||
* 检查文档是否收藏
|
||||
* @param documentId
|
||||
* @returns
|
||||
*/
|
||||
export const getDocumentIsCollected = (documentId, cookie = null): Promise<boolean> => {
|
||||
return HttpClient.request({
|
||||
method: CollectorApiDefinition.check.method,
|
||||
url: CollectorApiDefinition.check.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
data: {
|
||||
type: CollectType.document,
|
||||
targetId: documentId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 收藏(或取消收藏)知识库
|
||||
* @param wikiId
|
||||
* @returns
|
||||
*/
|
||||
export const toggleCollectDocument = (documentId, cookie = null): Promise<boolean> => {
|
||||
return HttpClient.request({
|
||||
method: CollectorApiDefinition.toggle.method,
|
||||
url: CollectorApiDefinition.toggle.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
data: {
|
||||
type: CollectType.document,
|
||||
targetId: documentId,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 文档收藏管理
|
||||
* @param documentId
|
||||
* @returns
|
||||
*/
|
||||
export const useDocumentCollectToggle = (documentId) => {
|
||||
const { data, error, refetch } = useQuery(`${CollectorApiDefinition.check.client()}?documentId=${documentId}`, () =>
|
||||
getDocumentIsCollected(documentId)
|
||||
);
|
||||
|
||||
const toggle = useCallback(async () => {
|
||||
await toggleCollectDocument(documentId);
|
||||
refetch();
|
||||
}, [refetch, documentId]);
|
||||
|
||||
return { data, error, toggle };
|
||||
};
|
|
@ -0,0 +1,40 @@
|
|||
import {
|
||||
CollectorApiDefinition,
|
||||
CollectorApiTypeDefinition,
|
||||
CollectType,
|
||||
DocumentApiDefinition,
|
||||
IDocument,
|
||||
IWiki,
|
||||
WikiApiDefinition,
|
||||
} from '@think/domains';
|
||||
import { useCallback } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
import { HttpClient } from 'services/http-client';
|
||||
|
||||
type IDocumentWithVisitedAt = IDocument & { visitedAt: string };
|
||||
|
||||
/**
|
||||
* 获取用户最近访问的文档
|
||||
* @returns
|
||||
*/
|
||||
export const getRecentVisitedDocuments = (cookie = null): Promise<IDocumentWithVisitedAt[]> => {
|
||||
return HttpClient.request({
|
||||
method: DocumentApiDefinition.recent.method,
|
||||
url: DocumentApiDefinition.recent.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户最近访问的文档
|
||||
* @returns
|
||||
*/
|
||||
export const useRecentDocuments = () => {
|
||||
const { data, error, isLoading, refetch } = useQuery(
|
||||
DocumentApiDefinition.recent.client(),
|
||||
getRecentVisitedDocuments
|
||||
);
|
||||
return { data, error, loading: isLoading, refresh: refetch };
|
||||
};
|
|
@ -0,0 +1,146 @@
|
|||
import { ITemplate, TemplateApiDefinition } from '@think/domains';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
import { HttpClient } from 'services/http-client';
|
||||
|
||||
export const getPublicTemplates = (
|
||||
page = 1,
|
||||
cookie = null
|
||||
): Promise<{
|
||||
data: Array<ITemplate>;
|
||||
total: number;
|
||||
}> => {
|
||||
return HttpClient.request({
|
||||
method: TemplateApiDefinition.public.method,
|
||||
url: TemplateApiDefinition.public.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
params: {
|
||||
page,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const usePublicTemplates = () => {
|
||||
const [page, setPage] = useState(1);
|
||||
const { data, error, isLoading } = useQuery(`${TemplateApiDefinition.public.client()}?page=${page}`, () =>
|
||||
getPublicTemplates(page)
|
||||
);
|
||||
|
||||
return {
|
||||
data,
|
||||
loading: isLoading,
|
||||
error,
|
||||
setPage,
|
||||
};
|
||||
};
|
||||
|
||||
export const getOwnTemplates = (
|
||||
page = 1,
|
||||
cookie = null
|
||||
): Promise<{
|
||||
data: Array<ITemplate>;
|
||||
total: number;
|
||||
}> => {
|
||||
return HttpClient.request({
|
||||
method: TemplateApiDefinition.own.method,
|
||||
url: TemplateApiDefinition.own.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
params: {
|
||||
page,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 个人模板
|
||||
* @returns
|
||||
*/
|
||||
export const useOwnTemplates = () => {
|
||||
const [page, setPage] = useState(1);
|
||||
const {
|
||||
data,
|
||||
error,
|
||||
isLoading,
|
||||
refetch: mutate,
|
||||
} = useQuery(`${TemplateApiDefinition.own.client()}?page=${page}`, () => getOwnTemplates(page));
|
||||
|
||||
const addTemplate = useCallback(
|
||||
async (data): Promise<ITemplate> => {
|
||||
const ret = await HttpClient.post(TemplateApiDefinition.add.client(), data);
|
||||
mutate();
|
||||
return ret as unknown as ITemplate;
|
||||
},
|
||||
[mutate]
|
||||
);
|
||||
|
||||
return {
|
||||
data,
|
||||
loading: isLoading,
|
||||
error,
|
||||
setPage,
|
||||
addTemplate,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取模板详情
|
||||
* @param templateId
|
||||
* @param cookie
|
||||
* @returns
|
||||
*/
|
||||
export const getTemplateDetail = (templateId, cookie = null): Promise<ITemplate> => {
|
||||
return HttpClient.request({
|
||||
method: TemplateApiDefinition.getDetailById.method,
|
||||
url: TemplateApiDefinition.getDetailById.client(templateId),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取模板详情
|
||||
* @param templateId
|
||||
* @returns
|
||||
*/
|
||||
export const useTemplate = (templateId) => {
|
||||
const { data, error, refetch } = useQuery(TemplateApiDefinition.getDetailById.client(templateId), () =>
|
||||
getTemplateDetail(templateId)
|
||||
);
|
||||
const loading = !data && !error;
|
||||
|
||||
const updateTemplate = useCallback(
|
||||
async (data): Promise<ITemplate> => {
|
||||
const ret = await HttpClient.request({
|
||||
method: TemplateApiDefinition.updateById.method,
|
||||
url: TemplateApiDefinition.updateById.client(templateId),
|
||||
data: {
|
||||
id: templateId,
|
||||
...data,
|
||||
},
|
||||
});
|
||||
refetch();
|
||||
return ret as unknown as ITemplate;
|
||||
},
|
||||
[refetch, templateId]
|
||||
);
|
||||
|
||||
const deleteTemplate = useCallback(async () => {
|
||||
await HttpClient.request({
|
||||
method: TemplateApiDefinition.deleteById.method,
|
||||
url: TemplateApiDefinition.deleteById.client(templateId),
|
||||
});
|
||||
}, [templateId]);
|
||||
|
||||
return {
|
||||
data,
|
||||
loading,
|
||||
error,
|
||||
updateTemplate,
|
||||
deleteTemplate,
|
||||
};
|
||||
};
|
|
@ -0,0 +1,170 @@
|
|||
import {
|
||||
CollectorApiDefinition,
|
||||
CollectorApiTypeDefinition,
|
||||
CollectType,
|
||||
IUser,
|
||||
IWiki,
|
||||
IWikiUser,
|
||||
WikiApiDefinition,
|
||||
} from '@think/domains';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useQuery } from 'react-query';
|
||||
import { HttpClient } from 'services/http-client';
|
||||
|
||||
export type ICreateWiki = Pick<IWiki, 'name' | 'description'>;
|
||||
export type IUpdateWiki = Partial<IWiki>;
|
||||
export type IWikiUserOpeateData = {
|
||||
userName: Pick<IUser, 'name'>;
|
||||
userRole: Pick<IWikiUser, 'userRole'>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户所有知识库
|
||||
* @returns
|
||||
*/
|
||||
export const getAllWikis = (cookie = null): Promise<{ data: IWiki[]; total: number }> => {
|
||||
return HttpClient.request({
|
||||
method: WikiApiDefinition.getAllWikis.method,
|
||||
url: WikiApiDefinition.getAllWikis.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户所有知识库
|
||||
* @returns
|
||||
*/
|
||||
export const useAllWikis = () => {
|
||||
const { data, error, isLoading } = useQuery(WikiApiDefinition.getAllWikis.client(), getAllWikis);
|
||||
const list = (data && data.data) || [];
|
||||
const total = (data && data.total) || 0;
|
||||
return { data: list, total, error, loading: isLoading };
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户参与的知识库
|
||||
* @returns
|
||||
*/
|
||||
export const getJoinWikis = (cookie = null): Promise<{ data: IWiki[]; total: number }> => {
|
||||
return HttpClient.request({
|
||||
method: WikiApiDefinition.getJoinWikis.method,
|
||||
url: WikiApiDefinition.getJoinWikis.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户参与的知识库
|
||||
* @returns
|
||||
*/
|
||||
export const useJoinWikis = () => {
|
||||
const { data, error, isLoading } = useQuery(WikiApiDefinition.getJoinWikis.client(), getJoinWikis);
|
||||
const list = (data && data.data) || [];
|
||||
const total = (data && data.total) || 0;
|
||||
|
||||
return { data: list, total, error, loading: isLoading };
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户创建的知识库
|
||||
* @returns
|
||||
*/
|
||||
export const getOwnWikis = (cookie = null): Promise<{ data: IWiki[]; total: number }> => {
|
||||
return HttpClient.request({
|
||||
method: WikiApiDefinition.getOwnWikis.method,
|
||||
url: WikiApiDefinition.getOwnWikis.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取用户创建的知识库
|
||||
* @returns
|
||||
*/
|
||||
export const useOwnWikis = () => {
|
||||
const { data, error, refetch } = useQuery(WikiApiDefinition.getOwnWikis.client(), getOwnWikis);
|
||||
|
||||
const createWiki = useCallback(
|
||||
async (data: ICreateWiki) => {
|
||||
const res = await HttpClient.request({
|
||||
method: WikiApiDefinition.add.method,
|
||||
url: WikiApiDefinition.add.client(),
|
||||
data,
|
||||
});
|
||||
refetch();
|
||||
return res;
|
||||
},
|
||||
[refetch]
|
||||
);
|
||||
|
||||
/**
|
||||
* 删除文档
|
||||
* @param id
|
||||
* @returns
|
||||
*/
|
||||
const deletWiki = useCallback(
|
||||
async (id) => {
|
||||
const res = await HttpClient.request({
|
||||
method: WikiApiDefinition.deleteById.method,
|
||||
url: WikiApiDefinition.deleteById.client(id),
|
||||
});
|
||||
refetch();
|
||||
return res;
|
||||
},
|
||||
[refetch]
|
||||
);
|
||||
|
||||
const loading = !data && !error;
|
||||
const list = (data && data.data) || [];
|
||||
const total = (data && data.total) || 0;
|
||||
|
||||
return { data: list, total, error, loading, createWiki, deletWiki };
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取所有公开文档
|
||||
* @param documentId
|
||||
* @returns
|
||||
*/
|
||||
export const getAllPublicWikis = (
|
||||
page = 1,
|
||||
cookie = null
|
||||
): Promise<{
|
||||
data: Array<IWiki>;
|
||||
total: number;
|
||||
}> => {
|
||||
return HttpClient.request({
|
||||
method: WikiApiDefinition.getPublicWikis.method,
|
||||
url: WikiApiDefinition.getPublicWikis.client(),
|
||||
headers: {
|
||||
cookie,
|
||||
},
|
||||
params: {
|
||||
page,
|
||||
},
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 获取所有公开文档
|
||||
* @param documentId
|
||||
* @returns
|
||||
*/
|
||||
export const useAllPublicWikis = () => {
|
||||
const [page, setPage] = useState(1);
|
||||
const { data, error, isLoading } = useQuery(`${WikiApiDefinition.getPublicWikis.client()}?page=${page}`, () =>
|
||||
getAllPublicWikis(page)
|
||||
);
|
||||
|
||||
return {
|
||||
data,
|
||||
loading: isLoading,
|
||||
error,
|
||||
setPage,
|
||||
};
|
||||
};
|
|
@ -117,7 +117,7 @@ export const RouterHeader: React.FC = () => {
|
|||
<Space>
|
||||
<WikiOrDocumentCreator />
|
||||
<Search />
|
||||
<Message />
|
||||
{/* <Message /> */}
|
||||
<Theme />
|
||||
<User />
|
||||
</Space>
|
||||
|
|
|
@ -6,7 +6,6 @@ import { Empty } from 'components/empty';
|
|||
import { IconDocumentFill } from 'components/icons/IconDocumentFill';
|
||||
import { LocaleTime } from 'components/locale-time';
|
||||
import { useRecentDocuments } from 'data/document';
|
||||
import { useToggle } from 'hooks/use-toggle';
|
||||
import Link from 'next/link';
|
||||
import React from 'react';
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ import { Avatar, Dropdown, Modal, Space, Typography } from '@douyinfe/semi-ui';
|
|||
import { DataRender } from 'components/data-render';
|
||||
import { Empty } from 'components/empty';
|
||||
import { WikiStar } from 'components/wiki/star';
|
||||
import { useStaredWikis, useWikiDetail } from 'data/wiki';
|
||||
import { useCollectedWikis } from 'data/refactor/collector';
|
||||
import { useWikiDetail } from 'data/wiki';
|
||||
import Link from 'next/link';
|
||||
import { useRouter } from 'next/router';
|
||||
import React from 'react';
|
||||
|
@ -15,7 +16,7 @@ const { Text } = Typography;
|
|||
|
||||
const WikiContent = () => {
|
||||
const { query } = useRouter();
|
||||
const { data: starWikis, loading, error, refresh: refreshStarWikis } = useStaredWikis();
|
||||
const { data: starWikis, loading, error, refresh: refreshStarWikis } = useCollectedWikis();
|
||||
const { data: currentWiki } = useWikiDetail(query.wikiId);
|
||||
|
||||
return (
|
||||
|
|
|
@ -9,9 +9,12 @@ import { Theme } from 'hooks/use-theme';
|
|||
import App from 'next/app';
|
||||
import Head from 'next/head';
|
||||
import React from 'react';
|
||||
import { Hydrate, QueryClient, QueryClientProvider } from 'react-query';
|
||||
|
||||
class MyApp extends App<{ isMobile: boolean }> {
|
||||
state = {};
|
||||
state = {
|
||||
queryClient: new QueryClient(),
|
||||
};
|
||||
|
||||
static getInitialProps = async ({ Component, ctx }) => {
|
||||
const request = ctx?.req;
|
||||
|
@ -26,6 +29,7 @@ class MyApp extends App<{ isMobile: boolean }> {
|
|||
|
||||
render() {
|
||||
const { Component, pageProps, isMobile } = this.props;
|
||||
const { queryClient } = this.state;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -57,11 +61,15 @@ class MyApp extends App<{ isMobile: boolean }> {
|
|||
<link key={url} rel="dns-prefetch" href={url} />
|
||||
))}
|
||||
</Head>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<Hydrate state={pageProps.dehydratedState}>
|
||||
<Theme.Provider>
|
||||
<IsOnMobile.Provider initialState={isMobile}>
|
||||
<Component {...pageProps} />
|
||||
</IsOnMobile.Provider>
|
||||
</Theme.Provider>
|
||||
</Hydrate>
|
||||
</QueryClientProvider>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import { List, Pagination, Typography } from '@douyinfe/semi-ui';
|
||||
import { WikiApiDefinition } from '@think/domains';
|
||||
import { DataRender } from 'components/data-render';
|
||||
import { Empty } from 'components/empty';
|
||||
import { Seo } from 'components/seo';
|
||||
import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card';
|
||||
import { useAllPublicWikis } from 'data/wiki';
|
||||
import { getAllPublicWikis, useAllPublicWikis } from 'data/refactor/wiki';
|
||||
import { SingleColumnLayout } from 'layouts/single-column';
|
||||
import type { NextPage } from 'next';
|
||||
import React from 'react';
|
||||
import { serverPrefetcher } from 'services/server-prefetcher';
|
||||
|
||||
const grid = {
|
||||
gutter: 16,
|
||||
|
@ -71,4 +73,11 @@ const Page: NextPage = () => {
|
|||
);
|
||||
};
|
||||
|
||||
Page.getInitialProps = async (ctx) => {
|
||||
const props = await serverPrefetcher(ctx, [
|
||||
{ url: `${WikiApiDefinition.getAllWikis.client()}?page=1`, action: (cookie) => getAllPublicWikis(1, cookie) },
|
||||
]);
|
||||
return props;
|
||||
};
|
||||
|
||||
export default Page;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Avatar, Button, List, Table, Typography } from '@douyinfe/semi-ui';
|
||||
import type { IDocument } from '@think/domains';
|
||||
import { CollectorApiDefinition, DocumentApiDefinition, IDocument } from '@think/domains';
|
||||
import { DataRender } from 'components/data-render';
|
||||
import { DocumentActions } from 'components/document/actions';
|
||||
import { Empty } from 'components/empty';
|
||||
|
@ -7,13 +7,14 @@ import { LocaleTime } from 'components/locale-time';
|
|||
import { Seo } from 'components/seo';
|
||||
import { WikiCreator } from 'components/wiki/create';
|
||||
import { WikiPinCard, WikiPinCardPlaceholder } from 'components/wiki/pin-card';
|
||||
import { useRecentDocuments } from 'data/document';
|
||||
import { useStaredWikis } from 'data/wiki';
|
||||
import { getCollectedWikis, useCollectedWikis } from 'data/refactor/collector';
|
||||
import { getRecentVisitedDocuments, useRecentDocuments } from 'data/refactor/document';
|
||||
import { useToggle } from 'hooks/use-toggle';
|
||||
import { SingleColumnLayout } from 'layouts/single-column';
|
||||
import type { NextPage } from 'next';
|
||||
import Link from 'next/link';
|
||||
import React, { useMemo } from 'react';
|
||||
import { serverPrefetcher } from 'services/server-prefetcher';
|
||||
|
||||
import styles from './index.module.scss';
|
||||
|
||||
|
@ -112,7 +113,7 @@ const RecentDocs = () => {
|
|||
|
||||
const Page: NextPage = () => {
|
||||
const [visible, toggleVisible] = useToggle(false);
|
||||
const { data: staredWikis, loading, error } = useStaredWikis();
|
||||
const { data: staredWikis, loading, error } = useCollectedWikis();
|
||||
|
||||
return (
|
||||
<SingleColumnLayout>
|
||||
|
@ -160,4 +161,12 @@ const Page: NextPage = () => {
|
|||
);
|
||||
};
|
||||
|
||||
Page.getInitialProps = async (ctx) => {
|
||||
const props = await serverPrefetcher(ctx, [
|
||||
{ url: CollectorApiDefinition.wikis.client(), action: (cookie) => getCollectedWikis(cookie) },
|
||||
{ url: DocumentApiDefinition.recent.client(), action: (cookie) => getRecentVisitedDocuments(cookie) },
|
||||
]);
|
||||
return props;
|
||||
};
|
||||
|
||||
export default Page;
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
import { List, Typography } from '@douyinfe/semi-ui';
|
||||
import { CollectorApiDefinition } from '@think/domains';
|
||||
import { DataRender } from 'components/data-render';
|
||||
import { DocumentCard, DocumentCardPlaceholder } from 'components/document/card';
|
||||
import { Empty } from 'components/empty';
|
||||
import { Seo } from 'components/seo';
|
||||
import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card';
|
||||
import { useStaredDocuments } from 'data/document';
|
||||
import { useStaredWikis } from 'data/wiki';
|
||||
import {
|
||||
getCollectedDocuments,
|
||||
getCollectedWikis,
|
||||
useCollectedDocuments,
|
||||
useCollectedWikis,
|
||||
} from 'data/refactor/collector';
|
||||
import { SingleColumnLayout } from 'layouts/single-column';
|
||||
import type { NextPage } from 'next';
|
||||
import React from 'react';
|
||||
import { serverPrefetcher } from 'services/server-prefetcher';
|
||||
|
||||
import styles from './index.module.scss';
|
||||
|
||||
|
@ -24,7 +30,7 @@ const grid = {
|
|||
};
|
||||
|
||||
const StarDocs = () => {
|
||||
const { data: docs, loading, error } = useStaredDocuments();
|
||||
const { data: docs, loading, error } = useCollectedDocuments();
|
||||
|
||||
return (
|
||||
<DataRender
|
||||
|
@ -58,7 +64,7 @@ const StarDocs = () => {
|
|||
};
|
||||
|
||||
const StarWikis = () => {
|
||||
const { data, loading, error } = useStaredWikis();
|
||||
const { data, loading, error } = useCollectedWikis();
|
||||
|
||||
return (
|
||||
<DataRender
|
||||
|
@ -114,4 +120,12 @@ const Page: NextPage = () => {
|
|||
);
|
||||
};
|
||||
|
||||
Page.getInitialProps = async (ctx) => {
|
||||
const props = await serverPrefetcher(ctx, [
|
||||
{ url: CollectorApiDefinition.wikis.client(), action: (cookie) => getCollectedWikis(cookie) },
|
||||
{ url: CollectorApiDefinition.documents.client(), action: (cookie) => getCollectedDocuments(cookie) },
|
||||
]);
|
||||
return props;
|
||||
};
|
||||
|
||||
export default Page;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Button, TabPane, Tabs, Typography } from '@douyinfe/semi-ui';
|
||||
import { Seo } from 'components/seo';
|
||||
import { TemplateList } from 'components/template/list';
|
||||
import { useOwnTemplates, usePublicTemplates } from 'data/template';
|
||||
import { useOwnTemplates, usePublicTemplates } from 'data/refactor/template';
|
||||
import { SingleColumnLayout } from 'layouts/single-column';
|
||||
import type { NextPage } from 'next';
|
||||
import Router, { useRouter } from 'next/router';
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
import { List, TabPane, Tabs, Typography } from '@douyinfe/semi-ui';
|
||||
import { WikiApiDefinition } from '@think/domains';
|
||||
import { DataRender } from 'components/data-render';
|
||||
import { Empty } from 'components/empty';
|
||||
import { Seo } from 'components/seo';
|
||||
import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card';
|
||||
import { WikiCreator } from 'components/wiki-creator';
|
||||
import { useAllWikis, useJoinWikis, useOwnWikis } from 'data/wiki';
|
||||
import { getAllWikis, getJoinWikis, getOwnWikis, useAllWikis, useJoinWikis, useOwnWikis } from 'data/refactor/wiki';
|
||||
import { CreateWikiIllustration } from 'illustrations/create-wiki';
|
||||
import { SingleColumnLayout } from 'layouts/single-column';
|
||||
import type { NextPage } from 'next';
|
||||
import React from 'react';
|
||||
import { serverPrefetcher } from 'services/server-prefetcher';
|
||||
|
||||
const grid = {
|
||||
gutter: 16,
|
||||
|
@ -79,4 +81,13 @@ const Page: NextPage = () => {
|
|||
);
|
||||
};
|
||||
|
||||
Page.getInitialProps = async (ctx) => {
|
||||
const props = await serverPrefetcher(ctx, [
|
||||
{ url: WikiApiDefinition.getAllWikis.client(), action: (cookie) => getAllWikis(cookie) },
|
||||
{ url: WikiApiDefinition.getJoinWikis.client(), action: (cookie) => getJoinWikis(cookie) },
|
||||
{ url: WikiApiDefinition.getOwnWikis.client(), action: (cookie) => getOwnWikis(cookie) },
|
||||
]);
|
||||
return props;
|
||||
};
|
||||
|
||||
export default Page;
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
import { Toast } from '@douyinfe/semi-ui';
|
||||
import axios from 'axios';
|
||||
import axios, { Axios, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import Router from 'next/router';
|
||||
|
||||
interface AxiosInstance extends Axios {
|
||||
request<T = any, R = AxiosResponse<T>>(config: AxiosRequestConfig): Promise<R>;
|
||||
}
|
||||
|
||||
export const HttpClient = axios.create({
|
||||
baseURL: process.env.SERVER_API_URL,
|
||||
timeout: 60000,
|
||||
});
|
||||
withCredentials: true,
|
||||
}) as AxiosInstance;
|
||||
|
||||
const isBrowser = typeof window !== 'undefined';
|
||||
|
||||
HttpClient.interceptors.request.use(
|
||||
(config) => {
|
||||
if (isBrowser) {
|
||||
const token = window.localStorage.getItem('token');
|
||||
if (config && config.headers && token) {
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
}
|
||||
}
|
||||
return config;
|
||||
},
|
||||
() => {
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import { NextPageContext } from 'next';
|
||||
import { dehydrate, QueryClient } from 'react-query';
|
||||
|
||||
type PrefetchActions = Array<{
|
||||
url: string;
|
||||
action: (cookie: string) => void;
|
||||
}>;
|
||||
|
||||
export async function serverPrefetcher(ctx: NextPageContext, actions: PrefetchActions) {
|
||||
const cookie = ctx.req?.headers?.cookie;
|
||||
|
||||
if (!cookie) return {};
|
||||
|
||||
const queryClient = new QueryClient();
|
||||
|
||||
await Promise.all(
|
||||
actions.map((action) => {
|
||||
return queryClient.prefetchQuery(action.url, () => action.action(cookie));
|
||||
})
|
||||
);
|
||||
|
||||
return {
|
||||
dehydratedState: dehydrate(queryClient),
|
||||
};
|
||||
}
|
|
@ -18,7 +18,7 @@ export declare const CollectorApiDefinition: {
|
|||
* 收藏(或取消收藏)
|
||||
*/
|
||||
toggle: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "toggle";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ export declare const CollectorApiDefinition: {
|
|||
* 检测是否收藏
|
||||
*/
|
||||
check: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "check";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ export declare const CollectorApiDefinition: {
|
|||
* 获取收藏的知识库
|
||||
*/
|
||||
wikis: {
|
||||
method: "Post";
|
||||
method: "get";
|
||||
server: "wikis";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ export declare const CollectorApiDefinition: {
|
|||
* 获取收藏的文档
|
||||
*/
|
||||
documents: {
|
||||
method: "Post";
|
||||
method: "get";
|
||||
server: "documents";
|
||||
client: () => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.CollectorApiDefinition = {
|
|||
* 收藏(或取消收藏)
|
||||
*/
|
||||
toggle: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'toggle',
|
||||
client: function () { return '/collector/toggle'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.CollectorApiDefinition = {
|
|||
* 检测是否收藏
|
||||
*/
|
||||
check: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'check',
|
||||
client: function () { return '/collector/check'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.CollectorApiDefinition = {
|
|||
* 获取收藏的知识库
|
||||
*/
|
||||
wikis: {
|
||||
method: 'Post',
|
||||
method: 'get',
|
||||
server: 'wikis',
|
||||
client: function () { return '/collector/wikis'; }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.CollectorApiDefinition = {
|
|||
* 获取收藏的文档
|
||||
*/
|
||||
documents: {
|
||||
method: 'Post',
|
||||
method: 'get',
|
||||
server: 'documents',
|
||||
client: function () { return '/collector/documents'; }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export declare const CommentApiDefinition: {
|
|||
* 新建评论
|
||||
*/
|
||||
add: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "add";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ export declare const CommentApiDefinition: {
|
|||
* 更新评论
|
||||
*/
|
||||
update: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "update";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export declare const CommentApiDefinition: {
|
|||
* 删除评论
|
||||
*/
|
||||
delete: {
|
||||
method: "Delete";
|
||||
method: "delete";
|
||||
server: "delete/:id";
|
||||
client: (id: IComment['id']) => string;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ export declare const CommentApiDefinition: {
|
|||
* 获取指定文档评论
|
||||
*/
|
||||
documents: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "document/:documentId";
|
||||
client: (documentId: IDocument['id']) => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.CommentApiDefinition = {
|
|||
* 新建评论
|
||||
*/
|
||||
add: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'add',
|
||||
client: function () { return '/comment/add'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.CommentApiDefinition = {
|
|||
* 更新评论
|
||||
*/
|
||||
update: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'update',
|
||||
client: function () { return '/comment/update'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.CommentApiDefinition = {
|
|||
* 删除评论
|
||||
*/
|
||||
"delete": {
|
||||
method: 'Delete',
|
||||
method: 'delete',
|
||||
server: 'delete/:id',
|
||||
client: function (id) { return "/comment/delete/".concat(id); }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.CommentApiDefinition = {
|
|||
* 获取指定文档评论
|
||||
*/
|
||||
documents: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'document/:documentId',
|
||||
client: function (documentId) { return "/comment/document/".concat(documentId); }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 搜索文档
|
||||
*/
|
||||
search: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "search";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取用户最近访问的文档
|
||||
*/
|
||||
recent: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "recent";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 新建文档
|
||||
*/
|
||||
create: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "create";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取文档详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "detail/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 更新文档
|
||||
*/
|
||||
updateById: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "update/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取文档版本记录
|
||||
*/
|
||||
getVersionById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "version/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取文档成员
|
||||
*/
|
||||
getMemberById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "member/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -60,7 +60,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 添加文档成员
|
||||
*/
|
||||
addMemberById: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "member/:id/add";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 更新文档成员
|
||||
*/
|
||||
updateMemberById: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "member/:id/update";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -76,7 +76,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 删除文档成员
|
||||
*/
|
||||
deleteMemberById: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "member/:id/delete";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取子文档
|
||||
*/
|
||||
getChildren: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "children";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -92,7 +92,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 删除文档
|
||||
*/
|
||||
deleteById: {
|
||||
method: "Delete";
|
||||
method: "delete";
|
||||
server: "delete/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 分享文档
|
||||
*/
|
||||
shareById: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "share/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -108,7 +108,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取公开文档详情
|
||||
*/
|
||||
getPublicDetailById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "public/detail/:id";
|
||||
client: (id: IDocument['id']) => string;
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ export declare const DocumentApiDefinition: {
|
|||
* 获取公开文档的子文档
|
||||
*/
|
||||
getPublicChildren: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "public/children";
|
||||
client: () => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.DocumentApiDefinition = {
|
|||
* 搜索文档
|
||||
*/
|
||||
search: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'search',
|
||||
client: function () { return '/document/search'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取用户最近访问的文档
|
||||
*/
|
||||
recent: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'recent',
|
||||
client: function () { return '/document/recent'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.DocumentApiDefinition = {
|
|||
* 新建文档
|
||||
*/
|
||||
create: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'create',
|
||||
client: function () { return '/document/create'; }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取文档详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'detail/:id',
|
||||
client: function (id) { return "/document/detail/".concat(id); }
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ exports.DocumentApiDefinition = {
|
|||
* 更新文档
|
||||
*/
|
||||
updateById: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'update/:id',
|
||||
client: function (id) { return "/document/update/".concat(id); }
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取文档版本记录
|
||||
*/
|
||||
getVersionById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'version/:id',
|
||||
client: function (id) { return "/document/version/".concat(id); }
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取文档成员
|
||||
*/
|
||||
getMemberById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'member/:id',
|
||||
client: function (id) { return "/document/member/".concat(id); }
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ exports.DocumentApiDefinition = {
|
|||
* 添加文档成员
|
||||
*/
|
||||
addMemberById: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'member/:id/add',
|
||||
client: function (id) { return "/document/member/".concat(id, "/add"); }
|
||||
},
|
||||
|
@ -70,7 +70,7 @@ exports.DocumentApiDefinition = {
|
|||
* 更新文档成员
|
||||
*/
|
||||
updateMemberById: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'member/:id/update',
|
||||
client: function (id) { return "/document/member/".concat(id, "/update"); }
|
||||
},
|
||||
|
@ -78,7 +78,7 @@ exports.DocumentApiDefinition = {
|
|||
* 删除文档成员
|
||||
*/
|
||||
deleteMemberById: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'member/:id/delete',
|
||||
client: function (id) { return "/document/member/".concat(id, "/delete"); }
|
||||
},
|
||||
|
@ -86,7 +86,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取子文档
|
||||
*/
|
||||
getChildren: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'children',
|
||||
client: function () { return "/document/children"; }
|
||||
},
|
||||
|
@ -94,7 +94,7 @@ exports.DocumentApiDefinition = {
|
|||
* 删除文档
|
||||
*/
|
||||
deleteById: {
|
||||
method: 'Delete',
|
||||
method: 'delete',
|
||||
server: 'delete/:id',
|
||||
client: function (id) { return "/document/delete/".concat(id); }
|
||||
},
|
||||
|
@ -102,7 +102,7 @@ exports.DocumentApiDefinition = {
|
|||
* 分享文档
|
||||
*/
|
||||
shareById: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'share/:id',
|
||||
client: function (id) { return "/document/share/".concat(id); }
|
||||
},
|
||||
|
@ -110,7 +110,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取公开文档详情
|
||||
*/
|
||||
getPublicDetailById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'public/detail/:id',
|
||||
client: function (id) { return "/document/public/detail/".concat(id); }
|
||||
},
|
||||
|
@ -118,7 +118,7 @@ exports.DocumentApiDefinition = {
|
|||
* 获取公开文档的子文档
|
||||
*/
|
||||
getPublicChildren: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'public/children',
|
||||
client: function () { return "/document/public/children"; }
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ export declare const FileApiDefinition: {
|
|||
* 上传文件
|
||||
*/
|
||||
upload: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "upload";
|
||||
client: () => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.FileApiDefinition = {
|
|||
* 上传文件
|
||||
*/
|
||||
upload: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'upload',
|
||||
client: function () { return '/file/upload'; }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export declare const MessageApiDefinition: {
|
|||
* 获取未读消息
|
||||
*/
|
||||
getUnread: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "unread";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ export declare const MessageApiDefinition: {
|
|||
* 获取已读消息
|
||||
*/
|
||||
getRead: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "read";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export declare const MessageApiDefinition: {
|
|||
* 获取所有消息
|
||||
*/
|
||||
getAll: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "all";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ export declare const MessageApiDefinition: {
|
|||
* 将消息标记为已读
|
||||
*/
|
||||
readMessage: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "read/:id";
|
||||
client: (id: IMessage['id']) => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.MessageApiDefinition = {
|
|||
* 获取未读消息
|
||||
*/
|
||||
getUnread: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'unread',
|
||||
client: function () { return '/message/unread'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.MessageApiDefinition = {
|
|||
* 获取已读消息
|
||||
*/
|
||||
getRead: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'read',
|
||||
client: function () { return '/message/read'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.MessageApiDefinition = {
|
|||
* 获取所有消息
|
||||
*/
|
||||
getAll: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'all',
|
||||
client: function () { return '/message/all'; }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.MessageApiDefinition = {
|
|||
* 将消息标记为已读
|
||||
*/
|
||||
readMessage: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'read/:id',
|
||||
client: function (id) { return "/message/read/".concat(id); }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export declare const TemplateApiDefinition: {
|
|||
* 获取公开模板
|
||||
*/
|
||||
public: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "public";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ export declare const TemplateApiDefinition: {
|
|||
* 获取个人创建模板
|
||||
*/
|
||||
own: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "own";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export declare const TemplateApiDefinition: {
|
|||
* 新建模板
|
||||
*/
|
||||
add: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "add";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ export declare const TemplateApiDefinition: {
|
|||
* 更新模板
|
||||
*/
|
||||
updateById: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "update/:id";
|
||||
client: (id: ITemplate['id']) => string;
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ export declare const TemplateApiDefinition: {
|
|||
* 获取模板详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "detail/:id";
|
||||
client: (id: ITemplate['id']) => string;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ export declare const TemplateApiDefinition: {
|
|||
* 删除模板
|
||||
*/
|
||||
deleteById: {
|
||||
method: "Delete";
|
||||
method: "delete";
|
||||
server: "delete/:id";
|
||||
client: (id: ITemplate['id']) => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.TemplateApiDefinition = {
|
|||
* 获取公开模板
|
||||
*/
|
||||
public: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'public',
|
||||
client: function () { return '/template/public'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.TemplateApiDefinition = {
|
|||
* 获取个人创建模板
|
||||
*/
|
||||
own: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'own',
|
||||
client: function () { return '/template/own'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.TemplateApiDefinition = {
|
|||
* 新建模板
|
||||
*/
|
||||
add: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'add',
|
||||
client: function () { return '/template/add'; }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.TemplateApiDefinition = {
|
|||
* 更新模板
|
||||
*/
|
||||
updateById: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'update/:id',
|
||||
client: function (id) { return "/template/update/".concat(id); }
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ exports.TemplateApiDefinition = {
|
|||
* 获取模板详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'detail/:id',
|
||||
client: function (id) { return "/template/detail/".concat(id); }
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ exports.TemplateApiDefinition = {
|
|||
* 删除模板
|
||||
*/
|
||||
deleteById: {
|
||||
method: 'Delete',
|
||||
method: 'delete',
|
||||
server: 'delete/:id',
|
||||
client: function (id) { return "/template/delete/".concat(id); }
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ export declare const UserApiDefinition: {
|
|||
* 获取用户
|
||||
*/
|
||||
getAllUsers: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "/";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ export declare const UserApiDefinition: {
|
|||
* 注册
|
||||
*/
|
||||
register: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "register";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ export declare const UserApiDefinition: {
|
|||
* 登录
|
||||
*/
|
||||
login: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "login";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ export declare const UserApiDefinition: {
|
|||
* 登出
|
||||
*/
|
||||
logout: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "logout";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -35,7 +35,7 @@ export declare const UserApiDefinition: {
|
|||
* 更新
|
||||
*/
|
||||
update: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "update";
|
||||
client: () => string;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.UserApiDefinition = {
|
|||
* 获取用户
|
||||
*/
|
||||
getAllUsers: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: '/',
|
||||
client: function () { return '/user'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.UserApiDefinition = {
|
|||
* 注册
|
||||
*/
|
||||
register: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'register',
|
||||
client: function () { return '/user/register'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.UserApiDefinition = {
|
|||
* 登录
|
||||
*/
|
||||
login: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'login',
|
||||
client: function () { return '/user/login'; }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.UserApiDefinition = {
|
|||
* 登出
|
||||
*/
|
||||
logout: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'logout',
|
||||
client: function () { return '/user/logout'; }
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ exports.UserApiDefinition = {
|
|||
* 更新
|
||||
*/
|
||||
update: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'update',
|
||||
client: function () { return "/user/update"; }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取用户所有知识库(创建的、参与的)
|
||||
*/
|
||||
getAllWikis: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "list/all";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取用户创建的知识库
|
||||
*/
|
||||
getOwnWikis: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "list/own";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取用户参与的知识库
|
||||
*/
|
||||
getJoinWikis: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "list/join";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ export declare const WikiApiDefinition: {
|
|||
* 新建知识库
|
||||
*/
|
||||
add: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "add";
|
||||
client: () => string;
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取知识库首页文档
|
||||
*/
|
||||
getHomeDocumentById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "homedoc/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取知识库目录
|
||||
*/
|
||||
getTocsById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "tocs/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ export declare const WikiApiDefinition: {
|
|||
* 更新知识库目录
|
||||
*/
|
||||
updateTocsById: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "tocs/:id/update";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -60,7 +60,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取知识库所有文档
|
||||
*/
|
||||
getDocumentsById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "documents/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -68,7 +68,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取知识库详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "detail/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -76,7 +76,7 @@ export declare const WikiApiDefinition: {
|
|||
* 更新知识库
|
||||
*/
|
||||
updateById: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "update/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -84,7 +84,7 @@ export declare const WikiApiDefinition: {
|
|||
* 删除知识库
|
||||
*/
|
||||
deleteById: {
|
||||
method: "Delete";
|
||||
method: "delete";
|
||||
server: "delet/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -92,7 +92,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取知识库成员
|
||||
*/
|
||||
getMemberById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "member/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ export declare const WikiApiDefinition: {
|
|||
* 添加知识库成员
|
||||
*/
|
||||
addMemberById: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "member/:id/add";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -108,7 +108,7 @@ export declare const WikiApiDefinition: {
|
|||
* 更新知识库成员
|
||||
*/
|
||||
updateMemberById: {
|
||||
method: "Patch";
|
||||
method: "patch";
|
||||
server: "member/:id/update";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -116,7 +116,7 @@ export declare const WikiApiDefinition: {
|
|||
* 删除知识库成员
|
||||
*/
|
||||
deleteMemberById: {
|
||||
method: "Delete";
|
||||
method: "delete";
|
||||
server: "member/:id/delete";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -124,7 +124,7 @@ export declare const WikiApiDefinition: {
|
|||
* 分享知识库
|
||||
*/
|
||||
shareById: {
|
||||
method: "Post";
|
||||
method: "post";
|
||||
server: "share/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取公开知识库首页文档
|
||||
*/
|
||||
getPublicHomeDocumentById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "/public/homedoc/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -140,7 +140,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取公开知识库目录
|
||||
*/
|
||||
getPublicTocsById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "/public/tocs/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -148,7 +148,7 @@ export declare const WikiApiDefinition: {
|
|||
* 获取知识库详情
|
||||
*/
|
||||
getPublicDetailById: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "/public/detail/:id";
|
||||
client: (id: IWiki['id']) => string;
|
||||
};
|
||||
|
@ -156,8 +156,8 @@ export declare const WikiApiDefinition: {
|
|||
* 获取所有公开知识库
|
||||
*/
|
||||
getPublicWikis: {
|
||||
method: "Get";
|
||||
method: "get";
|
||||
server: "/public/wikis";
|
||||
client: (id: IWiki['id']) => string;
|
||||
client: () => string;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取用户所有知识库(创建的、参与的)
|
||||
*/
|
||||
getAllWikis: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'list/all',
|
||||
client: function () { return '/wiki/list/all'; }
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取用户创建的知识库
|
||||
*/
|
||||
getOwnWikis: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'list/own',
|
||||
client: function () { return '/wiki/list/own'; }
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取用户参与的知识库
|
||||
*/
|
||||
getJoinWikis: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'list/join',
|
||||
client: function () { return '/wiki/list/join'; }
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ exports.WikiApiDefinition = {
|
|||
* 新建知识库
|
||||
*/
|
||||
add: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'add',
|
||||
client: function () { return '/wiki/add'; }
|
||||
},
|
||||
|
@ -38,7 +38,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取知识库首页文档
|
||||
*/
|
||||
getHomeDocumentById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'homedoc/:id',
|
||||
client: function (id) { return "/wiki/homedoc/".concat(id); }
|
||||
},
|
||||
|
@ -46,7 +46,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取知识库目录
|
||||
*/
|
||||
getTocsById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'tocs/:id',
|
||||
client: function (id) { return "/wiki/tocs/".concat(id); }
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ exports.WikiApiDefinition = {
|
|||
* 更新知识库目录
|
||||
*/
|
||||
updateTocsById: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'tocs/:id/update',
|
||||
client: function (id) { return "/wiki/tocs/".concat(id, "/update"); }
|
||||
},
|
||||
|
@ -62,7 +62,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取知识库所有文档
|
||||
*/
|
||||
getDocumentsById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'documents/:id',
|
||||
client: function (id) { return "/wiki/documents/".concat(id); }
|
||||
},
|
||||
|
@ -70,7 +70,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取知识库详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'detail/:id',
|
||||
client: function (id) { return "/wiki/detail/".concat(id); }
|
||||
},
|
||||
|
@ -78,7 +78,7 @@ exports.WikiApiDefinition = {
|
|||
* 更新知识库
|
||||
*/
|
||||
updateById: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'update/:id',
|
||||
client: function (id) { return "/wiki/update/".concat(id); }
|
||||
},
|
||||
|
@ -86,7 +86,7 @@ exports.WikiApiDefinition = {
|
|||
* 删除知识库
|
||||
*/
|
||||
deleteById: {
|
||||
method: 'Delete',
|
||||
method: 'delete',
|
||||
server: 'delet/:id',
|
||||
client: function (id) { return "/wiki/delet/".concat(id); }
|
||||
},
|
||||
|
@ -94,7 +94,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取知识库成员
|
||||
*/
|
||||
getMemberById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: 'member/:id',
|
||||
client: function (id) { return "/wiki/member/".concat(id); }
|
||||
},
|
||||
|
@ -102,7 +102,7 @@ exports.WikiApiDefinition = {
|
|||
* 添加知识库成员
|
||||
*/
|
||||
addMemberById: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'member/:id/add',
|
||||
client: function (id) { return "/wiki/member/".concat(id, "/add"); }
|
||||
},
|
||||
|
@ -110,7 +110,7 @@ exports.WikiApiDefinition = {
|
|||
* 更新知识库成员
|
||||
*/
|
||||
updateMemberById: {
|
||||
method: 'Patch',
|
||||
method: 'patch',
|
||||
server: 'member/:id/update',
|
||||
client: function (id) { return "/wiki/member/".concat(id, "/update"); }
|
||||
},
|
||||
|
@ -118,7 +118,7 @@ exports.WikiApiDefinition = {
|
|||
* 删除知识库成员
|
||||
*/
|
||||
deleteMemberById: {
|
||||
method: 'Delete',
|
||||
method: 'delete',
|
||||
server: 'member/:id/delete',
|
||||
client: function (id) { return "/wiki/member/".concat(id, "/delete"); }
|
||||
},
|
||||
|
@ -126,7 +126,7 @@ exports.WikiApiDefinition = {
|
|||
* 分享知识库
|
||||
*/
|
||||
shareById: {
|
||||
method: 'Post',
|
||||
method: 'post',
|
||||
server: 'share/:id',
|
||||
client: function (id) { return "/wiki/share/".concat(id); }
|
||||
},
|
||||
|
@ -134,7 +134,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取公开知识库首页文档
|
||||
*/
|
||||
getPublicHomeDocumentById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: '/public/homedoc/:id',
|
||||
client: function (id) { return "/wiki/public/homedoc/".concat(id); }
|
||||
},
|
||||
|
@ -142,7 +142,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取公开知识库目录
|
||||
*/
|
||||
getPublicTocsById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: '/public/tocs/:id',
|
||||
client: function (id) { return "/wiki/public/tocs/".concat(id); }
|
||||
},
|
||||
|
@ -150,7 +150,7 @@ exports.WikiApiDefinition = {
|
|||
* 获取知识库详情
|
||||
*/
|
||||
getPublicDetailById: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: '/public/detail/:id',
|
||||
client: function (id) { return "/wiki/public/detail/".concat(id); }
|
||||
},
|
||||
|
@ -158,8 +158,8 @@ exports.WikiApiDefinition = {
|
|||
* 获取所有公开知识库
|
||||
*/
|
||||
getPublicWikis: {
|
||||
method: 'Get',
|
||||
method: 'get',
|
||||
server: '/public/wikis',
|
||||
client: function (id) { return "/wiki/public/wikis"; }
|
||||
client: function () { return "/wiki/public/wikis"; }
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,26 +1,11 @@
|
|||
import { IDocument, IWiki, CollectType } from '../models';
|
||||
|
||||
export type CollectorApiTypeDefinition = {
|
||||
toggle: {
|
||||
request: {
|
||||
targetId: IDocument['id'] | IWiki['id'];
|
||||
type: CollectType;
|
||||
};
|
||||
};
|
||||
check: {
|
||||
request: {
|
||||
targetId: IDocument['id'] | IWiki['id'];
|
||||
type: CollectType;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export const CollectorApiDefinition = {
|
||||
/**
|
||||
* 收藏(或取消收藏)
|
||||
*/
|
||||
toggle: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'toggle' as const,
|
||||
client: () => '/collector/toggle',
|
||||
},
|
||||
|
@ -29,7 +14,7 @@ export const CollectorApiDefinition = {
|
|||
* 检测是否收藏
|
||||
*/
|
||||
check: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'check' as const,
|
||||
client: () => '/collector/check',
|
||||
},
|
||||
|
@ -38,7 +23,7 @@ export const CollectorApiDefinition = {
|
|||
* 获取收藏的知识库
|
||||
*/
|
||||
wikis: {
|
||||
method: 'Post' as const,
|
||||
method: 'get' as const,
|
||||
server: 'wikis' as const,
|
||||
client: () => '/collector/wikis',
|
||||
},
|
||||
|
@ -47,7 +32,7 @@ export const CollectorApiDefinition = {
|
|||
* 获取收藏的文档
|
||||
*/
|
||||
documents: {
|
||||
method: 'Post' as const,
|
||||
method: 'get' as const,
|
||||
server: 'documents' as const,
|
||||
client: () => '/collector/documents',
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ export const CommentApiDefinition = {
|
|||
* 新建评论
|
||||
*/
|
||||
add: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'add' as const,
|
||||
client: () => '/comment/add',
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ export const CommentApiDefinition = {
|
|||
* 更新评论
|
||||
*/
|
||||
update: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'update' as const,
|
||||
client: () => '/comment/update',
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ export const CommentApiDefinition = {
|
|||
* 删除评论
|
||||
*/
|
||||
delete: {
|
||||
method: 'Delete' as const,
|
||||
method: 'delete' as const,
|
||||
server: 'delete/:id' as const,
|
||||
client: (id: IComment['id']) => `/comment/delete/${id}`,
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export const CommentApiDefinition = {
|
|||
* 获取指定文档评论
|
||||
*/
|
||||
documents: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'document/:documentId' as const,
|
||||
client: (documentId: IDocument['id']) => `/comment/document/${documentId}`,
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ export const DocumentApiDefinition = {
|
|||
* 搜索文档
|
||||
*/
|
||||
search: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'search' as const,
|
||||
client: () => '/document/search',
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取用户最近访问的文档
|
||||
*/
|
||||
recent: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'recent' as const,
|
||||
client: () => '/document/recent',
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ export const DocumentApiDefinition = {
|
|||
* 新建文档
|
||||
*/
|
||||
create: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'create' as const,
|
||||
client: () => '/document/create',
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取文档详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'detail/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/detail/${id}`,
|
||||
},
|
||||
|
@ -41,7 +41,7 @@ export const DocumentApiDefinition = {
|
|||
* 更新文档
|
||||
*/
|
||||
updateById: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'update/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/update/${id}`,
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取文档版本记录
|
||||
*/
|
||||
getVersionById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'version/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/version/${id}`,
|
||||
},
|
||||
|
@ -59,7 +59,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取文档成员
|
||||
*/
|
||||
getMemberById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'member/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/member/${id}`,
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ export const DocumentApiDefinition = {
|
|||
* 添加文档成员
|
||||
*/
|
||||
addMemberById: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'member/:id/add' as const,
|
||||
client: (id: IDocument['id']) => `/document/member/${id}/add`,
|
||||
},
|
||||
|
@ -77,7 +77,7 @@ export const DocumentApiDefinition = {
|
|||
* 更新文档成员
|
||||
*/
|
||||
updateMemberById: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'member/:id/update' as const,
|
||||
client: (id: IDocument['id']) => `/document/member/${id}/update`,
|
||||
},
|
||||
|
@ -86,7 +86,7 @@ export const DocumentApiDefinition = {
|
|||
* 删除文档成员
|
||||
*/
|
||||
deleteMemberById: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'member/:id/delete' as const,
|
||||
client: (id: IDocument['id']) => `/document/member/${id}/delete`,
|
||||
},
|
||||
|
@ -95,7 +95,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取子文档
|
||||
*/
|
||||
getChildren: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'children' as const,
|
||||
client: () => `/document/children`,
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ export const DocumentApiDefinition = {
|
|||
* 删除文档
|
||||
*/
|
||||
deleteById: {
|
||||
method: 'Delete' as const,
|
||||
method: 'delete' as const,
|
||||
server: 'delete/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/delete/${id}`,
|
||||
},
|
||||
|
@ -113,7 +113,7 @@ export const DocumentApiDefinition = {
|
|||
* 分享文档
|
||||
*/
|
||||
shareById: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'share/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/share/${id}`,
|
||||
},
|
||||
|
@ -122,7 +122,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取公开文档详情
|
||||
*/
|
||||
getPublicDetailById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'public/detail/:id' as const,
|
||||
client: (id: IDocument['id']) => `/document/public/detail/${id}`,
|
||||
},
|
||||
|
@ -131,7 +131,7 @@ export const DocumentApiDefinition = {
|
|||
* 获取公开文档的子文档
|
||||
*/
|
||||
getPublicChildren: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'public/children' as const,
|
||||
client: () => `/document/public/children`,
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@ export const FileApiDefinition = {
|
|||
* 上传文件
|
||||
*/
|
||||
upload: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'upload' as const,
|
||||
client: () => '/file/upload',
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ export const MessageApiDefinition = {
|
|||
* 获取未读消息
|
||||
*/
|
||||
getUnread: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'unread' as const,
|
||||
client: () => '/message/unread',
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ export const MessageApiDefinition = {
|
|||
* 获取已读消息
|
||||
*/
|
||||
getRead: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'read' as const,
|
||||
client: () => '/message/read',
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ export const MessageApiDefinition = {
|
|||
* 获取所有消息
|
||||
*/
|
||||
getAll: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'all' as const,
|
||||
client: () => '/message/all',
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export const MessageApiDefinition = {
|
|||
* 将消息标记为已读
|
||||
*/
|
||||
readMessage: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'read/:id' as const,
|
||||
client: (id: IMessage['id']) => `/message/read/${id}`,
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ export const TemplateApiDefinition = {
|
|||
* 获取公开模板
|
||||
*/
|
||||
public: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'public' as const,
|
||||
client: () => '/template/public',
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ export const TemplateApiDefinition = {
|
|||
* 获取个人创建模板
|
||||
*/
|
||||
own: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'own' as const,
|
||||
client: () => '/template/own',
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ export const TemplateApiDefinition = {
|
|||
* 新建模板
|
||||
*/
|
||||
add: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'add' as const,
|
||||
client: () => '/template/add',
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export const TemplateApiDefinition = {
|
|||
* 更新模板
|
||||
*/
|
||||
updateById: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'update/:id' as const,
|
||||
client: (id: ITemplate['id']) => `/template/update/${id}`,
|
||||
},
|
||||
|
@ -41,7 +41,7 @@ export const TemplateApiDefinition = {
|
|||
* 获取模板详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'detail/:id' as const,
|
||||
client: (id: ITemplate['id']) => `/template/detail/${id}`,
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export const TemplateApiDefinition = {
|
|||
* 删除模板
|
||||
*/
|
||||
deleteById: {
|
||||
method: 'Delete' as const,
|
||||
method: 'delete' as const,
|
||||
server: 'delete/:id' as const,
|
||||
client: (id: ITemplate['id']) => `/template/delete/${id}`,
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ export const UserApiDefinition = {
|
|||
* 获取用户
|
||||
*/
|
||||
getAllUsers: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: '/' as const,
|
||||
client: () => '/user',
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ export const UserApiDefinition = {
|
|||
* 注册
|
||||
*/
|
||||
register: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'register' as const,
|
||||
client: () => '/user/register',
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ export const UserApiDefinition = {
|
|||
* 登录
|
||||
*/
|
||||
login: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'login' as const,
|
||||
client: () => '/user/login',
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export const UserApiDefinition = {
|
|||
* 登出
|
||||
*/
|
||||
logout: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'logout' as const,
|
||||
client: () => '/user/logout',
|
||||
},
|
||||
|
@ -41,7 +41,7 @@ export const UserApiDefinition = {
|
|||
* 更新
|
||||
*/
|
||||
update: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'update' as const,
|
||||
client: () => `/user/update`,
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ export const WikiApiDefinition = {
|
|||
* 获取用户所有知识库(创建的、参与的)
|
||||
*/
|
||||
getAllWikis: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'list/all' as const,
|
||||
client: () => '/wiki/list/all',
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ export const WikiApiDefinition = {
|
|||
* 获取用户创建的知识库
|
||||
*/
|
||||
getOwnWikis: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'list/own' as const,
|
||||
client: () => '/wiki/list/own',
|
||||
},
|
||||
|
@ -23,7 +23,7 @@ export const WikiApiDefinition = {
|
|||
* 获取用户参与的知识库
|
||||
*/
|
||||
getJoinWikis: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'list/join' as const,
|
||||
client: () => '/wiki/list/join',
|
||||
},
|
||||
|
@ -32,7 +32,7 @@ export const WikiApiDefinition = {
|
|||
* 新建知识库
|
||||
*/
|
||||
add: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'add' as const,
|
||||
client: () => '/wiki/add',
|
||||
},
|
||||
|
@ -41,7 +41,7 @@ export const WikiApiDefinition = {
|
|||
* 获取知识库首页文档
|
||||
*/
|
||||
getHomeDocumentById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'homedoc/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/homedoc/${id}`,
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export const WikiApiDefinition = {
|
|||
* 获取知识库目录
|
||||
*/
|
||||
getTocsById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'tocs/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/tocs/${id}`,
|
||||
},
|
||||
|
@ -59,7 +59,7 @@ export const WikiApiDefinition = {
|
|||
* 更新知识库目录
|
||||
*/
|
||||
updateTocsById: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'tocs/:id/update' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/tocs/${id}/update`,
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ export const WikiApiDefinition = {
|
|||
* 获取知识库所有文档
|
||||
*/
|
||||
getDocumentsById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'documents/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/documents/${id}`,
|
||||
},
|
||||
|
@ -77,7 +77,7 @@ export const WikiApiDefinition = {
|
|||
* 获取知识库详情
|
||||
*/
|
||||
getDetailById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'detail/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/detail/${id}`,
|
||||
},
|
||||
|
@ -86,7 +86,7 @@ export const WikiApiDefinition = {
|
|||
* 更新知识库
|
||||
*/
|
||||
updateById: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'update/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/update/${id}`,
|
||||
},
|
||||
|
@ -95,7 +95,7 @@ export const WikiApiDefinition = {
|
|||
* 删除知识库
|
||||
*/
|
||||
deleteById: {
|
||||
method: 'Delete' as const,
|
||||
method: 'delete' as const,
|
||||
server: 'delet/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/delet/${id}`,
|
||||
},
|
||||
|
@ -104,7 +104,7 @@ export const WikiApiDefinition = {
|
|||
* 获取知识库成员
|
||||
*/
|
||||
getMemberById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: 'member/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/member/${id}`,
|
||||
},
|
||||
|
@ -113,7 +113,7 @@ export const WikiApiDefinition = {
|
|||
* 添加知识库成员
|
||||
*/
|
||||
addMemberById: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'member/:id/add' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/member/${id}/add`,
|
||||
},
|
||||
|
@ -122,7 +122,7 @@ export const WikiApiDefinition = {
|
|||
* 更新知识库成员
|
||||
*/
|
||||
updateMemberById: {
|
||||
method: 'Patch' as const,
|
||||
method: 'patch' as const,
|
||||
server: 'member/:id/update' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/member/${id}/update`,
|
||||
},
|
||||
|
@ -131,7 +131,7 @@ export const WikiApiDefinition = {
|
|||
* 删除知识库成员
|
||||
*/
|
||||
deleteMemberById: {
|
||||
method: 'Delete' as const,
|
||||
method: 'delete' as const,
|
||||
server: 'member/:id/delete' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/member/${id}/delete`,
|
||||
},
|
||||
|
@ -140,7 +140,7 @@ export const WikiApiDefinition = {
|
|||
* 分享知识库
|
||||
*/
|
||||
shareById: {
|
||||
method: 'Post' as const,
|
||||
method: 'post' as const,
|
||||
server: 'share/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/share/${id}`,
|
||||
},
|
||||
|
@ -149,7 +149,7 @@ export const WikiApiDefinition = {
|
|||
* 获取公开知识库首页文档
|
||||
*/
|
||||
getPublicHomeDocumentById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: '/public/homedoc/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/public/homedoc/${id}`,
|
||||
},
|
||||
|
@ -158,7 +158,7 @@ export const WikiApiDefinition = {
|
|||
* 获取公开知识库目录
|
||||
*/
|
||||
getPublicTocsById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: '/public/tocs/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/public/tocs/${id}`,
|
||||
},
|
||||
|
@ -167,7 +167,7 @@ export const WikiApiDefinition = {
|
|||
* 获取知识库详情
|
||||
*/
|
||||
getPublicDetailById: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: '/public/detail/:id' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/public/detail/${id}`,
|
||||
},
|
||||
|
@ -176,8 +176,8 @@ export const WikiApiDefinition = {
|
|||
* 获取所有公开知识库
|
||||
*/
|
||||
getPublicWikis: {
|
||||
method: 'Get' as const,
|
||||
method: 'get' as const,
|
||||
server: '/public/wikis' as const,
|
||||
client: (id: IWiki['id']) => `/wiki/public/wikis`,
|
||||
client: () => `/wiki/public/wikis`,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
"@types/cron": "^2.0.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "27.0.2",
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
||||
|
|
|
@ -34,7 +34,7 @@ export class CollectorController {
|
|||
* 检测是否收藏
|
||||
*/
|
||||
@UseInterceptors(ClassSerializerInterceptor)
|
||||
@Post(CollectorApiDefinition.toggle.server)
|
||||
@Post(CollectorApiDefinition.check.server)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@UseGuards(JwtGuard)
|
||||
async checkStar(@Request() req, @Body() dto: CollectDto) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import { DocumentService } from '@services/document.service';
|
|||
import { OutUser, UserService } from '@services/user.service';
|
||||
import { WikiService } from '@services/wiki.service';
|
||||
import { CollectType } from '@think/domains';
|
||||
import * as lodash from 'lodash';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
|
@ -28,7 +29,8 @@ export class CollectorService {
|
|||
};
|
||||
const record = await this.collectorRepo.findOne(data);
|
||||
if (record) {
|
||||
return await this.collectorRepo.remove(record);
|
||||
await this.collectorRepo.remove(record);
|
||||
return;
|
||||
} else {
|
||||
const res = await this.collectorRepo.create(data);
|
||||
const ret = await this.collectorRepo.save(res);
|
||||
|
@ -71,6 +73,8 @@ export class CollectorService {
|
|||
})
|
||||
);
|
||||
|
||||
return withCreateUserRes;
|
||||
return withCreateUserRes.map((document) => {
|
||||
return lodash.omit(document, ['state', 'content', 'index', 'createUserId']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ export class DocumentVersionService {
|
|||
return;
|
||||
}
|
||||
|
||||
this.max = lodash.get(config, 'server.maxDocumentVersion', 0);
|
||||
this.max = lodash.get(config, 'server.maxDocumentVersion', 0) as number;
|
||||
|
||||
try {
|
||||
const redis = new Redis({
|
||||
|
|
|
@ -15,8 +15,9 @@ import { OutUser, UserService } from '@services/user.service';
|
|||
import { ViewService } from '@services/view.service';
|
||||
import { WikiService } from '@services/wiki.service';
|
||||
import { EMPTY_DOCUMNENT } from '@think/constants';
|
||||
import { DocumentStatus, IDocument, WikiUserRole } from '@think/domains';
|
||||
import { DocumentStatus, WikiUserRole } from '@think/domains';
|
||||
import { instanceToPlain } from 'class-transformer';
|
||||
import * as lodash from 'lodash';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
|
@ -636,7 +637,9 @@ export class DocumentService {
|
|||
})
|
||||
);
|
||||
|
||||
return ret.filter(Boolean);
|
||||
return ret.filter(Boolean).map((item) => {
|
||||
return lodash.omit(item, ['state', 'content', 'index', 'createUserId']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nest
|
|||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { OutUser, UserService } from '@services/user.service';
|
||||
import { instanceToPlain } from 'class-transformer';
|
||||
import * as lodash from 'lodash';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@Injectable()
|
||||
|
@ -57,7 +58,7 @@ export class TemplateService {
|
|||
}
|
||||
|
||||
/**
|
||||
* 更新模板
|
||||
* 获取模板
|
||||
* @param id
|
||||
* @param tag
|
||||
*/
|
||||
|
@ -69,7 +70,7 @@ export class TemplateService {
|
|||
}
|
||||
|
||||
const createUser = await this.userService.findById(template.createUserId);
|
||||
return { ...template, createUser };
|
||||
return lodash.omit({ ...template, createUser }, ['state']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
103
pnpm-lock.yaml
103
pnpm-lock.yaml
|
@ -131,6 +131,7 @@ importers:
|
|||
react-helmet: ^6.1.0
|
||||
react-lazy-load-image-component: ^1.5.4
|
||||
react-pdf: ^5.7.2
|
||||
react-query: ^3.39.0
|
||||
react-split-pane: ^0.1.92
|
||||
scroll-into-view-if-needed: ^2.2.29
|
||||
swr: ^1.2.0
|
||||
|
@ -219,6 +220,7 @@ importers:
|
|||
react-helmet: 6.1.0_react@17.0.2
|
||||
react-lazy-load-image-component: 1.5.4_react-dom@17.0.2+react@17.0.2
|
||||
react-pdf: 5.7.2_react-dom@17.0.2+react@17.0.2
|
||||
react-query: 3.39.0_react-dom@17.0.2+react@17.0.2
|
||||
react-split-pane: 0.1.92_react-dom@17.0.2+react@17.0.2
|
||||
scroll-into-view-if-needed: 2.2.29
|
||||
swr: 1.2.0_react@17.0.2
|
||||
|
@ -236,7 +238,7 @@ importers:
|
|||
eslint: 8.14.0
|
||||
eslint-config-prettier: 8.5.0_eslint@8.14.0
|
||||
eslint-plugin-import: 2.26.0_eslint@8.14.0
|
||||
eslint-plugin-prettier: 4.0.0_74ebb802163a9b4fa8f89d76ed02f62a
|
||||
eslint-plugin-prettier: 4.0.0_740be41c8168d0cc214a306089357ad0
|
||||
eslint-plugin-react: 7.29.4_eslint@8.14.0
|
||||
eslint-plugin-react-hooks: 4.5.0_eslint@8.14.0
|
||||
eslint-plugin-simple-import-sort: 7.0.0_eslint@8.14.0
|
||||
|
@ -284,6 +286,7 @@ importers:
|
|||
'@types/cron': ^2.0.0
|
||||
'@types/express': ^4.17.13
|
||||
'@types/jest': 27.0.2
|
||||
'@types/lodash': ^4.14.182
|
||||
'@types/node': ^16.0.0
|
||||
'@types/supertest': ^2.0.11
|
||||
'@typescript-eslint/eslint-plugin': ^5.21.0
|
||||
|
@ -382,6 +385,7 @@ importers:
|
|||
'@types/cron': 2.0.0
|
||||
'@types/express': 4.17.13
|
||||
'@types/jest': 27.0.2
|
||||
'@types/lodash': 4.14.182
|
||||
'@types/node': 16.11.21
|
||||
'@types/supertest': 2.0.11
|
||||
'@typescript-eslint/eslint-plugin': 5.21.0_19515efd875c7ffcd67055d8be736b9f
|
||||
|
@ -3216,6 +3220,10 @@ packages:
|
|||
'@types/node': 16.11.21
|
||||
dev: false
|
||||
|
||||
/@types/lodash/4.14.182:
|
||||
resolution: {integrity: sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==}
|
||||
dev: true
|
||||
|
||||
/@types/lowlight/0.0.3:
|
||||
resolution: {integrity: sha512-R83q/yPX2nIlo9D3WtSjyUDd57t8s+GVLaL8YIv3k7zMMWpYpOXqjJgrWp80qXUJB/a1t76nTyBpxrv0JNYaEg==}
|
||||
dev: false
|
||||
|
@ -4182,6 +4190,11 @@ packages:
|
|||
resolution: {integrity: sha1-wE3+i5JtbsrKGBPWn/F5t8ICXYY=}
|
||||
dev: false
|
||||
|
||||
/big-integer/1.6.51:
|
||||
resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==}
|
||||
engines: {node: '>=0.6'}
|
||||
dev: false
|
||||
|
||||
/big.js/5.2.2:
|
||||
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
|
||||
dev: false
|
||||
|
@ -4236,6 +4249,19 @@ packages:
|
|||
dependencies:
|
||||
fill-range: 7.0.1
|
||||
|
||||
/broadcast-channel/3.7.0:
|
||||
resolution: {integrity: sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.16.7
|
||||
detect-node: 2.1.0
|
||||
js-sha3: 0.8.0
|
||||
microseconds: 0.2.0
|
||||
nano-time: 1.0.0
|
||||
oblivious-set: 1.0.0
|
||||
rimraf: 3.0.2
|
||||
unload: 2.2.0
|
||||
dev: false
|
||||
|
||||
/browser-process-hrtime/1.0.0:
|
||||
resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==}
|
||||
dev: true
|
||||
|
@ -5058,6 +5084,10 @@ packages:
|
|||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/detect-node/2.1.0:
|
||||
resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==}
|
||||
dev: false
|
||||
|
||||
/dezalgo/1.0.3:
|
||||
resolution: {integrity: sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=}
|
||||
dependencies:
|
||||
|
@ -5415,22 +5445,6 @@ packages:
|
|||
prettier-linter-helpers: 1.0.0
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-prettier/4.0.0_74ebb802163a9b4fa8f89d76ed02f62a:
|
||||
resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
peerDependencies:
|
||||
eslint: '>=7.28.0'
|
||||
eslint-config-prettier: '*'
|
||||
prettier: '>=2.0.0'
|
||||
peerDependenciesMeta:
|
||||
eslint-config-prettier:
|
||||
optional: true
|
||||
dependencies:
|
||||
eslint: 8.14.0
|
||||
eslint-config-prettier: 8.5.0_eslint@8.14.0
|
||||
prettier-linter-helpers: 1.0.0
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-react-hooks/4.5.0_eslint@8.14.0:
|
||||
resolution: {integrity: sha512-8k1gRt7D7h03kd+SAAlzXkQwWK22BnK6GKZG+FJA6BAGy22CFvl8kCIXKpVux0cCxMWDQUPqSok0LKaZ0aOcCw==}
|
||||
engines: {node: '>=10'}
|
||||
|
@ -7294,6 +7308,10 @@ packages:
|
|||
resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==}
|
||||
dev: false
|
||||
|
||||
/js-sha3/0.8.0:
|
||||
resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==}
|
||||
dev: false
|
||||
|
||||
/js-tokens/4.0.0:
|
||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||
|
||||
|
@ -7846,6 +7864,13 @@ packages:
|
|||
uc.micro: 1.0.6
|
||||
dev: false
|
||||
|
||||
/match-sorter/6.3.1:
|
||||
resolution: {integrity: sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.16.7
|
||||
remove-accents: 0.4.2
|
||||
dev: false
|
||||
|
||||
/mathml-tag-names/2.1.3:
|
||||
resolution: {integrity: sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==}
|
||||
dev: true
|
||||
|
@ -7918,6 +7943,10 @@ packages:
|
|||
braces: 3.0.2
|
||||
picomatch: 2.3.1
|
||||
|
||||
/microseconds/0.2.0:
|
||||
resolution: {integrity: sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==}
|
||||
dev: false
|
||||
|
||||
/mime-db/1.51.0:
|
||||
resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
@ -8066,6 +8095,12 @@ packages:
|
|||
lru-cache: 4.1.5
|
||||
dev: false
|
||||
|
||||
/nano-time/1.0.0:
|
||||
resolution: {integrity: sha1-sFVPaa2J4i0JB/ehKwmTpdlhN+8=}
|
||||
dependencies:
|
||||
big-integer: 1.6.51
|
||||
dev: false
|
||||
|
||||
/nanoid/3.2.0:
|
||||
resolution: {integrity: sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
|
@ -8311,6 +8346,10 @@ packages:
|
|||
es-abstract: 1.19.1
|
||||
dev: true
|
||||
|
||||
/oblivious-set/1.0.0:
|
||||
resolution: {integrity: sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw==}
|
||||
dev: false
|
||||
|
||||
/on-exit-leak-free/0.2.0:
|
||||
resolution: {integrity: sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==}
|
||||
dev: false
|
||||
|
@ -9173,6 +9212,25 @@ packages:
|
|||
- worker-loader
|
||||
dev: false
|
||||
|
||||
/react-query/3.39.0_react-dom@17.0.2+react@17.0.2:
|
||||
resolution: {integrity: sha512-Od0IkSuS79WJOhzWBx/ys0x13+7wFqgnn64vBqqAAnZ9whocVhl/y1padD5uuZ6EIkXbFbInax0qvY7zGM0thA==}
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
react-dom: '*'
|
||||
react-native: '*'
|
||||
peerDependenciesMeta:
|
||||
react-dom:
|
||||
optional: true
|
||||
react-native:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.16.7
|
||||
broadcast-channel: 3.7.0
|
||||
match-sorter: 6.3.1
|
||||
react: 17.0.2
|
||||
react-dom: 17.0.2_react@17.0.2
|
||||
dev: false
|
||||
|
||||
/react-resizable/1.11.1_react-dom@17.0.2+react@17.0.2:
|
||||
resolution: {integrity: sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q==}
|
||||
peerDependencies:
|
||||
|
@ -9392,6 +9450,10 @@ packages:
|
|||
jsesc: 0.5.0
|
||||
dev: false
|
||||
|
||||
/remove-accents/0.4.2:
|
||||
resolution: {integrity: sha1-CkPTqq4egNuRngeuJUsoXZ4ce7U=}
|
||||
dev: false
|
||||
|
||||
/require-directory/2.1.1:
|
||||
resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
@ -10928,6 +10990,13 @@ packages:
|
|||
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
|
||||
/unload/2.2.0:
|
||||
resolution: {integrity: sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.16.7
|
||||
detect-node: 2.1.0
|
||||
dev: false
|
||||
|
||||
/unpipe/1.0.0:
|
||||
resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
|
Loading…
Reference in New Issue