mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-12 19:30:52 +00:00
Change channel domain (#1007)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
4c60b40eb3
commit
f5fcc5fa3d
@ -32,6 +32,7 @@ import type { Asset, IntlString } from '@anticrm/platform'
|
||||
import { ids as contact } from './plugin'
|
||||
|
||||
export const DOMAIN_CONTACT = 'contact' as Domain
|
||||
export const DOMAIN_CHANNEL = 'channel' as Domain
|
||||
|
||||
@Model(contact.class.ChannelProvider, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TChannelProvider extends TDoc implements ChannelProvider {
|
||||
@ -41,7 +42,7 @@ export class TChannelProvider extends TDoc implements ChannelProvider {
|
||||
}
|
||||
|
||||
@Model(contact.class.Contact, core.class.Doc, DOMAIN_CONTACT)
|
||||
@UX('Contact' as IntlString, contact.icon.Person, undefined, 'name')
|
||||
@UX(contact.string.Contact, contact.icon.Person, undefined, 'name')
|
||||
export class TContact extends TDoc implements Contact {
|
||||
@Prop(TypeString(), 'Name' as IntlString)
|
||||
@Index(IndexKind.FullText)
|
||||
@ -58,18 +59,18 @@ export class TContact extends TDoc implements Contact {
|
||||
@Prop(Collection(chunter.class.Comment), chunter.string.Comments)
|
||||
comments?: number
|
||||
|
||||
@Prop(TypeString(), 'Location' as IntlString)
|
||||
@Prop(TypeString(), contact.string.Location)
|
||||
@Index(IndexKind.FullText)
|
||||
city!: string
|
||||
}
|
||||
|
||||
@Model(contact.class.Channel, core.class.AttachedDoc, DOMAIN_CONTACT)
|
||||
@UX('Channel' as IntlString, contact.icon.Person, undefined, 'modifiedOn')
|
||||
@Model(contact.class.Channel, core.class.AttachedDoc, DOMAIN_CHANNEL)
|
||||
@UX(contact.string.Channel, contact.icon.Person, undefined, 'modifiedOn')
|
||||
export class TChannel extends TAttachedDoc implements Channel {
|
||||
@Prop(TypeRef(contact.class.ChannelProvider), 'Channel provider' as IntlString)
|
||||
@Prop(TypeRef(contact.class.ChannelProvider), contact.string.ChannelProvider)
|
||||
provider!: Ref<ChannelProvider>
|
||||
|
||||
@Prop(TypeString(), 'Value' as IntlString)
|
||||
@Prop(TypeString(), contact.string.Value)
|
||||
@Index(IndexKind.FullText)
|
||||
value!: string
|
||||
|
||||
@ -77,15 +78,15 @@ export class TChannel extends TAttachedDoc implements Channel {
|
||||
}
|
||||
|
||||
@Model(contact.class.Person, contact.class.Contact)
|
||||
@UX('Person' as IntlString, contact.icon.Person, undefined, 'name')
|
||||
@UX(contact.string.Person, contact.icon.Person, undefined, 'name')
|
||||
export class TPerson extends TContact implements Person {}
|
||||
|
||||
@Model(contact.class.Organization, contact.class.Contact)
|
||||
@UX('Organization' as IntlString, contact.icon.Company, undefined, 'name')
|
||||
@UX(contact.string.Organization, contact.icon.Company, undefined, 'name')
|
||||
export class TOrganization extends TContact implements Organization {}
|
||||
|
||||
@Model(contact.class.Employee, contact.class.Person)
|
||||
@UX('Employee' as IntlString, contact.icon.Person)
|
||||
@UX(contact.string.Employee, contact.icon.Person)
|
||||
export class TEmployee extends TPerson implements Employee {}
|
||||
|
||||
@Model(contact.class.EmployeeAccount, core.class.Account)
|
||||
|
@ -18,7 +18,7 @@ import { Channel, ChannelProvider, Contact } from '@anticrm/contact'
|
||||
import { Class, DOMAIN_TX, generateId, Ref, SortingOrder, TxCreateDoc, TxCUD, TxRemoveDoc, TxUpdateDoc } from '@anticrm/core'
|
||||
import { MigrateOperation, MigrationClient, MigrationUpgradeClient } from '@anticrm/model'
|
||||
import core from '@anticrm/model-core'
|
||||
import contact, { DOMAIN_CONTACT } from './index'
|
||||
import contact, { DOMAIN_CHANNEL, DOMAIN_CONTACT } from './index'
|
||||
|
||||
function createChannel (tx: TxCUD<Contact>, channel: any): Channel {
|
||||
const doc: Channel = {
|
||||
@ -203,10 +203,15 @@ export async function migrateContactChannels (client: MigrationClient, classes:
|
||||
}
|
||||
}
|
||||
|
||||
async function migrateChannelsDomain (client: MigrationClient): Promise<void> {
|
||||
await client.move(DOMAIN_CONTACT, { _class: contact.class.Channel }, DOMAIN_CHANNEL)
|
||||
}
|
||||
|
||||
export const contactOperation: MigrateOperation = {
|
||||
async migrate (client: MigrationClient): Promise<void> {
|
||||
const classes = [contact.class.Contact, contact.class.Person, contact.class.Employee, contact.class.Organization]
|
||||
await migrateContactChannels(client, classes)
|
||||
await migrateChannelsDomain(client)
|
||||
},
|
||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||
}
|
||||
|
@ -49,7 +49,15 @@ export const ids = mergeIds(contactId, contact, {
|
||||
SearchEmployee: '' as IntlString,
|
||||
SearchPerson: '' as IntlString,
|
||||
SearchOrganization: '' as IntlString,
|
||||
ContactInfo: '' as IntlString
|
||||
ContactInfo: '' as IntlString,
|
||||
Contact: '' as IntlString,
|
||||
Location: '' as IntlString,
|
||||
Channel: '' as IntlString,
|
||||
ChannelProvider: '' as IntlString,
|
||||
Person: '' as IntlString,
|
||||
Organization: '' as IntlString,
|
||||
Employee: '' as IntlString,
|
||||
Value: '' as IntlString
|
||||
},
|
||||
completion: {
|
||||
PersonQuery: '' as Resource<ObjectSearchFactory>,
|
||||
|
@ -24,6 +24,14 @@
|
||||
"SearchEmployee": "Search for employee...",
|
||||
"SearchPerson": "Search for person...",
|
||||
"SearchOrganization": "Search for organization...",
|
||||
"ContactInfo": "Contact Info"
|
||||
"ContactInfo": "Contact Info",
|
||||
"Contact": "Contact",
|
||||
"Location": "Location",
|
||||
"Channel": "Channel",
|
||||
"ChannelProvider": "Channel provider",
|
||||
"Person": "Person",
|
||||
"Organization": "Organization",
|
||||
"Employee": "Employee",
|
||||
"Value": "Value"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user