mirror of
https://github.com/hcengineering/platform.git
synced 2025-02-02 17:02:29 +00:00
uberf-6537: fix teamspace creation (#5354)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
bccf97eeb7
commit
c12327867c
@ -314,15 +314,18 @@ export const documentOperation: MigrateOperation = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||||
|
const tx = new TxOperations(client, core.account.System)
|
||||||
await tryUpgrade(client, documentId, [
|
await tryUpgrade(client, documentId, [
|
||||||
{
|
{
|
||||||
state: 'u-default-project',
|
state: 'u-default-project',
|
||||||
func: async (client) => {
|
func: async (client) => {
|
||||||
const tx = new TxOperations(client, core.account.System)
|
|
||||||
await createSpace(tx)
|
await createSpace(tx)
|
||||||
await createDefaultTeamspaceType(tx)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
// Currently space type has to be recreated every time as it's in the model
|
||||||
|
// created by the system user
|
||||||
|
await createDefaultTeamspaceType(tx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,29 @@ async function createSpace (tx: TxOperations): Promise<void> {
|
|||||||
_id: lead.space.DefaultFunnel
|
_id: lead.space.DefaultFunnel
|
||||||
})
|
})
|
||||||
if (current === undefined) {
|
if (current === undefined) {
|
||||||
const type = await createProjectType(
|
await tx.createDoc(
|
||||||
|
lead.class.Funnel,
|
||||||
|
core.space.Space,
|
||||||
|
{
|
||||||
|
name: 'Funnel',
|
||||||
|
description: 'Default funnel',
|
||||||
|
private: false,
|
||||||
|
archived: false,
|
||||||
|
members: [],
|
||||||
|
type: lead.template.DefaultFunnel
|
||||||
|
},
|
||||||
|
lead.space.DefaultFunnel
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createSpaceType (tx: TxOperations): Promise<void> {
|
||||||
|
const current = await tx.findOne(task.class.ProjectType, {
|
||||||
|
_id: lead.template.DefaultFunnel
|
||||||
|
})
|
||||||
|
|
||||||
|
if (current === undefined) {
|
||||||
|
await createProjectType(
|
||||||
tx,
|
tx,
|
||||||
{
|
{
|
||||||
name: 'Default funnel',
|
name: 'Default funnel',
|
||||||
@ -101,19 +123,6 @@ async function createSpace (tx: TxOperations): Promise<void> {
|
|||||||
],
|
],
|
||||||
lead.template.DefaultFunnel
|
lead.template.DefaultFunnel
|
||||||
)
|
)
|
||||||
await tx.createDoc(
|
|
||||||
lead.class.Funnel,
|
|
||||||
core.space.Space,
|
|
||||||
{
|
|
||||||
name: 'Funnel',
|
|
||||||
description: 'Default funnel',
|
|
||||||
private: false,
|
|
||||||
archived: false,
|
|
||||||
members: [],
|
|
||||||
type
|
|
||||||
},
|
|
||||||
lead.space.DefaultFunnel
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,14 +188,17 @@ export const leadOperation: MigrateOperation = {
|
|||||||
])
|
])
|
||||||
},
|
},
|
||||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||||
|
const ops = new TxOperations(client, core.account.System)
|
||||||
await tryUpgrade(client, leadId, [
|
await tryUpgrade(client, leadId, [
|
||||||
{
|
{
|
||||||
state: 'u-default-funnel',
|
state: 'u-default-funnel',
|
||||||
func: async (client) => {
|
func: async () => {
|
||||||
const ops = new TxOperations(client, core.account.System)
|
|
||||||
await createDefaults(ops)
|
await createDefaults(ops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
// Currently space type has to be recreated every time as it's in the model
|
||||||
|
// created by the system user
|
||||||
|
await createSpaceType(ops)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user