mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 04:08:19 +00:00
introduce Sequence
(#280)
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
2cc2f5c700
commit
465c57f37c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -181,6 +181,11 @@ export function createModel (builder: Builder): void {
|
|||||||
target: recruit.class.Candidate,
|
target: recruit.class.Candidate,
|
||||||
action: recruit.action.CreateApplication
|
action: recruit.action.CreateApplication
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.createDoc(view.class.Sequence, view.space.Sequence, {
|
||||||
|
attachedTo: recruit.class.Applicant,
|
||||||
|
sequence: 0
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export { default } from './plugin'
|
export { default } from './plugin'
|
||||||
|
@ -18,7 +18,7 @@ import type { Ref, Class, Space, Doc, Arr, Domain, State } from '@anticrm/core'
|
|||||||
import { DOMAIN_MODEL } from '@anticrm/core'
|
import { DOMAIN_MODEL } from '@anticrm/core'
|
||||||
import { Model, Mixin, Builder } from '@anticrm/model'
|
import { Model, Mixin, Builder } from '@anticrm/model'
|
||||||
import type { AnyComponent } from '@anticrm/ui'
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
import type { ViewletDescriptor, Viewlet, AttributeEditor, AttributePresenter, KanbanCard, ObjectEditor, Action, ActionTarget, Kanban } from '@anticrm/view'
|
import type { ViewletDescriptor, Viewlet, AttributeEditor, AttributePresenter, KanbanCard, ObjectEditor, Action, ActionTarget, Kanban, Sequence } from '@anticrm/view'
|
||||||
|
|
||||||
import core, { TDoc, TClass } from '@anticrm/model-core'
|
import core, { TDoc, TClass } from '@anticrm/model-core'
|
||||||
|
|
||||||
@ -76,13 +76,18 @@ export class TActionTarget extends TDoc implements ActionTarget {
|
|||||||
@Model(view.class.Kanban, core.class.Doc, DOMAIN_KANBAN)
|
@Model(view.class.Kanban, core.class.Doc, DOMAIN_KANBAN)
|
||||||
export class TKanban extends TDoc implements Kanban {
|
export class TKanban extends TDoc implements Kanban {
|
||||||
attachedTo!: Ref<Space>
|
attachedTo!: Ref<Space>
|
||||||
sequence!: number
|
|
||||||
states!: Arr<Ref<State>>
|
states!: Arr<Ref<State>>
|
||||||
order!: Arr<Ref<Doc>>
|
order!: Arr<Ref<Doc>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Model(view.class.Sequence, core.class.Doc, DOMAIN_KANBAN)
|
||||||
|
export class TSequence extends TDoc implements Sequence {
|
||||||
|
attachedTo!: Ref<Class<Doc>>
|
||||||
|
sequence!: number
|
||||||
|
}
|
||||||
|
|
||||||
export function createModel (builder: Builder): void {
|
export function createModel (builder: Builder): void {
|
||||||
builder.createModel(TAttributeEditor, TAttributePresenter, TKanbanCard, TObjectEditor, TViewletDescriptor, TViewlet, TAction, TActionTarget, TKanban)
|
builder.createModel(TAttributeEditor, TAttributePresenter, TKanbanCard, TObjectEditor, TViewletDescriptor, TViewlet, TAction, TActionTarget, TKanban, TSequence)
|
||||||
|
|
||||||
builder.mixin(core.class.TypeString, core.class.Class, view.mixin.AttributeEditor, {
|
builder.mixin(core.class.TypeString, core.class.Class, view.mixin.AttributeEditor, {
|
||||||
editor: view.component.StringEditor
|
editor: view.component.StringEditor
|
||||||
@ -126,6 +131,13 @@ export function createModel (builder: Builder): void {
|
|||||||
target: core.class.Doc,
|
target: core.class.Doc,
|
||||||
action: view.action.Delete
|
action: view.action.Delete
|
||||||
})
|
})
|
||||||
|
|
||||||
|
builder.createDoc(core.class.Space, core.space.Model, {
|
||||||
|
name: 'Sequences',
|
||||||
|
description: 'Internal space to store sequence numbers',
|
||||||
|
members: [],
|
||||||
|
private: false
|
||||||
|
}, view.space.Sequence)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default view
|
export default view
|
||||||
|
@ -53,11 +53,11 @@
|
|||||||
if (state === undefined) {
|
if (state === undefined) {
|
||||||
throw new Error('create application: state not found')
|
throw new Error('create application: state not found')
|
||||||
}
|
}
|
||||||
const kanban = await client.findOne(view.class.Kanban, { attachedTo: _space })
|
const sequence = await client.findOne(view.class.Sequence, { attachedTo: recruit.class.Applicant })
|
||||||
if (kanban === undefined) {
|
if (sequence === undefined) {
|
||||||
throw new Error('kanban object not found')
|
throw new Error('sequence object not found')
|
||||||
}
|
}
|
||||||
const incResult = await client.updateDoc(view.class.Kanban, _space, kanban._id, {
|
const incResult = await client.updateDoc(view.class.Sequence, view.space.Sequence, sequence._id, {
|
||||||
$inc: { sequence: 1 }
|
$inc: { sequence: 1 }
|
||||||
}, true)
|
}, true)
|
||||||
const id = await client.createDoc(recruit.class.Applicant, _space, {
|
const id = await client.createDoc(recruit.class.Applicant, _space, {
|
||||||
|
@ -86,11 +86,18 @@ export interface ActionTarget extends Doc {
|
|||||||
*/
|
*/
|
||||||
export interface Kanban extends Doc {
|
export interface Kanban extends Doc {
|
||||||
attachedTo: Ref<Space>
|
attachedTo: Ref<Space>
|
||||||
sequence: number
|
|
||||||
states: Arr<Ref<State>>
|
states: Arr<Ref<State>>
|
||||||
order: Arr<Ref<Doc>>
|
order: Arr<Ref<Doc>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface Sequence extends Doc {
|
||||||
|
attachedTo: Ref<Class<Doc>>
|
||||||
|
sequence: number
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
@ -108,12 +115,16 @@ export default plugin(viewId, {
|
|||||||
Viewlet: '' as Ref<Class<Viewlet>>,
|
Viewlet: '' as Ref<Class<Viewlet>>,
|
||||||
Action: '' as Ref<Class<Action>>,
|
Action: '' as Ref<Class<Action>>,
|
||||||
ActionTarget: '' as Ref<Class<ActionTarget>>,
|
ActionTarget: '' as Ref<Class<ActionTarget>>,
|
||||||
Kanban: '' as Ref<Class<Kanban>>
|
Kanban: '' as Ref<Class<Kanban>>,
|
||||||
|
Sequence: '' as Ref<Class<Sequence>>
|
||||||
},
|
},
|
||||||
viewlet: {
|
viewlet: {
|
||||||
Table: '' as Ref<ViewletDescriptor>,
|
Table: '' as Ref<ViewletDescriptor>,
|
||||||
Kanban: '' as Ref<ViewletDescriptor>
|
Kanban: '' as Ref<ViewletDescriptor>
|
||||||
},
|
},
|
||||||
|
space: {
|
||||||
|
Sequence: '' as Ref<Space>
|
||||||
|
},
|
||||||
icon: {
|
icon: {
|
||||||
Table: '' as Asset,
|
Table: '' as Asset,
|
||||||
Kanban: '' as Asset
|
Kanban: '' as Asset
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user