chore: ssr 阶段1

This commit is contained in:
fantasticit 2022-05-23 16:20:56 +08:00
parent 55f227fae0
commit b3c7a375ce
56 changed files with 930 additions and 267 deletions

View File

@ -86,6 +86,7 @@
"react-helmet": "^6.1.0", "react-helmet": "^6.1.0",
"react-lazy-load-image-component": "^1.5.4", "react-lazy-load-image-component": "^1.5.4",
"react-pdf": "^5.7.2", "react-pdf": "^5.7.2",
"react-query": "^3.39.0",
"react-split-pane": "^0.1.92", "react-split-pane": "^0.1.92",
"scroll-into-view-if-needed": "^2.2.29", "scroll-into-view-if-needed": "^2.2.29",
"swr": "^1.2.0", "swr": "^1.2.0",

View File

@ -8,7 +8,7 @@ type RenderProps = React.ReactNode | (() => React.ReactNode);
interface IProps { interface IProps {
loading: boolean; loading: boolean;
error: Error | null; error: Error | null | unknown;
empty?: boolean; empty?: boolean;
loadingContent?: RenderProps; loadingContent?: RenderProps;
errorContent?: RenderProps; errorContent?: RenderProps;

View File

@ -1,6 +1,6 @@
import { IconStar } from '@douyinfe/semi-icons'; import { IconStar } from '@douyinfe/semi-icons';
import { Button, Tooltip } from '@douyinfe/semi-ui'; import { Button, Tooltip } from '@douyinfe/semi-ui';
import { useDocumentStar } from 'data/document'; import { useDocumentCollectToggle } from 'data/refactor/collector';
import React from 'react'; import React from 'react';
interface IProps { interface IProps {
@ -9,7 +9,7 @@ interface IProps {
} }
export const DocumentStar: React.FC<IProps> = ({ documentId, render }) => { export const DocumentStar: React.FC<IProps> = ({ documentId, render }) => {
const { data, toggleStar } = useDocumentStar(documentId); const { data, toggle: toggleStar } = useDocumentCollectToggle(documentId);
const text = data ? '取消收藏' : '收藏文档'; const text = data ? '取消收藏' : '收藏文档';
return ( return (

View File

@ -250,5 +250,6 @@ const MessageBox = () => {
export const Message = () => { export const Message = () => {
const { loading, error } = useUser(); const { loading, error } = useUser();
return <DataRender loading={loading} error={error} normalContent={() => <MessageBox />} />; return null;
// return <DataRender loading={loading} error={error} normalContent={() => <MessageBox />} />;
}; };

View File

@ -1,5 +1,5 @@
import { IconArticle, IconChevronLeft } from '@douyinfe/semi-icons'; import { IconChevronLeft } from '@douyinfe/semi-icons';
import { Button, Nav, Popconfirm, Popover, Space, Switch, Tooltip, Typography } from '@douyinfe/semi-ui'; import { Button, Nav, Popconfirm, Space, Switch, Tooltip, Typography } from '@douyinfe/semi-ui';
import { ILoginUser, ITemplate } from '@think/domains'; import { ILoginUser, ITemplate } from '@think/domains';
import cls from 'classnames'; import cls from 'classnames';
import { DocumentStyle } from 'components/document/style'; import { DocumentStyle } from 'components/document/style';

View File

@ -1,12 +1,12 @@
import { IconArticle, IconChevronLeft } from '@douyinfe/semi-icons'; import { IconChevronLeft } from '@douyinfe/semi-icons';
import { Button, Nav, Popconfirm, Popover, Space, Spin, Switch, Tooltip, Typography } from '@douyinfe/semi-ui'; import { Button, Nav, Popconfirm, Space, Spin, Switch, Tooltip, Typography } from '@douyinfe/semi-ui';
import cls from 'classnames'; import cls from 'classnames';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { DocumentStyle } from 'components/document/style'; import { DocumentStyle } from 'components/document/style';
import { Seo } from 'components/seo'; import { Seo } from 'components/seo';
import { Theme } from 'components/theme'; import { Theme } from 'components/theme';
import { User } from 'components/user'; import { User } from 'components/user';
import { useTemplate } from 'data/template'; import { useTemplate } from 'data/refactor/template';
import { useUser } from 'data/user'; import { useUser } from 'data/user';
import { useDocumentStyle } from 'hooks/use-document-style'; import { useDocumentStyle } from 'hooks/use-document-style';
import { useWindowSize } from 'hooks/use-window-size'; import { useWindowSize } from 'hooks/use-window-size';
@ -25,9 +25,8 @@ const { Text } = Typography;
export const TemplateEditor: React.FC<IProps> = ({ templateId }) => { export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
const { user } = useUser(); const { user } = useUser();
const { data, loading, error, updateTemplate, deleteTemplate } = useTemplate(templateId); const { data, loading, error, updateTemplate, deleteTemplate } = useTemplate(templateId);
const { width: windowWidth } = useWindowSize(); const { width: windowWidth } = useWindowSize();
const [title, setTitle] = useState(data.title); const [title, setTitle] = useState(data && data.title);
const [isPublic, setPublic] = useState(false); const [isPublic, setPublic] = useState(false);
const { width, fontSize } = useDocumentStyle(); const { width, fontSize } = useDocumentStyle();
const editorWrapClassNames = useMemo(() => { const editorWrapClassNames = useMemo(() => {
@ -47,6 +46,7 @@ export const TemplateEditor: React.FC<IProps> = ({ templateId }) => {
useEffect(() => { useEffect(() => {
if (!data) return; if (!data) return;
setPublic(data.isPublic); setPublic(data.isPublic);
setTitle(data.title);
}, [data]); }, [data]);
return ( return (

View File

@ -45,7 +45,7 @@ export const User: React.FC = () => {
<Avatar size="extra-extra-small" src={user.avatar}></Avatar> <Avatar size="extra-extra-small" src={user.avatar}></Avatar>
) : ( ) : (
<Avatar size="extra-extra-small" color="orange"> <Avatar size="extra-extra-small" color="orange">
{user && user.name[0]} {user && user.name && user.name[0]}
</Avatar> </Avatar>
) )
} }

View File

@ -3,7 +3,7 @@ import { Avatar, Skeleton, Space, Typography } from '@douyinfe/semi-ui';
import { IconDocument } from 'components/icons/IconDocument'; import { IconDocument } from 'components/icons/IconDocument';
import { LocaleTime } from 'components/locale-time'; import { LocaleTime } from 'components/locale-time';
import { WikiStar } from 'components/wiki/star'; import { WikiStar } from 'components/wiki/star';
import { IWikiWithIsMember } from 'data/wiki'; import { IWikiWithIsMember } from 'data/refactor/collector';
import Link from 'next/link'; import Link from 'next/link';
import styles from './index.module.scss'; import styles from './index.module.scss';

View File

@ -1,7 +1,7 @@
import { Form, Modal } from '@douyinfe/semi-ui'; import { Form, Modal } from '@douyinfe/semi-ui';
import { FormApi } from '@douyinfe/semi-ui/lib/es/form'; import { FormApi } from '@douyinfe/semi-ui/lib/es/form';
import type { IWiki } from '@think/domains'; 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 Router from 'next/router';
import { Dispatch, SetStateAction, useRef } from 'react'; import { Dispatch, SetStateAction, useRef } from 'react';

View File

@ -1,6 +1,6 @@
import { IconStar } from '@douyinfe/semi-icons'; import { IconStar } from '@douyinfe/semi-icons';
import { Button, Tooltip } from '@douyinfe/semi-ui'; import { Button, Tooltip } from '@douyinfe/semi-ui';
import { useWikiStar } from 'data/wiki'; import { useWikiCollectToggle } from 'data/refactor/collector';
import React from 'react'; import React from 'react';
interface IProps { interface IProps {
@ -10,13 +10,13 @@ interface IProps {
} }
export const WikiStar: React.FC<IProps> = ({ wikiId, render, onChange }) => { export const WikiStar: React.FC<IProps> = ({ wikiId, render, onChange }) => {
const { data, toggleStar } = useWikiStar(wikiId); const { data, toggle } = useWikiCollectToggle(wikiId);
const text = data ? '取消收藏' : '收藏知识库'; const text = data ? '取消收藏' : '收藏知识库';
return ( return (
<> <>
{render ? ( {render ? (
render({ star: data, toggleStar, text }) render({ star: data, toggleStar: toggle, text })
) : ( ) : (
<Tooltip content={text} position="bottom"> <Tooltip content={text} position="bottom">
<Button <Button
@ -28,7 +28,7 @@ export const WikiStar: React.FC<IProps> = ({ wikiId, render, onChange }) => {
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
toggleStar().then(onChange); toggle().then(onChange);
}} }}
/> />
</Tooltip> </Tooltip>

View File

@ -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 };
};

View File

@ -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 };
};

View File

@ -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,
};
};

View File

@ -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,
};
};

View File

@ -117,7 +117,7 @@ export const RouterHeader: React.FC = () => {
<Space> <Space>
<WikiOrDocumentCreator /> <WikiOrDocumentCreator />
<Search /> <Search />
<Message /> {/* <Message /> */}
<Theme /> <Theme />
<User /> <User />
</Space> </Space>

View File

@ -6,7 +6,6 @@ import { Empty } from 'components/empty';
import { IconDocumentFill } from 'components/icons/IconDocumentFill'; import { IconDocumentFill } from 'components/icons/IconDocumentFill';
import { LocaleTime } from 'components/locale-time'; import { LocaleTime } from 'components/locale-time';
import { useRecentDocuments } from 'data/document'; import { useRecentDocuments } from 'data/document';
import { useToggle } from 'hooks/use-toggle';
import Link from 'next/link'; import Link from 'next/link';
import React from 'react'; import React from 'react';

View File

@ -3,7 +3,8 @@ import { Avatar, Dropdown, Modal, Space, Typography } from '@douyinfe/semi-ui';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { Empty } from 'components/empty'; import { Empty } from 'components/empty';
import { WikiStar } from 'components/wiki/star'; 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 Link from 'next/link';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
@ -15,7 +16,7 @@ const { Text } = Typography;
const WikiContent = () => { const WikiContent = () => {
const { query } = useRouter(); 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); const { data: currentWiki } = useWikiDetail(query.wikiId);
return ( return (

View File

@ -9,9 +9,12 @@ import { Theme } from 'hooks/use-theme';
import App from 'next/app'; import App from 'next/app';
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import { Hydrate, QueryClient, QueryClientProvider } from 'react-query';
class MyApp extends App<{ isMobile: boolean }> { class MyApp extends App<{ isMobile: boolean }> {
state = {}; state = {
queryClient: new QueryClient(),
};
static getInitialProps = async ({ Component, ctx }) => { static getInitialProps = async ({ Component, ctx }) => {
const request = ctx?.req; const request = ctx?.req;
@ -26,6 +29,7 @@ class MyApp extends App<{ isMobile: boolean }> {
render() { render() {
const { Component, pageProps, isMobile } = this.props; const { Component, pageProps, isMobile } = this.props;
const { queryClient } = this.state;
return ( return (
<> <>
@ -57,11 +61,15 @@ class MyApp extends App<{ isMobile: boolean }> {
<link key={url} rel="dns-prefetch" href={url} /> <link key={url} rel="dns-prefetch" href={url} />
))} ))}
</Head> </Head>
<Theme.Provider> <QueryClientProvider client={queryClient}>
<IsOnMobile.Provider initialState={isMobile}> <Hydrate state={pageProps.dehydratedState}>
<Component {...pageProps} /> <Theme.Provider>
</IsOnMobile.Provider> <IsOnMobile.Provider initialState={isMobile}>
</Theme.Provider> <Component {...pageProps} />
</IsOnMobile.Provider>
</Theme.Provider>
</Hydrate>
</QueryClientProvider>
</> </>
); );
} }

View File

@ -1,12 +1,14 @@
import { List, Pagination, Typography } from '@douyinfe/semi-ui'; import { List, Pagination, Typography } from '@douyinfe/semi-ui';
import { WikiApiDefinition } from '@think/domains';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { Empty } from 'components/empty'; import { Empty } from 'components/empty';
import { Seo } from 'components/seo'; import { Seo } from 'components/seo';
import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card'; 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 { SingleColumnLayout } from 'layouts/single-column';
import type { NextPage } from 'next'; import type { NextPage } from 'next';
import React from 'react'; import React from 'react';
import { serverPrefetcher } from 'services/server-prefetcher';
const grid = { const grid = {
gutter: 16, 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; export default Page;

View File

@ -1,5 +1,5 @@
import { Avatar, Button, List, Table, Typography } from '@douyinfe/semi-ui'; 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 { DataRender } from 'components/data-render';
import { DocumentActions } from 'components/document/actions'; import { DocumentActions } from 'components/document/actions';
import { Empty } from 'components/empty'; import { Empty } from 'components/empty';
@ -7,13 +7,14 @@ import { LocaleTime } from 'components/locale-time';
import { Seo } from 'components/seo'; import { Seo } from 'components/seo';
import { WikiCreator } from 'components/wiki/create'; import { WikiCreator } from 'components/wiki/create';
import { WikiPinCard, WikiPinCardPlaceholder } from 'components/wiki/pin-card'; import { WikiPinCard, WikiPinCardPlaceholder } from 'components/wiki/pin-card';
import { useRecentDocuments } from 'data/document'; import { getCollectedWikis, useCollectedWikis } from 'data/refactor/collector';
import { useStaredWikis } from 'data/wiki'; import { getRecentVisitedDocuments, useRecentDocuments } from 'data/refactor/document';
import { useToggle } from 'hooks/use-toggle'; import { useToggle } from 'hooks/use-toggle';
import { SingleColumnLayout } from 'layouts/single-column'; import { SingleColumnLayout } from 'layouts/single-column';
import type { NextPage } from 'next'; import type { NextPage } from 'next';
import Link from 'next/link'; import Link from 'next/link';
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { serverPrefetcher } from 'services/server-prefetcher';
import styles from './index.module.scss'; import styles from './index.module.scss';
@ -112,7 +113,7 @@ const RecentDocs = () => {
const Page: NextPage = () => { const Page: NextPage = () => {
const [visible, toggleVisible] = useToggle(false); const [visible, toggleVisible] = useToggle(false);
const { data: staredWikis, loading, error } = useStaredWikis(); const { data: staredWikis, loading, error } = useCollectedWikis();
return ( return (
<SingleColumnLayout> <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; export default Page;

View File

@ -1,14 +1,20 @@
import { List, Typography } from '@douyinfe/semi-ui'; import { List, Typography } from '@douyinfe/semi-ui';
import { CollectorApiDefinition } from '@think/domains';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { DocumentCard, DocumentCardPlaceholder } from 'components/document/card'; import { DocumentCard, DocumentCardPlaceholder } from 'components/document/card';
import { Empty } from 'components/empty'; import { Empty } from 'components/empty';
import { Seo } from 'components/seo'; import { Seo } from 'components/seo';
import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card'; import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card';
import { useStaredDocuments } from 'data/document'; import {
import { useStaredWikis } from 'data/wiki'; getCollectedDocuments,
getCollectedWikis,
useCollectedDocuments,
useCollectedWikis,
} from 'data/refactor/collector';
import { SingleColumnLayout } from 'layouts/single-column'; import { SingleColumnLayout } from 'layouts/single-column';
import type { NextPage } from 'next'; import type { NextPage } from 'next';
import React from 'react'; import React from 'react';
import { serverPrefetcher } from 'services/server-prefetcher';
import styles from './index.module.scss'; import styles from './index.module.scss';
@ -24,7 +30,7 @@ const grid = {
}; };
const StarDocs = () => { const StarDocs = () => {
const { data: docs, loading, error } = useStaredDocuments(); const { data: docs, loading, error } = useCollectedDocuments();
return ( return (
<DataRender <DataRender
@ -58,7 +64,7 @@ const StarDocs = () => {
}; };
const StarWikis = () => { const StarWikis = () => {
const { data, loading, error } = useStaredWikis(); const { data, loading, error } = useCollectedWikis();
return ( return (
<DataRender <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; export default Page;

View File

@ -1,7 +1,7 @@
import { Button, TabPane, Tabs, Typography } from '@douyinfe/semi-ui'; import { Button, TabPane, Tabs, Typography } from '@douyinfe/semi-ui';
import { Seo } from 'components/seo'; import { Seo } from 'components/seo';
import { TemplateList } from 'components/template/list'; 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 { SingleColumnLayout } from 'layouts/single-column';
import type { NextPage } from 'next'; import type { NextPage } from 'next';
import Router, { useRouter } from 'next/router'; import Router, { useRouter } from 'next/router';

View File

@ -1,14 +1,16 @@
import { List, TabPane, Tabs, Typography } from '@douyinfe/semi-ui'; import { List, TabPane, Tabs, Typography } from '@douyinfe/semi-ui';
import { WikiApiDefinition } from '@think/domains';
import { DataRender } from 'components/data-render'; import { DataRender } from 'components/data-render';
import { Empty } from 'components/empty'; import { Empty } from 'components/empty';
import { Seo } from 'components/seo'; import { Seo } from 'components/seo';
import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card'; import { WikiCard, WikiCardPlaceholder } from 'components/wiki/card';
import { WikiCreator } from 'components/wiki-creator'; 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 { CreateWikiIllustration } from 'illustrations/create-wiki';
import { SingleColumnLayout } from 'layouts/single-column'; import { SingleColumnLayout } from 'layouts/single-column';
import type { NextPage } from 'next'; import type { NextPage } from 'next';
import React from 'react'; import React from 'react';
import { serverPrefetcher } from 'services/server-prefetcher';
const grid = { const grid = {
gutter: 16, 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; export default Page;

View File

@ -1,22 +1,21 @@
import { Toast } from '@douyinfe/semi-ui'; import { Toast } from '@douyinfe/semi-ui';
import axios from 'axios'; import axios, { Axios, AxiosRequestConfig, AxiosResponse } from 'axios';
import Router from 'next/router'; import Router from 'next/router';
interface AxiosInstance extends Axios {
request<T = any, R = AxiosResponse<T>>(config: AxiosRequestConfig): Promise<R>;
}
export const HttpClient = axios.create({ export const HttpClient = axios.create({
baseURL: process.env.SERVER_API_URL, baseURL: process.env.SERVER_API_URL,
timeout: 60000, timeout: 60000,
}); withCredentials: true,
}) as AxiosInstance;
const isBrowser = typeof window !== 'undefined'; const isBrowser = typeof window !== 'undefined';
HttpClient.interceptors.request.use( HttpClient.interceptors.request.use(
(config) => { (config) => {
if (isBrowser) {
const token = window.localStorage.getItem('token');
if (config && config.headers && token) {
config.headers.Authorization = `Bearer ${token}`;
}
}
return config; return config;
}, },
() => { () => {

View File

@ -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),
};
}

View File

@ -18,7 +18,7 @@ export declare const CollectorApiDefinition: {
* *
*/ */
toggle: { toggle: {
method: "Post"; method: "post";
server: "toggle"; server: "toggle";
client: () => string; client: () => string;
}; };
@ -26,7 +26,7 @@ export declare const CollectorApiDefinition: {
* *
*/ */
check: { check: {
method: "Post"; method: "post";
server: "check"; server: "check";
client: () => string; client: () => string;
}; };
@ -34,7 +34,7 @@ export declare const CollectorApiDefinition: {
* *
*/ */
wikis: { wikis: {
method: "Post"; method: "get";
server: "wikis"; server: "wikis";
client: () => string; client: () => string;
}; };
@ -42,7 +42,7 @@ export declare const CollectorApiDefinition: {
* *
*/ */
documents: { documents: {
method: "Post"; method: "get";
server: "documents"; server: "documents";
client: () => string; client: () => string;
}; };

View File

@ -6,7 +6,7 @@ exports.CollectorApiDefinition = {
* 收藏或取消收藏 * 收藏或取消收藏
*/ */
toggle: { toggle: {
method: 'Post', method: 'post',
server: 'toggle', server: 'toggle',
client: function () { return '/collector/toggle'; } client: function () { return '/collector/toggle'; }
}, },
@ -14,7 +14,7 @@ exports.CollectorApiDefinition = {
* 检测是否收藏 * 检测是否收藏
*/ */
check: { check: {
method: 'Post', method: 'post',
server: 'check', server: 'check',
client: function () { return '/collector/check'; } client: function () { return '/collector/check'; }
}, },
@ -22,7 +22,7 @@ exports.CollectorApiDefinition = {
* 获取收藏的知识库 * 获取收藏的知识库
*/ */
wikis: { wikis: {
method: 'Post', method: 'get',
server: 'wikis', server: 'wikis',
client: function () { return '/collector/wikis'; } client: function () { return '/collector/wikis'; }
}, },
@ -30,7 +30,7 @@ exports.CollectorApiDefinition = {
* 获取收藏的文档 * 获取收藏的文档
*/ */
documents: { documents: {
method: 'Post', method: 'get',
server: 'documents', server: 'documents',
client: function () { return '/collector/documents'; } client: function () { return '/collector/documents'; }
} }

View File

@ -4,7 +4,7 @@ export declare const CommentApiDefinition: {
* *
*/ */
add: { add: {
method: "Post"; method: "post";
server: "add"; server: "add";
client: () => string; client: () => string;
}; };
@ -12,7 +12,7 @@ export declare const CommentApiDefinition: {
* *
*/ */
update: { update: {
method: "Patch"; method: "patch";
server: "update"; server: "update";
client: () => string; client: () => string;
}; };
@ -20,7 +20,7 @@ export declare const CommentApiDefinition: {
* *
*/ */
delete: { delete: {
method: "Delete"; method: "delete";
server: "delete/:id"; server: "delete/:id";
client: (id: IComment['id']) => string; client: (id: IComment['id']) => string;
}; };
@ -28,7 +28,7 @@ export declare const CommentApiDefinition: {
* *
*/ */
documents: { documents: {
method: "Get"; method: "get";
server: "document/:documentId"; server: "document/:documentId";
client: (documentId: IDocument['id']) => string; client: (documentId: IDocument['id']) => string;
}; };

View File

@ -6,7 +6,7 @@ exports.CommentApiDefinition = {
* 新建评论 * 新建评论
*/ */
add: { add: {
method: 'Post', method: 'post',
server: 'add', server: 'add',
client: function () { return '/comment/add'; } client: function () { return '/comment/add'; }
}, },
@ -14,7 +14,7 @@ exports.CommentApiDefinition = {
* 更新评论 * 更新评论
*/ */
update: { update: {
method: 'Patch', method: 'patch',
server: 'update', server: 'update',
client: function () { return '/comment/update'; } client: function () { return '/comment/update'; }
}, },
@ -22,7 +22,7 @@ exports.CommentApiDefinition = {
* 删除评论 * 删除评论
*/ */
"delete": { "delete": {
method: 'Delete', method: 'delete',
server: 'delete/:id', server: 'delete/:id',
client: function (id) { return "/comment/delete/".concat(id); } client: function (id) { return "/comment/delete/".concat(id); }
}, },
@ -30,7 +30,7 @@ exports.CommentApiDefinition = {
* 获取指定文档评论 * 获取指定文档评论
*/ */
documents: { documents: {
method: 'Get', method: 'get',
server: 'document/:documentId', server: 'document/:documentId',
client: function (documentId) { return "/comment/document/".concat(documentId); } client: function (documentId) { return "/comment/document/".concat(documentId); }
} }

View File

@ -4,7 +4,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
search: { search: {
method: "Get"; method: "get";
server: "search"; server: "search";
client: () => string; client: () => string;
}; };
@ -12,7 +12,7 @@ export declare const DocumentApiDefinition: {
* 访 * 访
*/ */
recent: { recent: {
method: "Get"; method: "get";
server: "recent"; server: "recent";
client: () => string; client: () => string;
}; };
@ -20,7 +20,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
create: { create: {
method: "Post"; method: "post";
server: "create"; server: "create";
client: () => string; client: () => string;
}; };
@ -28,7 +28,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
getDetailById: { getDetailById: {
method: "Get"; method: "get";
server: "detail/:id"; server: "detail/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -36,7 +36,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
updateById: { updateById: {
method: "Patch"; method: "patch";
server: "update/:id"; server: "update/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -44,7 +44,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
getVersionById: { getVersionById: {
method: "Get"; method: "get";
server: "version/:id"; server: "version/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -52,7 +52,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
getMemberById: { getMemberById: {
method: "Get"; method: "get";
server: "member/:id"; server: "member/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -60,7 +60,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
addMemberById: { addMemberById: {
method: "Post"; method: "post";
server: "member/:id/add"; server: "member/:id/add";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -68,7 +68,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
updateMemberById: { updateMemberById: {
method: "Patch"; method: "patch";
server: "member/:id/update"; server: "member/:id/update";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -76,7 +76,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
deleteMemberById: { deleteMemberById: {
method: "Post"; method: "post";
server: "member/:id/delete"; server: "member/:id/delete";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -84,7 +84,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
getChildren: { getChildren: {
method: "Get"; method: "get";
server: "children"; server: "children";
client: () => string; client: () => string;
}; };
@ -92,7 +92,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
deleteById: { deleteById: {
method: "Delete"; method: "delete";
server: "delete/:id"; server: "delete/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -100,7 +100,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
shareById: { shareById: {
method: "Post"; method: "post";
server: "share/:id"; server: "share/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -108,7 +108,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
getPublicDetailById: { getPublicDetailById: {
method: "Get"; method: "get";
server: "public/detail/:id"; server: "public/detail/:id";
client: (id: IDocument['id']) => string; client: (id: IDocument['id']) => string;
}; };
@ -116,7 +116,7 @@ export declare const DocumentApiDefinition: {
* *
*/ */
getPublicChildren: { getPublicChildren: {
method: "Get"; method: "get";
server: "public/children"; server: "public/children";
client: () => string; client: () => string;
}; };

View File

@ -6,7 +6,7 @@ exports.DocumentApiDefinition = {
* 搜索文档 * 搜索文档
*/ */
search: { search: {
method: 'Get', method: 'get',
server: 'search', server: 'search',
client: function () { return '/document/search'; } client: function () { return '/document/search'; }
}, },
@ -14,7 +14,7 @@ exports.DocumentApiDefinition = {
* 获取用户最近访问的文档 * 获取用户最近访问的文档
*/ */
recent: { recent: {
method: 'Get', method: 'get',
server: 'recent', server: 'recent',
client: function () { return '/document/recent'; } client: function () { return '/document/recent'; }
}, },
@ -22,7 +22,7 @@ exports.DocumentApiDefinition = {
* 新建文档 * 新建文档
*/ */
create: { create: {
method: 'Post', method: 'post',
server: 'create', server: 'create',
client: function () { return '/document/create'; } client: function () { return '/document/create'; }
}, },
@ -30,7 +30,7 @@ exports.DocumentApiDefinition = {
* 获取文档详情 * 获取文档详情
*/ */
getDetailById: { getDetailById: {
method: 'Get', method: 'get',
server: 'detail/:id', server: 'detail/:id',
client: function (id) { return "/document/detail/".concat(id); } client: function (id) { return "/document/detail/".concat(id); }
}, },
@ -38,7 +38,7 @@ exports.DocumentApiDefinition = {
* 更新文档 * 更新文档
*/ */
updateById: { updateById: {
method: 'Patch', method: 'patch',
server: 'update/:id', server: 'update/:id',
client: function (id) { return "/document/update/".concat(id); } client: function (id) { return "/document/update/".concat(id); }
}, },
@ -46,7 +46,7 @@ exports.DocumentApiDefinition = {
* 获取文档版本记录 * 获取文档版本记录
*/ */
getVersionById: { getVersionById: {
method: 'Get', method: 'get',
server: 'version/:id', server: 'version/:id',
client: function (id) { return "/document/version/".concat(id); } client: function (id) { return "/document/version/".concat(id); }
}, },
@ -54,7 +54,7 @@ exports.DocumentApiDefinition = {
* 获取文档成员 * 获取文档成员
*/ */
getMemberById: { getMemberById: {
method: 'Get', method: 'get',
server: 'member/:id', server: 'member/:id',
client: function (id) { return "/document/member/".concat(id); } client: function (id) { return "/document/member/".concat(id); }
}, },
@ -62,7 +62,7 @@ exports.DocumentApiDefinition = {
* 添加文档成员 * 添加文档成员
*/ */
addMemberById: { addMemberById: {
method: 'Post', method: 'post',
server: 'member/:id/add', server: 'member/:id/add',
client: function (id) { return "/document/member/".concat(id, "/add"); } client: function (id) { return "/document/member/".concat(id, "/add"); }
}, },
@ -70,7 +70,7 @@ exports.DocumentApiDefinition = {
* 更新文档成员 * 更新文档成员
*/ */
updateMemberById: { updateMemberById: {
method: 'Patch', method: 'patch',
server: 'member/:id/update', server: 'member/:id/update',
client: function (id) { return "/document/member/".concat(id, "/update"); } client: function (id) { return "/document/member/".concat(id, "/update"); }
}, },
@ -78,7 +78,7 @@ exports.DocumentApiDefinition = {
* 删除文档成员 * 删除文档成员
*/ */
deleteMemberById: { deleteMemberById: {
method: 'Post', method: 'post',
server: 'member/:id/delete', server: 'member/:id/delete',
client: function (id) { return "/document/member/".concat(id, "/delete"); } client: function (id) { return "/document/member/".concat(id, "/delete"); }
}, },
@ -86,7 +86,7 @@ exports.DocumentApiDefinition = {
* 获取子文档 * 获取子文档
*/ */
getChildren: { getChildren: {
method: 'Get', method: 'get',
server: 'children', server: 'children',
client: function () { return "/document/children"; } client: function () { return "/document/children"; }
}, },
@ -94,7 +94,7 @@ exports.DocumentApiDefinition = {
* 删除文档 * 删除文档
*/ */
deleteById: { deleteById: {
method: 'Delete', method: 'delete',
server: 'delete/:id', server: 'delete/:id',
client: function (id) { return "/document/delete/".concat(id); } client: function (id) { return "/document/delete/".concat(id); }
}, },
@ -102,7 +102,7 @@ exports.DocumentApiDefinition = {
* 分享文档 * 分享文档
*/ */
shareById: { shareById: {
method: 'Post', method: 'post',
server: 'share/:id', server: 'share/:id',
client: function (id) { return "/document/share/".concat(id); } client: function (id) { return "/document/share/".concat(id); }
}, },
@ -110,7 +110,7 @@ exports.DocumentApiDefinition = {
* 获取公开文档详情 * 获取公开文档详情
*/ */
getPublicDetailById: { getPublicDetailById: {
method: 'Get', method: 'get',
server: 'public/detail/:id', server: 'public/detail/:id',
client: function (id) { return "/document/public/detail/".concat(id); } client: function (id) { return "/document/public/detail/".concat(id); }
}, },
@ -118,7 +118,7 @@ exports.DocumentApiDefinition = {
* 获取公开文档的子文档 * 获取公开文档的子文档
*/ */
getPublicChildren: { getPublicChildren: {
method: 'Get', method: 'get',
server: 'public/children', server: 'public/children',
client: function () { return "/document/public/children"; } client: function () { return "/document/public/children"; }
} }

View File

@ -3,7 +3,7 @@ export declare const FileApiDefinition: {
* *
*/ */
upload: { upload: {
method: "Post"; method: "post";
server: "upload"; server: "upload";
client: () => string; client: () => string;
}; };

View File

@ -6,7 +6,7 @@ exports.FileApiDefinition = {
* 上传文件 * 上传文件
*/ */
upload: { upload: {
method: 'Post', method: 'post',
server: 'upload', server: 'upload',
client: function () { return '/file/upload'; } client: function () { return '/file/upload'; }
} }

View File

@ -4,7 +4,7 @@ export declare const MessageApiDefinition: {
* *
*/ */
getUnread: { getUnread: {
method: "Get"; method: "get";
server: "unread"; server: "unread";
client: () => string; client: () => string;
}; };
@ -12,7 +12,7 @@ export declare const MessageApiDefinition: {
* *
*/ */
getRead: { getRead: {
method: "Get"; method: "get";
server: "read"; server: "read";
client: () => string; client: () => string;
}; };
@ -20,7 +20,7 @@ export declare const MessageApiDefinition: {
* *
*/ */
getAll: { getAll: {
method: "Get"; method: "get";
server: "all"; server: "all";
client: () => string; client: () => string;
}; };
@ -28,7 +28,7 @@ export declare const MessageApiDefinition: {
* *
*/ */
readMessage: { readMessage: {
method: "Post"; method: "post";
server: "read/:id"; server: "read/:id";
client: (id: IMessage['id']) => string; client: (id: IMessage['id']) => string;
}; };

View File

@ -6,7 +6,7 @@ exports.MessageApiDefinition = {
* 获取未读消息 * 获取未读消息
*/ */
getUnread: { getUnread: {
method: 'Get', method: 'get',
server: 'unread', server: 'unread',
client: function () { return '/message/unread'; } client: function () { return '/message/unread'; }
}, },
@ -14,7 +14,7 @@ exports.MessageApiDefinition = {
* 获取已读消息 * 获取已读消息
*/ */
getRead: { getRead: {
method: 'Get', method: 'get',
server: 'read', server: 'read',
client: function () { return '/message/read'; } client: function () { return '/message/read'; }
}, },
@ -22,7 +22,7 @@ exports.MessageApiDefinition = {
* 获取所有消息 * 获取所有消息
*/ */
getAll: { getAll: {
method: 'Get', method: 'get',
server: 'all', server: 'all',
client: function () { return '/message/all'; } client: function () { return '/message/all'; }
}, },
@ -30,7 +30,7 @@ exports.MessageApiDefinition = {
* 将消息标记为已读 * 将消息标记为已读
*/ */
readMessage: { readMessage: {
method: 'Post', method: 'post',
server: 'read/:id', server: 'read/:id',
client: function (id) { return "/message/read/".concat(id); } client: function (id) { return "/message/read/".concat(id); }
} }

View File

@ -4,7 +4,7 @@ export declare const TemplateApiDefinition: {
* *
*/ */
public: { public: {
method: "Get"; method: "get";
server: "public"; server: "public";
client: () => string; client: () => string;
}; };
@ -12,7 +12,7 @@ export declare const TemplateApiDefinition: {
* *
*/ */
own: { own: {
method: "Get"; method: "get";
server: "own"; server: "own";
client: () => string; client: () => string;
}; };
@ -20,7 +20,7 @@ export declare const TemplateApiDefinition: {
* *
*/ */
add: { add: {
method: "Post"; method: "post";
server: "add"; server: "add";
client: () => string; client: () => string;
}; };
@ -28,7 +28,7 @@ export declare const TemplateApiDefinition: {
* *
*/ */
updateById: { updateById: {
method: "Patch"; method: "patch";
server: "update/:id"; server: "update/:id";
client: (id: ITemplate['id']) => string; client: (id: ITemplate['id']) => string;
}; };
@ -36,7 +36,7 @@ export declare const TemplateApiDefinition: {
* *
*/ */
getDetailById: { getDetailById: {
method: "Get"; method: "get";
server: "detail/:id"; server: "detail/:id";
client: (id: ITemplate['id']) => string; client: (id: ITemplate['id']) => string;
}; };
@ -44,7 +44,7 @@ export declare const TemplateApiDefinition: {
* *
*/ */
deleteById: { deleteById: {
method: "Delete"; method: "delete";
server: "delete/:id"; server: "delete/:id";
client: (id: ITemplate['id']) => string; client: (id: ITemplate['id']) => string;
}; };

View File

@ -6,7 +6,7 @@ exports.TemplateApiDefinition = {
* 获取公开模板 * 获取公开模板
*/ */
public: { public: {
method: 'Get', method: 'get',
server: 'public', server: 'public',
client: function () { return '/template/public'; } client: function () { return '/template/public'; }
}, },
@ -14,7 +14,7 @@ exports.TemplateApiDefinition = {
* 获取个人创建模板 * 获取个人创建模板
*/ */
own: { own: {
method: 'Get', method: 'get',
server: 'own', server: 'own',
client: function () { return '/template/own'; } client: function () { return '/template/own'; }
}, },
@ -22,7 +22,7 @@ exports.TemplateApiDefinition = {
* 新建模板 * 新建模板
*/ */
add: { add: {
method: 'Post', method: 'post',
server: 'add', server: 'add',
client: function () { return '/template/add'; } client: function () { return '/template/add'; }
}, },
@ -30,7 +30,7 @@ exports.TemplateApiDefinition = {
* 更新模板 * 更新模板
*/ */
updateById: { updateById: {
method: 'Patch', method: 'patch',
server: 'update/:id', server: 'update/:id',
client: function (id) { return "/template/update/".concat(id); } client: function (id) { return "/template/update/".concat(id); }
}, },
@ -38,7 +38,7 @@ exports.TemplateApiDefinition = {
* 获取模板详情 * 获取模板详情
*/ */
getDetailById: { getDetailById: {
method: 'Get', method: 'get',
server: 'detail/:id', server: 'detail/:id',
client: function (id) { return "/template/detail/".concat(id); } client: function (id) { return "/template/detail/".concat(id); }
}, },
@ -46,7 +46,7 @@ exports.TemplateApiDefinition = {
* 删除模板 * 删除模板
*/ */
deleteById: { deleteById: {
method: 'Delete', method: 'delete',
server: 'delete/:id', server: 'delete/:id',
client: function (id) { return "/template/delete/".concat(id); } client: function (id) { return "/template/delete/".concat(id); }
} }

View File

@ -3,7 +3,7 @@ export declare const UserApiDefinition: {
* *
*/ */
getAllUsers: { getAllUsers: {
method: "Get"; method: "get";
server: "/"; server: "/";
client: () => string; client: () => string;
}; };
@ -11,7 +11,7 @@ export declare const UserApiDefinition: {
* *
*/ */
register: { register: {
method: "Post"; method: "post";
server: "register"; server: "register";
client: () => string; client: () => string;
}; };
@ -19,7 +19,7 @@ export declare const UserApiDefinition: {
* *
*/ */
login: { login: {
method: "Post"; method: "post";
server: "login"; server: "login";
client: () => string; client: () => string;
}; };
@ -27,7 +27,7 @@ export declare const UserApiDefinition: {
* *
*/ */
logout: { logout: {
method: "Post"; method: "post";
server: "logout"; server: "logout";
client: () => string; client: () => string;
}; };
@ -35,7 +35,7 @@ export declare const UserApiDefinition: {
* *
*/ */
update: { update: {
method: "Patch"; method: "patch";
server: "update"; server: "update";
client: () => string; client: () => string;
}; };

View File

@ -6,7 +6,7 @@ exports.UserApiDefinition = {
* 获取用户 * 获取用户
*/ */
getAllUsers: { getAllUsers: {
method: 'Get', method: 'get',
server: '/', server: '/',
client: function () { return '/user'; } client: function () { return '/user'; }
}, },
@ -14,7 +14,7 @@ exports.UserApiDefinition = {
* 注册 * 注册
*/ */
register: { register: {
method: 'Post', method: 'post',
server: 'register', server: 'register',
client: function () { return '/user/register'; } client: function () { return '/user/register'; }
}, },
@ -22,7 +22,7 @@ exports.UserApiDefinition = {
* 登录 * 登录
*/ */
login: { login: {
method: 'Post', method: 'post',
server: 'login', server: 'login',
client: function () { return '/user/login'; } client: function () { return '/user/login'; }
}, },
@ -30,7 +30,7 @@ exports.UserApiDefinition = {
* 登出 * 登出
*/ */
logout: { logout: {
method: 'Post', method: 'post',
server: 'logout', server: 'logout',
client: function () { return '/user/logout'; } client: function () { return '/user/logout'; }
}, },
@ -38,7 +38,7 @@ exports.UserApiDefinition = {
* 更新 * 更新
*/ */
update: { update: {
method: 'Patch', method: 'patch',
server: 'update', server: 'update',
client: function () { return "/user/update"; } client: function () { return "/user/update"; }
} }

View File

@ -4,7 +4,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getAllWikis: { getAllWikis: {
method: "Get"; method: "get";
server: "list/all"; server: "list/all";
client: () => string; client: () => string;
}; };
@ -12,7 +12,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getOwnWikis: { getOwnWikis: {
method: "Get"; method: "get";
server: "list/own"; server: "list/own";
client: () => string; client: () => string;
}; };
@ -20,7 +20,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getJoinWikis: { getJoinWikis: {
method: "Get"; method: "get";
server: "list/join"; server: "list/join";
client: () => string; client: () => string;
}; };
@ -28,7 +28,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
add: { add: {
method: "Post"; method: "post";
server: "add"; server: "add";
client: () => string; client: () => string;
}; };
@ -36,7 +36,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getHomeDocumentById: { getHomeDocumentById: {
method: "Get"; method: "get";
server: "homedoc/:id"; server: "homedoc/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -44,7 +44,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getTocsById: { getTocsById: {
method: "Get"; method: "get";
server: "tocs/:id"; server: "tocs/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -52,7 +52,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
updateTocsById: { updateTocsById: {
method: "Patch"; method: "patch";
server: "tocs/:id/update"; server: "tocs/:id/update";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -60,7 +60,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getDocumentsById: { getDocumentsById: {
method: "Get"; method: "get";
server: "documents/:id"; server: "documents/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -68,7 +68,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getDetailById: { getDetailById: {
method: "Get"; method: "get";
server: "detail/:id"; server: "detail/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -76,7 +76,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
updateById: { updateById: {
method: "Patch"; method: "patch";
server: "update/:id"; server: "update/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -84,7 +84,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
deleteById: { deleteById: {
method: "Delete"; method: "delete";
server: "delet/:id"; server: "delet/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -92,7 +92,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getMemberById: { getMemberById: {
method: "Get"; method: "get";
server: "member/:id"; server: "member/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -100,7 +100,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
addMemberById: { addMemberById: {
method: "Post"; method: "post";
server: "member/:id/add"; server: "member/:id/add";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -108,7 +108,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
updateMemberById: { updateMemberById: {
method: "Patch"; method: "patch";
server: "member/:id/update"; server: "member/:id/update";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -116,7 +116,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
deleteMemberById: { deleteMemberById: {
method: "Delete"; method: "delete";
server: "member/:id/delete"; server: "member/:id/delete";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -124,7 +124,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
shareById: { shareById: {
method: "Post"; method: "post";
server: "share/:id"; server: "share/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -132,7 +132,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getPublicHomeDocumentById: { getPublicHomeDocumentById: {
method: "Get"; method: "get";
server: "/public/homedoc/:id"; server: "/public/homedoc/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -140,7 +140,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getPublicTocsById: { getPublicTocsById: {
method: "Get"; method: "get";
server: "/public/tocs/:id"; server: "/public/tocs/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -148,7 +148,7 @@ export declare const WikiApiDefinition: {
* *
*/ */
getPublicDetailById: { getPublicDetailById: {
method: "Get"; method: "get";
server: "/public/detail/:id"; server: "/public/detail/:id";
client: (id: IWiki['id']) => string; client: (id: IWiki['id']) => string;
}; };
@ -156,8 +156,8 @@ export declare const WikiApiDefinition: {
* *
*/ */
getPublicWikis: { getPublicWikis: {
method: "Get"; method: "get";
server: "/public/wikis"; server: "/public/wikis";
client: (id: IWiki['id']) => string; client: () => string;
}; };
}; };

View File

@ -6,7 +6,7 @@ exports.WikiApiDefinition = {
* 获取用户所有知识库创建的参与的 * 获取用户所有知识库创建的参与的
*/ */
getAllWikis: { getAllWikis: {
method: 'Get', method: 'get',
server: 'list/all', server: 'list/all',
client: function () { return '/wiki/list/all'; } client: function () { return '/wiki/list/all'; }
}, },
@ -14,7 +14,7 @@ exports.WikiApiDefinition = {
* 获取用户创建的知识库 * 获取用户创建的知识库
*/ */
getOwnWikis: { getOwnWikis: {
method: 'Get', method: 'get',
server: 'list/own', server: 'list/own',
client: function () { return '/wiki/list/own'; } client: function () { return '/wiki/list/own'; }
}, },
@ -22,7 +22,7 @@ exports.WikiApiDefinition = {
* 获取用户参与的知识库 * 获取用户参与的知识库
*/ */
getJoinWikis: { getJoinWikis: {
method: 'Get', method: 'get',
server: 'list/join', server: 'list/join',
client: function () { return '/wiki/list/join'; } client: function () { return '/wiki/list/join'; }
}, },
@ -30,7 +30,7 @@ exports.WikiApiDefinition = {
* 新建知识库 * 新建知识库
*/ */
add: { add: {
method: 'Post', method: 'post',
server: 'add', server: 'add',
client: function () { return '/wiki/add'; } client: function () { return '/wiki/add'; }
}, },
@ -38,7 +38,7 @@ exports.WikiApiDefinition = {
* 获取知识库首页文档 * 获取知识库首页文档
*/ */
getHomeDocumentById: { getHomeDocumentById: {
method: 'Get', method: 'get',
server: 'homedoc/:id', server: 'homedoc/:id',
client: function (id) { return "/wiki/homedoc/".concat(id); } client: function (id) { return "/wiki/homedoc/".concat(id); }
}, },
@ -46,7 +46,7 @@ exports.WikiApiDefinition = {
* 获取知识库目录 * 获取知识库目录
*/ */
getTocsById: { getTocsById: {
method: 'Get', method: 'get',
server: 'tocs/:id', server: 'tocs/:id',
client: function (id) { return "/wiki/tocs/".concat(id); } client: function (id) { return "/wiki/tocs/".concat(id); }
}, },
@ -54,7 +54,7 @@ exports.WikiApiDefinition = {
* 更新知识库目录 * 更新知识库目录
*/ */
updateTocsById: { updateTocsById: {
method: 'Patch', method: 'patch',
server: 'tocs/:id/update', server: 'tocs/:id/update',
client: function (id) { return "/wiki/tocs/".concat(id, "/update"); } client: function (id) { return "/wiki/tocs/".concat(id, "/update"); }
}, },
@ -62,7 +62,7 @@ exports.WikiApiDefinition = {
* 获取知识库所有文档 * 获取知识库所有文档
*/ */
getDocumentsById: { getDocumentsById: {
method: 'Get', method: 'get',
server: 'documents/:id', server: 'documents/:id',
client: function (id) { return "/wiki/documents/".concat(id); } client: function (id) { return "/wiki/documents/".concat(id); }
}, },
@ -70,7 +70,7 @@ exports.WikiApiDefinition = {
* 获取知识库详情 * 获取知识库详情
*/ */
getDetailById: { getDetailById: {
method: 'Get', method: 'get',
server: 'detail/:id', server: 'detail/:id',
client: function (id) { return "/wiki/detail/".concat(id); } client: function (id) { return "/wiki/detail/".concat(id); }
}, },
@ -78,7 +78,7 @@ exports.WikiApiDefinition = {
* 更新知识库 * 更新知识库
*/ */
updateById: { updateById: {
method: 'Patch', method: 'patch',
server: 'update/:id', server: 'update/:id',
client: function (id) { return "/wiki/update/".concat(id); } client: function (id) { return "/wiki/update/".concat(id); }
}, },
@ -86,7 +86,7 @@ exports.WikiApiDefinition = {
* 删除知识库 * 删除知识库
*/ */
deleteById: { deleteById: {
method: 'Delete', method: 'delete',
server: 'delet/:id', server: 'delet/:id',
client: function (id) { return "/wiki/delet/".concat(id); } client: function (id) { return "/wiki/delet/".concat(id); }
}, },
@ -94,7 +94,7 @@ exports.WikiApiDefinition = {
* 获取知识库成员 * 获取知识库成员
*/ */
getMemberById: { getMemberById: {
method: 'Get', method: 'get',
server: 'member/:id', server: 'member/:id',
client: function (id) { return "/wiki/member/".concat(id); } client: function (id) { return "/wiki/member/".concat(id); }
}, },
@ -102,7 +102,7 @@ exports.WikiApiDefinition = {
* 添加知识库成员 * 添加知识库成员
*/ */
addMemberById: { addMemberById: {
method: 'Post', method: 'post',
server: 'member/:id/add', server: 'member/:id/add',
client: function (id) { return "/wiki/member/".concat(id, "/add"); } client: function (id) { return "/wiki/member/".concat(id, "/add"); }
}, },
@ -110,7 +110,7 @@ exports.WikiApiDefinition = {
* 更新知识库成员 * 更新知识库成员
*/ */
updateMemberById: { updateMemberById: {
method: 'Patch', method: 'patch',
server: 'member/:id/update', server: 'member/:id/update',
client: function (id) { return "/wiki/member/".concat(id, "/update"); } client: function (id) { return "/wiki/member/".concat(id, "/update"); }
}, },
@ -118,7 +118,7 @@ exports.WikiApiDefinition = {
* 删除知识库成员 * 删除知识库成员
*/ */
deleteMemberById: { deleteMemberById: {
method: 'Delete', method: 'delete',
server: 'member/:id/delete', server: 'member/:id/delete',
client: function (id) { return "/wiki/member/".concat(id, "/delete"); } client: function (id) { return "/wiki/member/".concat(id, "/delete"); }
}, },
@ -126,7 +126,7 @@ exports.WikiApiDefinition = {
* 分享知识库 * 分享知识库
*/ */
shareById: { shareById: {
method: 'Post', method: 'post',
server: 'share/:id', server: 'share/:id',
client: function (id) { return "/wiki/share/".concat(id); } client: function (id) { return "/wiki/share/".concat(id); }
}, },
@ -134,7 +134,7 @@ exports.WikiApiDefinition = {
* 获取公开知识库首页文档 * 获取公开知识库首页文档
*/ */
getPublicHomeDocumentById: { getPublicHomeDocumentById: {
method: 'Get', method: 'get',
server: '/public/homedoc/:id', server: '/public/homedoc/:id',
client: function (id) { return "/wiki/public/homedoc/".concat(id); } client: function (id) { return "/wiki/public/homedoc/".concat(id); }
}, },
@ -142,7 +142,7 @@ exports.WikiApiDefinition = {
* 获取公开知识库目录 * 获取公开知识库目录
*/ */
getPublicTocsById: { getPublicTocsById: {
method: 'Get', method: 'get',
server: '/public/tocs/:id', server: '/public/tocs/:id',
client: function (id) { return "/wiki/public/tocs/".concat(id); } client: function (id) { return "/wiki/public/tocs/".concat(id); }
}, },
@ -150,7 +150,7 @@ exports.WikiApiDefinition = {
* 获取知识库详情 * 获取知识库详情
*/ */
getPublicDetailById: { getPublicDetailById: {
method: 'Get', method: 'get',
server: '/public/detail/:id', server: '/public/detail/:id',
client: function (id) { return "/wiki/public/detail/".concat(id); } client: function (id) { return "/wiki/public/detail/".concat(id); }
}, },
@ -158,8 +158,8 @@ exports.WikiApiDefinition = {
* 获取所有公开知识库 * 获取所有公开知识库
*/ */
getPublicWikis: { getPublicWikis: {
method: 'Get', method: 'get',
server: '/public/wikis', server: '/public/wikis',
client: function (id) { return "/wiki/public/wikis"; } client: function () { return "/wiki/public/wikis"; }
} }
}; };

View File

@ -1,26 +1,11 @@
import { IDocument, IWiki, CollectType } from '../models'; 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 = { export const CollectorApiDefinition = {
/** /**
* *
*/ */
toggle: { toggle: {
method: 'Post' as const, method: 'post' as const,
server: 'toggle' as const, server: 'toggle' as const,
client: () => '/collector/toggle', client: () => '/collector/toggle',
}, },
@ -29,7 +14,7 @@ export const CollectorApiDefinition = {
* *
*/ */
check: { check: {
method: 'Post' as const, method: 'post' as const,
server: 'check' as const, server: 'check' as const,
client: () => '/collector/check', client: () => '/collector/check',
}, },
@ -38,7 +23,7 @@ export const CollectorApiDefinition = {
* *
*/ */
wikis: { wikis: {
method: 'Post' as const, method: 'get' as const,
server: 'wikis' as const, server: 'wikis' as const,
client: () => '/collector/wikis', client: () => '/collector/wikis',
}, },
@ -47,7 +32,7 @@ export const CollectorApiDefinition = {
* *
*/ */
documents: { documents: {
method: 'Post' as const, method: 'get' as const,
server: 'documents' as const, server: 'documents' as const,
client: () => '/collector/documents', client: () => '/collector/documents',
}, },

View File

@ -5,7 +5,7 @@ export const CommentApiDefinition = {
* *
*/ */
add: { add: {
method: 'Post' as const, method: 'post' as const,
server: 'add' as const, server: 'add' as const,
client: () => '/comment/add', client: () => '/comment/add',
}, },
@ -14,7 +14,7 @@ export const CommentApiDefinition = {
* *
*/ */
update: { update: {
method: 'Patch' as const, method: 'patch' as const,
server: 'update' as const, server: 'update' as const,
client: () => '/comment/update', client: () => '/comment/update',
}, },
@ -23,7 +23,7 @@ export const CommentApiDefinition = {
* *
*/ */
delete: { delete: {
method: 'Delete' as const, method: 'delete' as const,
server: 'delete/:id' as const, server: 'delete/:id' as const,
client: (id: IComment['id']) => `/comment/delete/${id}`, client: (id: IComment['id']) => `/comment/delete/${id}`,
}, },
@ -32,7 +32,7 @@ export const CommentApiDefinition = {
* *
*/ */
documents: { documents: {
method: 'Get' as const, method: 'get' as const,
server: 'document/:documentId' as const, server: 'document/:documentId' as const,
client: (documentId: IDocument['id']) => `/comment/document/${documentId}`, client: (documentId: IDocument['id']) => `/comment/document/${documentId}`,
}, },

View File

@ -5,7 +5,7 @@ export const DocumentApiDefinition = {
* *
*/ */
search: { search: {
method: 'Get' as const, method: 'get' as const,
server: 'search' as const, server: 'search' as const,
client: () => '/document/search', client: () => '/document/search',
}, },
@ -14,7 +14,7 @@ export const DocumentApiDefinition = {
* 访 * 访
*/ */
recent: { recent: {
method: 'Get' as const, method: 'get' as const,
server: 'recent' as const, server: 'recent' as const,
client: () => '/document/recent', client: () => '/document/recent',
}, },
@ -23,7 +23,7 @@ export const DocumentApiDefinition = {
* *
*/ */
create: { create: {
method: 'Post' as const, method: 'post' as const,
server: 'create' as const, server: 'create' as const,
client: () => '/document/create', client: () => '/document/create',
}, },
@ -32,7 +32,7 @@ export const DocumentApiDefinition = {
* *
*/ */
getDetailById: { getDetailById: {
method: 'Get' as const, method: 'get' as const,
server: 'detail/:id' as const, server: 'detail/:id' as const,
client: (id: IDocument['id']) => `/document/detail/${id}`, client: (id: IDocument['id']) => `/document/detail/${id}`,
}, },
@ -41,7 +41,7 @@ export const DocumentApiDefinition = {
* *
*/ */
updateById: { updateById: {
method: 'Patch' as const, method: 'patch' as const,
server: 'update/:id' as const, server: 'update/:id' as const,
client: (id: IDocument['id']) => `/document/update/${id}`, client: (id: IDocument['id']) => `/document/update/${id}`,
}, },
@ -50,7 +50,7 @@ export const DocumentApiDefinition = {
* *
*/ */
getVersionById: { getVersionById: {
method: 'Get' as const, method: 'get' as const,
server: 'version/:id' as const, server: 'version/:id' as const,
client: (id: IDocument['id']) => `/document/version/${id}`, client: (id: IDocument['id']) => `/document/version/${id}`,
}, },
@ -59,7 +59,7 @@ export const DocumentApiDefinition = {
* *
*/ */
getMemberById: { getMemberById: {
method: 'Get' as const, method: 'get' as const,
server: 'member/:id' as const, server: 'member/:id' as const,
client: (id: IDocument['id']) => `/document/member/${id}`, client: (id: IDocument['id']) => `/document/member/${id}`,
}, },
@ -68,7 +68,7 @@ export const DocumentApiDefinition = {
* *
*/ */
addMemberById: { addMemberById: {
method: 'Post' as const, method: 'post' as const,
server: 'member/:id/add' as const, server: 'member/:id/add' as const,
client: (id: IDocument['id']) => `/document/member/${id}/add`, client: (id: IDocument['id']) => `/document/member/${id}/add`,
}, },
@ -77,7 +77,7 @@ export const DocumentApiDefinition = {
* *
*/ */
updateMemberById: { updateMemberById: {
method: 'Patch' as const, method: 'patch' as const,
server: 'member/:id/update' as const, server: 'member/:id/update' as const,
client: (id: IDocument['id']) => `/document/member/${id}/update`, client: (id: IDocument['id']) => `/document/member/${id}/update`,
}, },
@ -86,7 +86,7 @@ export const DocumentApiDefinition = {
* *
*/ */
deleteMemberById: { deleteMemberById: {
method: 'Post' as const, method: 'post' as const,
server: 'member/:id/delete' as const, server: 'member/:id/delete' as const,
client: (id: IDocument['id']) => `/document/member/${id}/delete`, client: (id: IDocument['id']) => `/document/member/${id}/delete`,
}, },
@ -95,7 +95,7 @@ export const DocumentApiDefinition = {
* *
*/ */
getChildren: { getChildren: {
method: 'Get' as const, method: 'get' as const,
server: 'children' as const, server: 'children' as const,
client: () => `/document/children`, client: () => `/document/children`,
}, },
@ -104,7 +104,7 @@ export const DocumentApiDefinition = {
* *
*/ */
deleteById: { deleteById: {
method: 'Delete' as const, method: 'delete' as const,
server: 'delete/:id' as const, server: 'delete/:id' as const,
client: (id: IDocument['id']) => `/document/delete/${id}`, client: (id: IDocument['id']) => `/document/delete/${id}`,
}, },
@ -113,7 +113,7 @@ export const DocumentApiDefinition = {
* *
*/ */
shareById: { shareById: {
method: 'Post' as const, method: 'post' as const,
server: 'share/:id' as const, server: 'share/:id' as const,
client: (id: IDocument['id']) => `/document/share/${id}`, client: (id: IDocument['id']) => `/document/share/${id}`,
}, },
@ -122,7 +122,7 @@ export const DocumentApiDefinition = {
* *
*/ */
getPublicDetailById: { getPublicDetailById: {
method: 'Get' as const, method: 'get' as const,
server: 'public/detail/:id' as const, server: 'public/detail/:id' as const,
client: (id: IDocument['id']) => `/document/public/detail/${id}`, client: (id: IDocument['id']) => `/document/public/detail/${id}`,
}, },
@ -131,7 +131,7 @@ export const DocumentApiDefinition = {
* *
*/ */
getPublicChildren: { getPublicChildren: {
method: 'Get' as const, method: 'get' as const,
server: 'public/children' as const, server: 'public/children' as const,
client: () => `/document/public/children`, client: () => `/document/public/children`,
}, },

View File

@ -3,7 +3,7 @@ export const FileApiDefinition = {
* *
*/ */
upload: { upload: {
method: 'Post' as const, method: 'post' as const,
server: 'upload' as const, server: 'upload' as const,
client: () => '/file/upload', client: () => '/file/upload',
}, },

View File

@ -5,7 +5,7 @@ export const MessageApiDefinition = {
* *
*/ */
getUnread: { getUnread: {
method: 'Get' as const, method: 'get' as const,
server: 'unread' as const, server: 'unread' as const,
client: () => '/message/unread', client: () => '/message/unread',
}, },
@ -14,7 +14,7 @@ export const MessageApiDefinition = {
* *
*/ */
getRead: { getRead: {
method: 'Get' as const, method: 'get' as const,
server: 'read' as const, server: 'read' as const,
client: () => '/message/read', client: () => '/message/read',
}, },
@ -23,7 +23,7 @@ export const MessageApiDefinition = {
* *
*/ */
getAll: { getAll: {
method: 'Get' as const, method: 'get' as const,
server: 'all' as const, server: 'all' as const,
client: () => '/message/all', client: () => '/message/all',
}, },
@ -32,7 +32,7 @@ export const MessageApiDefinition = {
* *
*/ */
readMessage: { readMessage: {
method: 'Post' as const, method: 'post' as const,
server: 'read/:id' as const, server: 'read/:id' as const,
client: (id: IMessage['id']) => `/message/read/${id}`, client: (id: IMessage['id']) => `/message/read/${id}`,
}, },

View File

@ -5,7 +5,7 @@ export const TemplateApiDefinition = {
* *
*/ */
public: { public: {
method: 'Get' as const, method: 'get' as const,
server: 'public' as const, server: 'public' as const,
client: () => '/template/public', client: () => '/template/public',
}, },
@ -14,7 +14,7 @@ export const TemplateApiDefinition = {
* *
*/ */
own: { own: {
method: 'Get' as const, method: 'get' as const,
server: 'own' as const, server: 'own' as const,
client: () => '/template/own', client: () => '/template/own',
}, },
@ -23,7 +23,7 @@ export const TemplateApiDefinition = {
* *
*/ */
add: { add: {
method: 'Post' as const, method: 'post' as const,
server: 'add' as const, server: 'add' as const,
client: () => '/template/add', client: () => '/template/add',
}, },
@ -32,7 +32,7 @@ export const TemplateApiDefinition = {
* *
*/ */
updateById: { updateById: {
method: 'Patch' as const, method: 'patch' as const,
server: 'update/:id' as const, server: 'update/:id' as const,
client: (id: ITemplate['id']) => `/template/update/${id}`, client: (id: ITemplate['id']) => `/template/update/${id}`,
}, },
@ -41,7 +41,7 @@ export const TemplateApiDefinition = {
* *
*/ */
getDetailById: { getDetailById: {
method: 'Get' as const, method: 'get' as const,
server: 'detail/:id' as const, server: 'detail/:id' as const,
client: (id: ITemplate['id']) => `/template/detail/${id}`, client: (id: ITemplate['id']) => `/template/detail/${id}`,
}, },
@ -50,7 +50,7 @@ export const TemplateApiDefinition = {
* *
*/ */
deleteById: { deleteById: {
method: 'Delete' as const, method: 'delete' as const,
server: 'delete/:id' as const, server: 'delete/:id' as const,
client: (id: ITemplate['id']) => `/template/delete/${id}`, client: (id: ITemplate['id']) => `/template/delete/${id}`,
}, },

View File

@ -5,7 +5,7 @@ export const UserApiDefinition = {
* *
*/ */
getAllUsers: { getAllUsers: {
method: 'Get' as const, method: 'get' as const,
server: '/' as const, server: '/' as const,
client: () => '/user', client: () => '/user',
}, },
@ -14,7 +14,7 @@ export const UserApiDefinition = {
* *
*/ */
register: { register: {
method: 'Post' as const, method: 'post' as const,
server: 'register' as const, server: 'register' as const,
client: () => '/user/register', client: () => '/user/register',
}, },
@ -23,7 +23,7 @@ export const UserApiDefinition = {
* *
*/ */
login: { login: {
method: 'Post' as const, method: 'post' as const,
server: 'login' as const, server: 'login' as const,
client: () => '/user/login', client: () => '/user/login',
}, },
@ -32,7 +32,7 @@ export const UserApiDefinition = {
* *
*/ */
logout: { logout: {
method: 'Post' as const, method: 'post' as const,
server: 'logout' as const, server: 'logout' as const,
client: () => '/user/logout', client: () => '/user/logout',
}, },
@ -41,7 +41,7 @@ export const UserApiDefinition = {
* *
*/ */
update: { update: {
method: 'Patch' as const, method: 'patch' as const,
server: 'update' as const, server: 'update' as const,
client: () => `/user/update`, client: () => `/user/update`,
}, },

View File

@ -5,7 +5,7 @@ export const WikiApiDefinition = {
* *
*/ */
getAllWikis: { getAllWikis: {
method: 'Get' as const, method: 'get' as const,
server: 'list/all' as const, server: 'list/all' as const,
client: () => '/wiki/list/all', client: () => '/wiki/list/all',
}, },
@ -14,7 +14,7 @@ export const WikiApiDefinition = {
* *
*/ */
getOwnWikis: { getOwnWikis: {
method: 'Get' as const, method: 'get' as const,
server: 'list/own' as const, server: 'list/own' as const,
client: () => '/wiki/list/own', client: () => '/wiki/list/own',
}, },
@ -23,7 +23,7 @@ export const WikiApiDefinition = {
* *
*/ */
getJoinWikis: { getJoinWikis: {
method: 'Get' as const, method: 'get' as const,
server: 'list/join' as const, server: 'list/join' as const,
client: () => '/wiki/list/join', client: () => '/wiki/list/join',
}, },
@ -32,7 +32,7 @@ export const WikiApiDefinition = {
* *
*/ */
add: { add: {
method: 'Post' as const, method: 'post' as const,
server: 'add' as const, server: 'add' as const,
client: () => '/wiki/add', client: () => '/wiki/add',
}, },
@ -41,7 +41,7 @@ export const WikiApiDefinition = {
* *
*/ */
getHomeDocumentById: { getHomeDocumentById: {
method: 'Get' as const, method: 'get' as const,
server: 'homedoc/:id' as const, server: 'homedoc/:id' as const,
client: (id: IWiki['id']) => `/wiki/homedoc/${id}`, client: (id: IWiki['id']) => `/wiki/homedoc/${id}`,
}, },
@ -50,7 +50,7 @@ export const WikiApiDefinition = {
* *
*/ */
getTocsById: { getTocsById: {
method: 'Get' as const, method: 'get' as const,
server: 'tocs/:id' as const, server: 'tocs/:id' as const,
client: (id: IWiki['id']) => `/wiki/tocs/${id}`, client: (id: IWiki['id']) => `/wiki/tocs/${id}`,
}, },
@ -59,7 +59,7 @@ export const WikiApiDefinition = {
* *
*/ */
updateTocsById: { updateTocsById: {
method: 'Patch' as const, method: 'patch' as const,
server: 'tocs/:id/update' as const, server: 'tocs/:id/update' as const,
client: (id: IWiki['id']) => `/wiki/tocs/${id}/update`, client: (id: IWiki['id']) => `/wiki/tocs/${id}/update`,
}, },
@ -68,7 +68,7 @@ export const WikiApiDefinition = {
* *
*/ */
getDocumentsById: { getDocumentsById: {
method: 'Get' as const, method: 'get' as const,
server: 'documents/:id' as const, server: 'documents/:id' as const,
client: (id: IWiki['id']) => `/wiki/documents/${id}`, client: (id: IWiki['id']) => `/wiki/documents/${id}`,
}, },
@ -77,7 +77,7 @@ export const WikiApiDefinition = {
* *
*/ */
getDetailById: { getDetailById: {
method: 'Get' as const, method: 'get' as const,
server: 'detail/:id' as const, server: 'detail/:id' as const,
client: (id: IWiki['id']) => `/wiki/detail/${id}`, client: (id: IWiki['id']) => `/wiki/detail/${id}`,
}, },
@ -86,7 +86,7 @@ export const WikiApiDefinition = {
* *
*/ */
updateById: { updateById: {
method: 'Patch' as const, method: 'patch' as const,
server: 'update/:id' as const, server: 'update/:id' as const,
client: (id: IWiki['id']) => `/wiki/update/${id}`, client: (id: IWiki['id']) => `/wiki/update/${id}`,
}, },
@ -95,7 +95,7 @@ export const WikiApiDefinition = {
* *
*/ */
deleteById: { deleteById: {
method: 'Delete' as const, method: 'delete' as const,
server: 'delet/:id' as const, server: 'delet/:id' as const,
client: (id: IWiki['id']) => `/wiki/delet/${id}`, client: (id: IWiki['id']) => `/wiki/delet/${id}`,
}, },
@ -104,7 +104,7 @@ export const WikiApiDefinition = {
* *
*/ */
getMemberById: { getMemberById: {
method: 'Get' as const, method: 'get' as const,
server: 'member/:id' as const, server: 'member/:id' as const,
client: (id: IWiki['id']) => `/wiki/member/${id}`, client: (id: IWiki['id']) => `/wiki/member/${id}`,
}, },
@ -113,7 +113,7 @@ export const WikiApiDefinition = {
* *
*/ */
addMemberById: { addMemberById: {
method: 'Post' as const, method: 'post' as const,
server: 'member/:id/add' as const, server: 'member/:id/add' as const,
client: (id: IWiki['id']) => `/wiki/member/${id}/add`, client: (id: IWiki['id']) => `/wiki/member/${id}/add`,
}, },
@ -122,7 +122,7 @@ export const WikiApiDefinition = {
* *
*/ */
updateMemberById: { updateMemberById: {
method: 'Patch' as const, method: 'patch' as const,
server: 'member/:id/update' as const, server: 'member/:id/update' as const,
client: (id: IWiki['id']) => `/wiki/member/${id}/update`, client: (id: IWiki['id']) => `/wiki/member/${id}/update`,
}, },
@ -131,7 +131,7 @@ export const WikiApiDefinition = {
* *
*/ */
deleteMemberById: { deleteMemberById: {
method: 'Delete' as const, method: 'delete' as const,
server: 'member/:id/delete' as const, server: 'member/:id/delete' as const,
client: (id: IWiki['id']) => `/wiki/member/${id}/delete`, client: (id: IWiki['id']) => `/wiki/member/${id}/delete`,
}, },
@ -140,7 +140,7 @@ export const WikiApiDefinition = {
* *
*/ */
shareById: { shareById: {
method: 'Post' as const, method: 'post' as const,
server: 'share/:id' as const, server: 'share/:id' as const,
client: (id: IWiki['id']) => `/wiki/share/${id}`, client: (id: IWiki['id']) => `/wiki/share/${id}`,
}, },
@ -149,7 +149,7 @@ export const WikiApiDefinition = {
* *
*/ */
getPublicHomeDocumentById: { getPublicHomeDocumentById: {
method: 'Get' as const, method: 'get' as const,
server: '/public/homedoc/:id' as const, server: '/public/homedoc/:id' as const,
client: (id: IWiki['id']) => `/wiki/public/homedoc/${id}`, client: (id: IWiki['id']) => `/wiki/public/homedoc/${id}`,
}, },
@ -158,7 +158,7 @@ export const WikiApiDefinition = {
* *
*/ */
getPublicTocsById: { getPublicTocsById: {
method: 'Get' as const, method: 'get' as const,
server: '/public/tocs/:id' as const, server: '/public/tocs/:id' as const,
client: (id: IWiki['id']) => `/wiki/public/tocs/${id}`, client: (id: IWiki['id']) => `/wiki/public/tocs/${id}`,
}, },
@ -167,7 +167,7 @@ export const WikiApiDefinition = {
* *
*/ */
getPublicDetailById: { getPublicDetailById: {
method: 'Get' as const, method: 'get' as const,
server: '/public/detail/:id' as const, server: '/public/detail/:id' as const,
client: (id: IWiki['id']) => `/wiki/public/detail/${id}`, client: (id: IWiki['id']) => `/wiki/public/detail/${id}`,
}, },
@ -176,8 +176,8 @@ export const WikiApiDefinition = {
* *
*/ */
getPublicWikis: { getPublicWikis: {
method: 'Get' as const, method: 'get' as const,
server: '/public/wikis' as const, server: '/public/wikis' as const,
client: (id: IWiki['id']) => `/wiki/public/wikis`, client: () => `/wiki/public/wikis`,
}, },
}; };

View File

@ -69,6 +69,7 @@
"@types/cron": "^2.0.0", "@types/cron": "^2.0.0",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
"@types/jest": "27.0.2", "@types/jest": "27.0.2",
"@types/lodash": "^4.14.182",
"@types/node": "^16.0.0", "@types/node": "^16.0.0",
"@types/supertest": "^2.0.11", "@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.21.0", "@typescript-eslint/eslint-plugin": "^5.21.0",

View File

@ -34,7 +34,7 @@ export class CollectorController {
* *
*/ */
@UseInterceptors(ClassSerializerInterceptor) @UseInterceptors(ClassSerializerInterceptor)
@Post(CollectorApiDefinition.toggle.server) @Post(CollectorApiDefinition.check.server)
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
@UseGuards(JwtGuard) @UseGuards(JwtGuard)
async checkStar(@Request() req, @Body() dto: CollectDto) { async checkStar(@Request() req, @Body() dto: CollectDto) {

View File

@ -6,6 +6,7 @@ import { DocumentService } from '@services/document.service';
import { OutUser, UserService } from '@services/user.service'; import { OutUser, UserService } from '@services/user.service';
import { WikiService } from '@services/wiki.service'; import { WikiService } from '@services/wiki.service';
import { CollectType } from '@think/domains'; import { CollectType } from '@think/domains';
import * as lodash from 'lodash';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
@Injectable() @Injectable()
@ -28,7 +29,8 @@ export class CollectorService {
}; };
const record = await this.collectorRepo.findOne(data); const record = await this.collectorRepo.findOne(data);
if (record) { if (record) {
return await this.collectorRepo.remove(record); await this.collectorRepo.remove(record);
return;
} else { } else {
const res = await this.collectorRepo.create(data); const res = await this.collectorRepo.create(data);
const ret = await this.collectorRepo.save(res); 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']);
});
} }
} }

View File

@ -31,7 +31,7 @@ export class DocumentVersionService {
return; return;
} }
this.max = lodash.get(config, 'server.maxDocumentVersion', 0); this.max = lodash.get(config, 'server.maxDocumentVersion', 0) as number;
try { try {
const redis = new Redis({ const redis = new Redis({

View File

@ -15,8 +15,9 @@ import { OutUser, UserService } from '@services/user.service';
import { ViewService } from '@services/view.service'; import { ViewService } from '@services/view.service';
import { WikiService } from '@services/wiki.service'; import { WikiService } from '@services/wiki.service';
import { EMPTY_DOCUMNENT } from '@think/constants'; 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 { instanceToPlain } from 'class-transformer';
import * as lodash from 'lodash';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
@Injectable() @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']);
});
} }
/** /**

View File

@ -4,6 +4,7 @@ import { forwardRef, HttpException, HttpStatus, Inject, Injectable } from '@nest
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { OutUser, UserService } from '@services/user.service'; import { OutUser, UserService } from '@services/user.service';
import { instanceToPlain } from 'class-transformer'; import { instanceToPlain } from 'class-transformer';
import * as lodash from 'lodash';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
@Injectable() @Injectable()
@ -57,7 +58,7 @@ export class TemplateService {
} }
/** /**
* *
* @param id * @param id
* @param tag * @param tag
*/ */
@ -69,7 +70,7 @@ export class TemplateService {
} }
const createUser = await this.userService.findById(template.createUserId); const createUser = await this.userService.findById(template.createUserId);
return { ...template, createUser }; return lodash.omit({ ...template, createUser }, ['state']);
} }
/** /**

View File

@ -131,6 +131,7 @@ importers:
react-helmet: ^6.1.0 react-helmet: ^6.1.0
react-lazy-load-image-component: ^1.5.4 react-lazy-load-image-component: ^1.5.4
react-pdf: ^5.7.2 react-pdf: ^5.7.2
react-query: ^3.39.0
react-split-pane: ^0.1.92 react-split-pane: ^0.1.92
scroll-into-view-if-needed: ^2.2.29 scroll-into-view-if-needed: ^2.2.29
swr: ^1.2.0 swr: ^1.2.0
@ -219,6 +220,7 @@ importers:
react-helmet: 6.1.0_react@17.0.2 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-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-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 react-split-pane: 0.1.92_react-dom@17.0.2+react@17.0.2
scroll-into-view-if-needed: 2.2.29 scroll-into-view-if-needed: 2.2.29
swr: 1.2.0_react@17.0.2 swr: 1.2.0_react@17.0.2
@ -236,7 +238,7 @@ importers:
eslint: 8.14.0 eslint: 8.14.0
eslint-config-prettier: 8.5.0_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-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: 7.29.4_eslint@8.14.0
eslint-plugin-react-hooks: 4.5.0_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 eslint-plugin-simple-import-sort: 7.0.0_eslint@8.14.0
@ -284,6 +286,7 @@ importers:
'@types/cron': ^2.0.0 '@types/cron': ^2.0.0
'@types/express': ^4.17.13 '@types/express': ^4.17.13
'@types/jest': 27.0.2 '@types/jest': 27.0.2
'@types/lodash': ^4.14.182
'@types/node': ^16.0.0 '@types/node': ^16.0.0
'@types/supertest': ^2.0.11 '@types/supertest': ^2.0.11
'@typescript-eslint/eslint-plugin': ^5.21.0 '@typescript-eslint/eslint-plugin': ^5.21.0
@ -382,6 +385,7 @@ importers:
'@types/cron': 2.0.0 '@types/cron': 2.0.0
'@types/express': 4.17.13 '@types/express': 4.17.13
'@types/jest': 27.0.2 '@types/jest': 27.0.2
'@types/lodash': 4.14.182
'@types/node': 16.11.21 '@types/node': 16.11.21
'@types/supertest': 2.0.11 '@types/supertest': 2.0.11
'@typescript-eslint/eslint-plugin': 5.21.0_19515efd875c7ffcd67055d8be736b9f '@typescript-eslint/eslint-plugin': 5.21.0_19515efd875c7ffcd67055d8be736b9f
@ -3216,6 +3220,10 @@ packages:
'@types/node': 16.11.21 '@types/node': 16.11.21
dev: false dev: false
/@types/lodash/4.14.182:
resolution: {integrity: sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==}
dev: true
/@types/lowlight/0.0.3: /@types/lowlight/0.0.3:
resolution: {integrity: sha512-R83q/yPX2nIlo9D3WtSjyUDd57t8s+GVLaL8YIv3k7zMMWpYpOXqjJgrWp80qXUJB/a1t76nTyBpxrv0JNYaEg==} resolution: {integrity: sha512-R83q/yPX2nIlo9D3WtSjyUDd57t8s+GVLaL8YIv3k7zMMWpYpOXqjJgrWp80qXUJB/a1t76nTyBpxrv0JNYaEg==}
dev: false dev: false
@ -4182,6 +4190,11 @@ packages:
resolution: {integrity: sha1-wE3+i5JtbsrKGBPWn/F5t8ICXYY=} resolution: {integrity: sha1-wE3+i5JtbsrKGBPWn/F5t8ICXYY=}
dev: false dev: false
/big-integer/1.6.51:
resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==}
engines: {node: '>=0.6'}
dev: false
/big.js/5.2.2: /big.js/5.2.2:
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==} resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
dev: false dev: false
@ -4236,6 +4249,19 @@ packages:
dependencies: dependencies:
fill-range: 7.0.1 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: /browser-process-hrtime/1.0.0:
resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==} resolution: {integrity: sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==}
dev: true dev: true
@ -5058,6 +5084,10 @@ packages:
engines: {node: '>=8'} engines: {node: '>=8'}
dev: true dev: true
/detect-node/2.1.0:
resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==}
dev: false
/dezalgo/1.0.3: /dezalgo/1.0.3:
resolution: {integrity: sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=} resolution: {integrity: sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY=}
dependencies: dependencies:
@ -5415,22 +5445,6 @@ packages:
prettier-linter-helpers: 1.0.0 prettier-linter-helpers: 1.0.0
dev: true 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: /eslint-plugin-react-hooks/4.5.0_eslint@8.14.0:
resolution: {integrity: sha512-8k1gRt7D7h03kd+SAAlzXkQwWK22BnK6GKZG+FJA6BAGy22CFvl8kCIXKpVux0cCxMWDQUPqSok0LKaZ0aOcCw==} resolution: {integrity: sha512-8k1gRt7D7h03kd+SAAlzXkQwWK22BnK6GKZG+FJA6BAGy22CFvl8kCIXKpVux0cCxMWDQUPqSok0LKaZ0aOcCw==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -7294,6 +7308,10 @@ packages:
resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==} resolution: {integrity: sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==}
dev: false dev: false
/js-sha3/0.8.0:
resolution: {integrity: sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==}
dev: false
/js-tokens/4.0.0: /js-tokens/4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
@ -7846,6 +7864,13 @@ packages:
uc.micro: 1.0.6 uc.micro: 1.0.6
dev: false 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: /mathml-tag-names/2.1.3:
resolution: {integrity: sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==} resolution: {integrity: sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==}
dev: true dev: true
@ -7918,6 +7943,10 @@ packages:
braces: 3.0.2 braces: 3.0.2
picomatch: 2.3.1 picomatch: 2.3.1
/microseconds/0.2.0:
resolution: {integrity: sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==}
dev: false
/mime-db/1.51.0: /mime-db/1.51.0:
resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==} resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
@ -8066,6 +8095,12 @@ packages:
lru-cache: 4.1.5 lru-cache: 4.1.5
dev: false 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: /nanoid/3.2.0:
resolution: {integrity: sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==} resolution: {integrity: sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
@ -8311,6 +8346,10 @@ packages:
es-abstract: 1.19.1 es-abstract: 1.19.1
dev: true dev: true
/oblivious-set/1.0.0:
resolution: {integrity: sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw==}
dev: false
/on-exit-leak-free/0.2.0: /on-exit-leak-free/0.2.0:
resolution: {integrity: sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==} resolution: {integrity: sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg==}
dev: false dev: false
@ -9173,6 +9212,25 @@ packages:
- worker-loader - worker-loader
dev: false 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: /react-resizable/1.11.1_react-dom@17.0.2+react@17.0.2:
resolution: {integrity: sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q==} resolution: {integrity: sha512-S70gbLaAYqjuAd49utRHibtHLrHXInh7GuOR+6OO6RO6uleQfuBnWmZjRABfqNEx3C3Z6VPLg0/0uOYFrkfu9Q==}
peerDependencies: peerDependencies:
@ -9392,6 +9450,10 @@ packages:
jsesc: 0.5.0 jsesc: 0.5.0
dev: false dev: false
/remove-accents/0.4.2:
resolution: {integrity: sha1-CkPTqq4egNuRngeuJUsoXZ4ce7U=}
dev: false
/require-directory/2.1.1: /require-directory/2.1.1:
resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=} resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
@ -10928,6 +10990,13 @@ packages:
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
engines: {node: '>= 10.0.0'} 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: /unpipe/1.0.0:
resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=} resolution: {integrity: sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}