add first/last to EmployeeAccount

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov
2021-09-10 21:59:13 +02:00
parent d81e848a5f
commit ef53d5393e
8 changed files with 661 additions and 652 deletions
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -118,7 +118,9 @@ program
console.log('create account in target workspace...')
await txop.createDoc(contact.class.EmployeeAccount, core.space.Model, {
email,
employee
employee,
firstName: account.first,
lastName: account.last
})
contrib.close()
+216 -214
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -80,6 +80,8 @@ export class TEmployee extends TPerson implements Employee {
@Model(contact.class.EmployeeAccount, core.class.Account)
export class TEmployeeAccount extends TAccount implements EmployeeAccount {
employee!: Ref<Employee>
firstName!: string
lastName!: string
}
export function createModel (builder: Builder): void {
+3 -1
View File
@@ -32,7 +32,9 @@ export function createDemo (builder: Builder): void {
builder.createDoc(contact.class.EmployeeAccount, core.space.Model, {
email: 'rosamund@hc.engineering',
employee: rosamund as any
employee: rosamund as any,
firstName: 'Rosamund',
lastName: 'Chen'
})
builder.createDoc(recruit.class.Candidate, recruit.space.CandidatesPublic, {
@@ -25,24 +25,19 @@
export let comment: Comment
let employee: Employee | undefined
let employee: EmployeeAccount | undefined
console.log('comment modified by', comment.modifiedBy)
const client = getClient()
client.findOne(contact.class.EmployeeAccount, { _id: comment.modifiedBy as Ref<EmployeeAccount> })
.then(account => client.findOne(contact.class.Employee, { _id: account?.employee }))
.then(result => {
console.log('comment', result)
employee = result
})
client.findOne(contact.class.EmployeeAccount, { _id: comment.modifiedBy as Ref<EmployeeAccount> }).then(account => {employee = account})
</script>
<div class="flex-nowrap">
<div class="avatar"><Avatar size={'medium'} /></div>
<div class="flex-col-stretch message">
<div class="header">{#if employee}{employee.firstName} {employee.lastName}{/if}<span>July 28th</span></div>
<div class="header">{#if employee}{employee.firstName} {employee.lastName}{/if}<span>{comment.modifiedOn}</span></div>
<div class="text"><MessageViewer message={comment.message} /></div>
</div>
</div>
+2
View File
@@ -68,6 +68,8 @@ export interface Employee extends Person {
*/
export interface EmployeeAccount extends Account {
employee: Ref<Employee>
firstName: string
lastName: string
}
/**
File diff suppressed because it is too large Load Diff