UBERF-4725 Migrate collaborative content (#5717)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov
2024-08-22 16:03:42 +05:00
committed by GitHub
parent 0e72b85978
commit df2a9b2708
97 changed files with 702 additions and 820 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ import { HtmlConversionBackend } from './convert/convert'
export interface Config {
doc: string
token: string
collaboratorApiURL: string
collaboratorURL: string
uploadURL: string
workspaceId: WorkspaceId
owner: Ref<Employee>
+6 -6
View File
@@ -21,7 +21,7 @@ import core, {
Ref,
TxOperations,
generateId,
getCollaborativeDoc,
makeCollaborativeDoc,
systemAccountEmail,
type Blob
} from '@hcengineering/core'
@@ -100,7 +100,7 @@ async function createDocument (
abstract: '',
effectiveDate: 0,
reviewInterval: DEFAULT_PERIODIC_REVIEW_INTERVAL,
content: getCollaborativeDoc(generateId()),
content: makeCollaborativeDoc(generateId()),
snapshots: 0,
plannedEffectiveDate: 0
}
@@ -168,7 +168,7 @@ async function createTemplateIfNotExist (
approvers: [],
coAuthors: [],
changeControl: ccRecordId,
content: getCollaborativeDoc(generateId()),
content: makeCollaborativeDoc(generateId()),
snapshots: 0,
plannedEffectiveDate: 0
}
@@ -208,8 +208,8 @@ async function createSections (
throw new Error(`Invalid document: ${JSON.stringify(doc)}`)
}
const { collaboratorApiURL, token, workspaceId } = config
const collaborator = getCollaboratorClient(txops.getHierarchy(), workspaceId, token, collaboratorApiURL)
const { collaboratorURL, token, workspaceId } = config
const collaborator = getCollaboratorClient(workspaceId, token, collaboratorURL)
console.log('Creating document content')
@@ -229,7 +229,7 @@ async function createSections (
content += `<h1>${section.title}</h1>${section.content}`
}
await collaborator.updateContent(collabId, 'content', content)
await collaborator.updateContent(collabId, { content })
} finally {
// do nothing
}
+3 -3
View File
@@ -44,8 +44,8 @@ export function docImportTool (): void {
process.exit(1)
}
const collaboratorApiUrl = process.env.COLLABORATOR_API_URL
if (collaboratorApiUrl === undefined) {
const collaboratorUrl = process.env.COLLABORATOR_URL
if (collaboratorUrl === undefined) {
console.error('please provide collaborator url')
process.exit(1)
}
@@ -104,7 +104,7 @@ export function docImportTool (): void {
space: cmd.space,
uploadURL: uploadUrl,
storageAdapter,
collaboratorApiURL: collaboratorApiUrl,
collaboratorURL: collaboratorUrl,
token: generateToken(systemAccountEmail, workspaceId)
}