mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +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 {
|
||||
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, {
|
||||
presenter: contact.component.PersonPresenter
|
||||
})
|
||||
|
@ -14,7 +14,7 @@
|
||||
//
|
||||
|
||||
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 type { AnyComponent } from '@anticrm/ui'
|
||||
import {} from '@anticrm/core'
|
||||
@ -25,5 +25,8 @@ export const ids = mergeIds(contactId, contact, {
|
||||
},
|
||||
class: {
|
||||
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)
|
||||
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/model": "~0.6.0",
|
||||
"@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 core from '@anticrm/core'
|
||||
import contact from '@anticrm/model-contact'
|
||||
import recruit from '@anticrm/model-recruit'
|
||||
|
||||
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, {
|
||||
firstName: 'Andrey',
|
||||
lastName: 'P.',
|
||||
|
@ -153,7 +153,7 @@ describe('memdb', () => {
|
||||
private: false,
|
||||
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 } })
|
||||
const txSpace = await model.findAll(core.class.Space, { _id: space })
|
||||
expect(txSpace[0].members).toEqual(expect.arrayContaining([account]))
|
||||
|
@ -175,4 +175,6 @@ export interface Space extends Doc {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Account extends Doc {}
|
||||
export interface Account extends Doc {
|
||||
email: string
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user