Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
384 changes: 230 additions & 154 deletions dev/storage/src/model.tx.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions models/contact/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
5 changes: 4 additions & 1 deletion models/contact/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -25,5 +25,8 @@ export const ids = mergeIds(contactId, contact, {
},
class: {
Employee: '' as Ref<Class<Employee>>
},
space: {
Employee: '' as Ref<Space>
}
})
4 changes: 3 additions & 1 deletion models/core/src/security.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 2 additions & 1 deletion models/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
26 changes: 26 additions & 0 deletions models/demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/__tests__/memdb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,6 @@ export interface Space extends Doc {
/**
* @public
*/
export interface Account extends Doc {}
export interface Account extends Doc {
email: string
}