init: the first public commit for AFFiNE

This commit is contained in:
DarkSky
2022-07-22 15:49:21 +08:00
commit e3e3741393
1451 changed files with 108124 additions and 0 deletions
@@ -0,0 +1,29 @@
import { services } from '@toeverything/datasource/db-service';
interface DuplicatePageProps {
workspaceId: string;
pageId: string;
}
export const duplicatePage = async ({
workspaceId,
pageId,
}: DuplicatePageProps) => {
//create page
const newPage = await services.api.editorBlock.create({
workspace: workspaceId,
type: 'page' as const,
});
//add page to tree
await services.api.pageTree.addNextPageToWorkspace(
workspaceId,
pageId,
newPage.id
);
//copy source page to new page
await services.api.editorBlock.copyPage(workspaceId, pageId, newPage.id);
return {
workspaceId,
pageId: newPage.id,
};
};