initial AttachmentPresenter

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-08-31 16:54:47 +02:00
parent c728103e68
commit ac87b6c82a
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0
12 changed files with 508 additions and 377 deletions

File diff suppressed because it is too large Load Diff

View File

@ -110,4 +110,8 @@ export function createModel (builder: Builder): void {
private: false,
members: []
})
builder.mixin(chunter.class.Attachment, core.class.Class, view.mixin.AttributePresenter, {
presenter: chunter.component.AttachmentPresenter
})
}

View File

@ -19,8 +19,12 @@ import type { IntlString } from '@anticrm/platform'
import { mergeIds } from '@anticrm/platform'
import type { Ref } from '@anticrm/core'
import { ViewletDescriptor } from '@anticrm/view'
import type { AnyComponent } from '@anticrm/ui'
export default mergeIds(chunterId, chunter, {
component: {
AttachmentPresenter: '' as AnyComponent
},
string: {
ApplicationLabelChunter: '' as IntlString
},

View File

@ -27,6 +27,7 @@
"@anticrm/model-workbench": "~0.6.1",
"@anticrm/model-contact": "~0.6.0",
"@anticrm/recruit": "~0.6.0",
"@anticrm/recruit-resources": "~0.6.0"
"@anticrm/recruit-resources": "~0.6.0",
"@anticrm/chunter": "~0.6.0"
}
}

View File

@ -18,13 +18,15 @@ import { Builder, Model, UX, Prop, TypeString } from '@anticrm/model'
import type { Ref, FindOptions, Doc, Domain } from '@anticrm/core'
import core, { TSpace, TDoc } from '@anticrm/model-core'
import type { Vacancy, Candidates, Candidate, Applicant } from '@anticrm/recruit'
import type { Attachment } from '@anticrm/chunter'
import workbench from '@anticrm/model-workbench'
import view from '@anticrm/model-view'
import contact, { TPerson } from '@anticrm/model-contact'
import recruit from './plugin'
import { Person } from '@anticrm/contact'
import chunter from '@anticrm/chunter'
import type { Person } from '@anticrm/contact'
export const DOMAIN_RECRUIT = 'recruit' as Domain
@ -38,7 +40,10 @@ export class TCandidates extends TSpace implements Candidates {}
@Model(recruit.class.Candidate, contact.class.Person)
@UX('Candidate' as IntlString)
export class TCandidate extends TPerson implements Candidate {}
export class TCandidate extends TPerson implements Candidate {
@Prop(TypeString(), 'Resume' as IntlString)
resume?: Ref<Attachment>
}
@Model(recruit.class.Applicant, core.class.Doc, DOMAIN_RECRUIT)
export class TApplicant extends TDoc implements Applicant {
@ -94,7 +99,13 @@ export function createModel (builder: Builder): void {
attachTo: recruit.class.Candidate,
descriptor: view.viewlet.Table,
open: recruit.component.EditCandidate,
config: ['', 'channels', 'city']
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
options: {
lookup: {
resume: chunter.class.Attachment
}
} as FindOptions<Doc>, // TODO: fix
config: ['', '$lookup.resume', 'channels', 'city']
})
builder.createDoc(view.class.Viewlet, core.space.Model, {
@ -106,7 +117,7 @@ export function createModel (builder: Builder): void {
lookup: {
candidate: recruit.class.Candidate
}
} as FindOptions<Doc>,
} as FindOptions<Doc>, // TODO: fix
config: ['$lookup.candidate', '$lookup.candidate.email', '$lookup.candidate.city']
})
}

View File

@ -84,7 +84,9 @@ export class MemDb extends TxProcessor {
const result: LookupData<T> = {}
for (const key in lookup) {
const id = (doc as any)[key] as Ref<Doc>
(result as any)[key] = this.getObject(id)
if (id !== undefined) {
(result as any)[key] = this.getObject(id)
}
}
withLookup.push(Object.assign({}, doc, { $lookup: result }))
}

View File

@ -0,0 +1,27 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import type { Attachment } from '@anticrm/chunter'
export let value: Attachment
</script>
attachment: {#if value}{value.name}{:else}nothing{/if}

View File

@ -16,11 +16,13 @@
import CreateChannel from './components/CreateChannel.svelte'
import ChannelView from './components/ChannelView.svelte'
import Activity from './components/Activity.svelte'
import AttachmentPresenter from './components/AttachmentPresenter.svelte'
export default async () => ({
component: {
CreateChannel,
ChannelView,
Activity
Activity,
AttachmentPresenter
}
})

View File

@ -16,17 +16,14 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import type { Ref, Space, Doc } from '@anticrm/core'
import { TextArea, EditBox, Dialog, Tabs, Section, Grid } from '@anticrm/ui'
import File from './icons/File.svelte'
import Address from './icons/Address.svelte'
import Attachment from './icons/Attachment.svelte'
import DialogHeader from './DialogHeader.svelte'
import { getClient } from '@anticrm/presentation'
import recruit from '../plugin'
import chunter from '@anticrm/chunter'
import { Candidate } from '@anticrm/recruit'
import type { Candidate } from '@anticrm/recruit'
import type { Attachment } from '@anticrm/chunter'
export let space: Ref<Space>
@ -38,7 +35,7 @@
const newValue = Object.assign({}, object)
let resume = {} as {
id: Ref<Doc> | undefined
id: Ref<Attachment> | undefined
name: string
uuid: string
size: number
@ -54,9 +51,8 @@
const candidateId = await client.createDoc(recruit.class.Candidate, space, {
firstName: newValue.firstName,
lastName: newValue.lastName,
email: '',
phone: '',
city: newValue.city,
channels: [],
})
console.log('resume name', resume.name)
@ -72,6 +68,10 @@
type: resume.type,
size: resume.size,
}, resume.id)
client.updateDoc(recruit.class.Candidate, space, candidateId, {
resume: resume.id
})
}
dispatch('close')

View File

@ -20,6 +20,7 @@
"dependencies": {
"@anticrm/platform":"~0.6.5",
"@anticrm/core":"~0.6.11",
"@anticrm/contact":"~0.6.0"
"@anticrm/contact":"~0.6.0",
"@anticrm/chunter":"~0.6.0"
}
}

View File

@ -17,6 +17,7 @@ import { plugin } from '@anticrm/platform'
import type { Plugin, Asset } from '@anticrm/platform'
import type { Space, Doc, Ref } from '@anticrm/core'
import type { Person } from '@anticrm/contact'
import type { Attachment } from '@anticrm/chunter'
/**
* @public
@ -31,7 +32,9 @@ export interface Candidates extends Space {}
/**
* @public
*/
export interface Candidate extends Person {}
export interface Candidate extends Person {
resume?: Ref<Attachment>
}
/**
* @public

File diff suppressed because it is too large Load Diff