mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 11:31:57 +03:00
parent
89c22a92fa
commit
c8f37bb496
File diff suppressed because it is too large
Load Diff
@ -60,6 +60,13 @@ export class TEmployee extends TPerson implements Employee {
|
|||||||
export function createModel (builder: Builder): void {
|
export function createModel (builder: Builder): void {
|
||||||
builder.createModel(TContact, TPerson, TOrganization, TEmployee)
|
builder.createModel(TContact, TPerson, TOrganization, TEmployee)
|
||||||
|
|
||||||
|
builder.createDoc(core.class.Space, core.space.Model, {
|
||||||
|
name: 'Employees',
|
||||||
|
description: 'Employees',
|
||||||
|
private: false,
|
||||||
|
members: []
|
||||||
|
}, contact.space.Employee)
|
||||||
|
|
||||||
builder.mixin(contact.class.Person, core.class.Class, view.mixin.AttributePresenter, {
|
builder.mixin(contact.class.Person, core.class.Class, view.mixin.AttributePresenter, {
|
||||||
presenter: contact.component.PersonPresenter
|
presenter: contact.component.PersonPresenter
|
||||||
})
|
})
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import { mergeIds } from '@anticrm/platform'
|
import { mergeIds } from '@anticrm/platform'
|
||||||
import type { Ref, Class } from '@anticrm/core'
|
import type { Ref, Class, Space } from '@anticrm/core'
|
||||||
import contact, { contactId, Employee } from '@anticrm/contact'
|
import contact, { contactId, Employee } from '@anticrm/contact'
|
||||||
import type { AnyComponent } from '@anticrm/ui'
|
import type { AnyComponent } from '@anticrm/ui'
|
||||||
import {} from '@anticrm/core'
|
import {} from '@anticrm/core'
|
||||||
@ -25,5 +25,8 @@ export const ids = mergeIds(contactId, contact, {
|
|||||||
},
|
},
|
||||||
class: {
|
class: {
|
||||||
Employee: '' as Ref<Class<Employee>>
|
Employee: '' as Ref<Class<Employee>>
|
||||||
|
},
|
||||||
|
space: {
|
||||||
|
Employee: '' as Ref<Space>
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -30,4 +30,6 @@ export class TSpace extends TDoc implements Space {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Model(core.class.Account, core.class.Doc, DOMAIN_MODEL)
|
@Model(core.class.Account, core.class.Doc, DOMAIN_MODEL)
|
||||||
export class TAccount extends TDoc implements Account {}
|
export class TAccount extends TDoc implements Account {
|
||||||
|
email!: string
|
||||||
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
"@anticrm/core": "~0.6.7",
|
"@anticrm/core": "~0.6.7",
|
||||||
"@anticrm/model": "~0.6.0",
|
"@anticrm/model": "~0.6.0",
|
||||||
"@anticrm/platform": "~0.6.3",
|
"@anticrm/platform": "~0.6.3",
|
||||||
"@anticrm/model-recruit":"~0.6.0"
|
"@anticrm/model-recruit": "~0.6.0",
|
||||||
|
"@anticrm/model-contact": "~0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,35 @@
|
|||||||
|
|
||||||
import { Builder } from '@anticrm/model'
|
import { Builder } from '@anticrm/model'
|
||||||
|
|
||||||
|
import core from '@anticrm/core'
|
||||||
|
import contact from '@anticrm/model-contact'
|
||||||
import recruit from '@anticrm/model-recruit'
|
import recruit from '@anticrm/model-recruit'
|
||||||
|
|
||||||
export function createDemo (builder: Builder): void {
|
export function createDemo (builder: Builder): void {
|
||||||
|
builder.createDoc(contact.class.Employee, contact.space.Employee, {
|
||||||
|
firstName: 'Rosamund',
|
||||||
|
lastName: 'Chen',
|
||||||
|
email: 'rosamund@hc.engineering',
|
||||||
|
phone: '+1 655 912 3424',
|
||||||
|
city: 'Mountain View'
|
||||||
|
})
|
||||||
|
|
||||||
|
builder.createDoc(core.class.Account, core.space.Model, {
|
||||||
|
email: 'rosamund@hc.engineering'
|
||||||
|
})
|
||||||
|
|
||||||
|
builder.createDoc(contact.class.Employee, contact.space.Employee, {
|
||||||
|
firstName: 'Elon',
|
||||||
|
lastName: 'Musk',
|
||||||
|
email: 'elon@hc.engineering',
|
||||||
|
phone: '+1 655 843 3453',
|
||||||
|
city: 'Bel Air'
|
||||||
|
})
|
||||||
|
|
||||||
|
builder.createDoc(core.class.Account, core.space.Model, {
|
||||||
|
email: 'elon@hc.engineering'
|
||||||
|
})
|
||||||
|
|
||||||
builder.createDoc(recruit.class.Candidate, recruit.space.CandidatesPublic, {
|
builder.createDoc(recruit.class.Candidate, recruit.space.CandidatesPublic, {
|
||||||
firstName: 'Andrey',
|
firstName: 'Andrey',
|
||||||
lastName: 'P.',
|
lastName: 'P.',
|
||||||
|
@ -153,7 +153,7 @@ describe('memdb', () => {
|
|||||||
private: false,
|
private: false,
|
||||||
members: []
|
members: []
|
||||||
})
|
})
|
||||||
const account = await model.createDoc(core.class.Account, core.space.Model, {})
|
const account = await model.createDoc(core.class.Account, core.space.Model, { email: 'email' })
|
||||||
await model.updateDoc(core.class.Space, core.space.Model, space, { $push: { members: account } })
|
await model.updateDoc(core.class.Space, core.space.Model, space, { $push: { members: account } })
|
||||||
const txSpace = await model.findAll(core.class.Space, { _id: space })
|
const txSpace = await model.findAll(core.class.Space, { _id: space })
|
||||||
expect(txSpace[0].members).toEqual(expect.arrayContaining([account]))
|
expect(txSpace[0].members).toEqual(expect.arrayContaining([account]))
|
||||||
|
@ -175,4 +175,6 @@ export interface Space extends Doc {
|
|||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface Account extends Doc {}
|
export interface Account extends Doc {
|
||||||
|
email: string
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user