introduce DocWithState

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-10-10 11:24:33 +02:00
parent 671723fdbe
commit 2586143433
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
9 changed files with 935 additions and 882 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@
import { Builder } from '@anticrm/model'
import core from './component'
import { TAttribute, TClass, TDoc, TMixin, TObj, TType, TTypeString, TTypeBoolean, TTypeTimestamp } from './core'
import { TSpace, TAccount, TState, TSpaceWithStates } from './security'
import { TSpace, TAccount, TState, TSpaceWithStates, TDocWithState } from './security'
import { TTx, TTxCreateDoc, TTxMixin, TTxUpdateDoc, TTxCUD, TTxPutBag, TTxRemoveDoc, TTxBulkWrite } from './tx'
export * from './core'
@ -39,6 +39,7 @@ export function createModel (builder: Builder): void {
TTxRemoveDoc,
TTxBulkWrite,
TSpace,
TDocWithState,
TSpaceWithStates,
TAccount,
TAttribute,

View File

@ -45,6 +45,12 @@ export class TState extends TDoc implements State {
color!: string
}
@Model(core.class.DocWithState, core.class.Doc)
export class TDocWithState extends TDoc {
@Prop(TypeString(), 'State' as IntlString)
state!: Ref<State>
}
@Model(core.class.SpaceWithStates, core.class.Space)
export class TSpaceWithStates extends TSpace {
}

View File

@ -15,8 +15,8 @@
import type { IntlString } from '@anticrm/platform'
import { Builder, Model, UX, Prop, TypeString, TypeBoolean, Bag as TypeBag } from '@anticrm/model'
import type { Ref, FindOptions, Doc, Domain, State, Bag } from '@anticrm/core'
import core, { TSpace, TSpaceWithStates, TDoc } from '@anticrm/model-core'
import type { Ref, FindOptions, Doc, Domain, Bag } from '@anticrm/core'
import core, { TSpace, TSpaceWithStates, TDocWithState } from '@anticrm/model-core'
import type { Vacancy, Candidates, Candidate, Applicant } from '@anticrm/recruit'
import type { Attachment } from '@anticrm/chunter'
@ -56,16 +56,13 @@ export class TCandidate extends TPerson implements Candidate {
remote?: boolean
}
@Model(recruit.class.Applicant, core.class.Doc, DOMAIN_RECRUIT)
export class TApplicant extends TDoc implements Applicant {
@Model(recruit.class.Applicant, core.class.DocWithState, DOMAIN_RECRUIT)
export class TApplicant extends TDocWithState implements Applicant {
@Prop(TypeString(), 'Candidate' as IntlString)
candidate!: Ref<Candidate>
@Prop(TypeBag(), 'Attachments' as IntlString)
attachments!: Bag<Attachment>
@Prop(TypeString(), 'State' as IntlString)
state!: Ref<State>
}
export function createModel (builder: Builder): void {

View File

@ -204,6 +204,13 @@ export interface State extends Doc {
color: string
}
/**
* @public
*/
export interface DocWithState extends Doc {
state: Ref<State>
}
/**
* @public
*/

View File

@ -14,7 +14,7 @@
//
import type { Plugin, StatusCode } from '@anticrm/platform'
import { plugin } from '@anticrm/platform'
import type { Account, Class, Doc, Obj, Ref, Space, AnyAttribute, State, Type, PropertyType, SpaceWithStates, Timestamp } from './classes'
import type { Account, Class, Doc, Obj, Ref, Space, AnyAttribute, State, Type, PropertyType, SpaceWithStates, Timestamp, DocWithState } from './classes'
import type { Tx, TxBulkWrite, TxCreateDoc, TxCUD, TxMixin, TxPutBag, TxRemoveDoc, TxUpdateDoc } from './tx'
/**
@ -38,6 +38,7 @@ export default plugin(coreId, {
TxPutBag: '' as Ref<Class<TxPutBag<PropertyType>>>,
Space: '' as Ref<Class<Space>>,
SpaceWithStates: '' as Ref<Class<SpaceWithStates>>,
DocWithState: '' as Ref<Class<DocWithState>>,
Account: '' as Ref<Class<Account>>,
State: '' as Ref<Class<State>>,
TypeString: '' as Ref<Class<Type<string>>>,

View File

@ -15,7 +15,7 @@
import { plugin } from '@anticrm/platform'
import type { Plugin, Asset } from '@anticrm/platform'
import type { Space, SpaceWithStates, Doc, Ref, State, Bag, Class } from '@anticrm/core'
import type { Space, SpaceWithStates, DocWithState, Ref, Bag, Class } from '@anticrm/core'
import type { Person } from '@anticrm/contact'
import type { Attachment } from '@anticrm/chunter'
@ -43,9 +43,8 @@ export interface Candidate extends Person {
/**
* @public
*/
export interface Applicant extends Doc {
export interface Applicant extends DocWithState {
candidate: Ref<Candidate>
state: Ref<State>
attachments: Bag<Attachment>
}

File diff suppressed because it is too large Load Diff