mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-05 15:24:22 +00:00
Qfix: consistent space/project/task type mixi ids (#5089)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
92d0b93692
commit
095a9b5d6e
@ -13,7 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
import core, { Class, ClassifierKind, Data, Doc, Ref, SpaceType, TxOperations, generateId } from '@hcengineering/core'
|
import core, { Class, ClassifierKind, Data, Doc, Ref, SpaceType, TxOperations } from '@hcengineering/core'
|
||||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
import { getEmbeddedLabel } from '@hcengineering/platform'
|
||||||
|
|
||||||
export async function createSpaceType (
|
export async function createSpaceType (
|
||||||
@ -27,7 +27,9 @@ export async function createSpaceType (
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseClassClazz = client.getHierarchy().getClass(descriptorObj.baseClass)
|
const baseClassClazz = client.getHierarchy().getClass(descriptorObj.baseClass)
|
||||||
const spaceTypeMixinId: Ref<Class<Doc>> = generateId()
|
// NOTE: it is important for this id to be consistent when re-creating the same
|
||||||
|
// space type with the same id as it will happen during every migration if type is created by the system
|
||||||
|
const spaceTypeMixinId = `${_id}:type:mixin` as Ref<Class<Doc>>
|
||||||
await client.createDoc(
|
await client.createDoc(
|
||||||
core.class.Mixin,
|
core.class.Mixin,
|
||||||
core.space.Model,
|
core.space.Model,
|
||||||
|
@ -24,7 +24,6 @@ import core, {
|
|||||||
Ref,
|
Ref,
|
||||||
Status,
|
Status,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
generateId,
|
|
||||||
type AnyAttribute,
|
type AnyAttribute,
|
||||||
type Rank,
|
type Rank,
|
||||||
type RefTo
|
type RefTo
|
||||||
@ -209,7 +208,9 @@ export async function createProjectType (
|
|||||||
|
|
||||||
const baseClassClass = client.getHierarchy().getClass(categoryObj.baseClass)
|
const baseClassClass = client.getHierarchy().getClass(categoryObj.baseClass)
|
||||||
|
|
||||||
const targetProjectClassId: Ref<Class<Doc>> = generateId()
|
// NOTE: it is important for this id to be consistent when re-creating the same
|
||||||
|
// project type with the same id as it will happen during every migration if type is created by the system
|
||||||
|
const targetProjectClassId = `${_id}:type:mixin` as Ref<Class<Doc>>
|
||||||
const tmpl = await client.createDoc(
|
const tmpl = await client.createDoc(
|
||||||
task.class.ProjectType,
|
task.class.ProjectType,
|
||||||
core.space.Model,
|
core.space.Model,
|
||||||
@ -324,7 +325,9 @@ async function createTaskTypes (
|
|||||||
|
|
||||||
if (tdata.targetClass === undefined) {
|
if (tdata.targetClass === undefined) {
|
||||||
// Create target class for custom field.
|
// Create target class for custom field.
|
||||||
const targetClassId: Ref<Class<Task>> = generateId()
|
// NOTE: it is important for this id to be consistent when re-creating the same
|
||||||
|
// task type with the same id as it will happen during every migration if type is created by the system
|
||||||
|
const targetClassId = `${taskId}:type:mixin` as Ref<Class<Task>>
|
||||||
tdata.targetClass = targetClassId
|
tdata.targetClass = targetClassId
|
||||||
|
|
||||||
await client.createDoc(
|
await client.createDoc(
|
||||||
|
Loading…
Reference in New Issue
Block a user