mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-11 04:07:43 +02:00
Type export/import (#10373)
* Type export/import Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix formatting Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix ID attributes Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> --------- Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { type MasterTag } from '@hcengineering/card'
|
||||
import { type Class, type Doc, type Ref } from '@hcengineering/core'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import process from './plugin'
|
||||
|
||||
export function exportProcess (_id: Ref<MasterTag>): {
|
||||
docs: Doc[]
|
||||
required: Array<Ref<Class<Doc>>>
|
||||
} {
|
||||
const docs: Doc[] = []
|
||||
const client = getClient()
|
||||
const m = client.getModel()
|
||||
const processes = m.findAllSync(process.class.Process, { masterTag: _id })
|
||||
for (const proc of processes) {
|
||||
docs.push(proc)
|
||||
|
||||
docs.push(...m.findAllSync(process.class.State, { process: proc._id }))
|
||||
|
||||
docs.push(...m.findAllSync(process.class.Transition, { process: proc._id }))
|
||||
}
|
||||
return { docs, required: [] }
|
||||
}
|
||||
@@ -89,6 +89,7 @@ import {
|
||||
eventCheck
|
||||
} from './utils'
|
||||
import FieldChangesEditor from './components/settings/FieldChangesEditor.svelte'
|
||||
import { exportProcess } from './exporter'
|
||||
|
||||
export * from './query'
|
||||
|
||||
@@ -178,6 +179,7 @@ export default async (): Promise<Resources> => ({
|
||||
OnEventCheck: eventCheck
|
||||
},
|
||||
function: {
|
||||
ExportProcess: exportProcess,
|
||||
ShowDoneQuery: showDoneQuery,
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
CreateMiddleware: ProcessMiddleware.create
|
||||
|
||||
Reference in New Issue
Block a user