mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 21:45:01 +02:00
UBERF-4725 Migrate collaborative content (#5717)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user