mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-27 01:13:27 +03:00
introduce EmployeeAccount
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
f1f254b104
commit
12e49add3f
@ -103,14 +103,15 @@ program
|
||||
const url = new URL(`/${token}`, transactorUrl)
|
||||
const contrib = await createContributingClient(url.href)
|
||||
const txop = new TxOperations(contrib, core.account.System)
|
||||
await txop.createDoc(contact.class.Employee, contact.space.Employee, {
|
||||
const employee = await txop.createDoc(contact.class.Employee, contact.space.Employee, {
|
||||
firstName: account.first,
|
||||
lastName: account.last,
|
||||
city: 'Mountain View',
|
||||
channels: []
|
||||
})
|
||||
await txop.createDoc(core.class.Account, core.space.Model, {
|
||||
email
|
||||
await txop.createDoc(contact.class.EmployeeAccount, core.space.Model, {
|
||||
email,
|
||||
employee
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -13,13 +13,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import type { Domain, Type } from '@anticrm/core'
|
||||
import type { Domain, Type, Ref } from '@anticrm/core'
|
||||
import { DOMAIN_MODEL } from '@anticrm/core'
|
||||
import { Builder, Model, Prop, TypeString, UX } from '@anticrm/model'
|
||||
import type { IntlString, Asset } from '@anticrm/platform'
|
||||
|
||||
import core, { TDoc, TType } from '@anticrm/model-core'
|
||||
import type { Contact, Person, Organization, Employee, Channel, ChannelProvider } from '@anticrm/contact'
|
||||
import core, { TAccount, TDoc, TType } from '@anticrm/model-core'
|
||||
import type { Contact, Person, Organization, Employee, Channel, ChannelProvider, EmployeeAccount } from '@anticrm/contact'
|
||||
|
||||
import view from '@anticrm/model-view'
|
||||
import { ids as contact } from './plugin'
|
||||
@ -77,8 +77,13 @@ export class TOrganization extends TContact implements Organization {
|
||||
export class TEmployee extends TPerson implements Employee {
|
||||
}
|
||||
|
||||
@Model(contact.class.EmployeeAccount, core.class.Account)
|
||||
export class TEmployeeAccount extends TAccount implements EmployeeAccount {
|
||||
employee!: Ref<Employee>
|
||||
}
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
builder.createModel(TChannelProvider, TTypeChannels, TContact, TPerson, TOrganization, TEmployee)
|
||||
builder.createModel(TChannelProvider, TTypeChannels, TContact, TPerson, TOrganization, TEmployee, TEmployeeAccount)
|
||||
|
||||
builder.mixin(contact.class.TypeChannels, core.class.Class, view.mixin.AttributePresenter, {
|
||||
presenter: contact.component.ChannelsPresenter
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
import { plugin } from '@anticrm/platform'
|
||||
import type { Plugin, Asset } from '@anticrm/platform'
|
||||
import type { Doc, Ref, Class, UXObject, Space } from '@anticrm/core'
|
||||
import type { Doc, Ref, Class, UXObject, Space, Account } from '@anticrm/core'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -61,7 +61,13 @@ export interface Organization extends Contact {
|
||||
* @public
|
||||
*/
|
||||
export interface Employee extends Person {
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface EmployeeAccount extends Account {
|
||||
employee: Ref<Employee>
|
||||
}
|
||||
|
||||
/**
|
||||
@ -75,7 +81,8 @@ export default plugin(contactId, {
|
||||
Contact: '' as Ref<Class<Contact>>,
|
||||
Person: '' as Ref<Class<Person>>,
|
||||
Organization: '' as Ref<Class<Organization>>,
|
||||
Employee: '' as Ref<Class<Employee>>
|
||||
Employee: '' as Ref<Class<Employee>>,
|
||||
EmployeeAccount: '' as Ref<Class<EmployeeAccount>>
|
||||
},
|
||||
icon: {
|
||||
Phone: '' as Asset,
|
||||
|
Loading…
Reference in New Issue
Block a user