Fix incorrect space for taskType (#4322)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-01-08 20:21:21 +06:00 committed by GitHub
parent 85c98ead17
commit 5d889380ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -24,8 +24,9 @@ import {
} from '@hcengineering/model'
import core, { DOMAIN_SPACE } from '@hcengineering/model-core'
import tags from '@hcengineering/model-tags'
import { taskId } from '@hcengineering/task'
import { type TaskType, taskId } from '@hcengineering/task'
import task from './plugin'
import { DOMAIN_TASK } from '.'
/**
* @public
@ -129,6 +130,18 @@ export const taskOperation: MigrateOperation = {
}
)
}
},
{
state: 'fixIncorrectTaskTypeSpace',
func: async (client) => {
const taskTypes = await client.find<TaskType>(DOMAIN_TASK, {
_class: task.class.TaskType,
space: core.space.Model
})
for (const taskType of taskTypes) {
await client.update(DOMAIN_TASK, { _id: taskType._id }, { $set: { space: taskType.parent } })
}
}
}
])
},

View File

@ -360,7 +360,7 @@ async function createTaskTypes (
projectType: _id
})
}
await client.createDoc(task.class.TaskType, core.space.Model, tdata as Data<TaskType>, taskId)
await client.createDoc(task.class.TaskType, _id, tdata as Data<TaskType>, taskId)
tasksData.set(taskId, tdata as Data<TaskType>)
_tasks.push(taskId)
}