mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-12 19:30:52 +00:00
Multiple fixes (#820)
Signed-off-by: Ilya Sumbatyants <ilya.sumb@gmail.com>
This commit is contained in:
parent
50a9fc9980
commit
e8c26c46a8
@ -16,7 +16,7 @@
|
||||
|
||||
import client, { ClientSocket } from '@anticrm/client'
|
||||
import type { Class, ClientConnection, Doc, DocumentQuery, FindOptions, FindResult, Ref, Tx, TxHander, TxResult } from '@anticrm/core'
|
||||
import { getMetadata, readResponse, ReqId, serialize } from '@anticrm/platform'
|
||||
import { getMetadata, PlatformError, readResponse, ReqId, serialize } from '@anticrm/platform'
|
||||
|
||||
class DeferredPromise {
|
||||
readonly promise: Promise<any>
|
||||
@ -61,7 +61,7 @@ class Connection implements ClientConnection {
|
||||
if (promise === undefined) { throw new Error(`unknown response id: ${resp.id}`) }
|
||||
this.requests.delete(resp.id)
|
||||
if (resp.error !== undefined) {
|
||||
promise.reject(resp.error)
|
||||
promise.reject(new PlatformError(resp.error))
|
||||
} else {
|
||||
promise.resolve(resp.result)
|
||||
}
|
||||
|
@ -49,16 +49,15 @@
|
||||
|
||||
async function createPerson () {
|
||||
const uploadFile = await getResource(attachment.helper.UploadFile)
|
||||
const avatarUUID = avatar !== undefined
|
||||
? await uploadFile(avatar)
|
||||
: undefined
|
||||
const avatarProp = avatar !== undefined
|
||||
? { avatar: await uploadFile(avatar) }
|
||||
: {}
|
||||
|
||||
console.warn('avatar', avatar, avatarUUID)
|
||||
const person: Data<Person> = {
|
||||
name: combineName(firstName, lastName),
|
||||
city: object.city,
|
||||
avatar: avatarUUID,
|
||||
channels: object.channels
|
||||
channels: object.channels,
|
||||
...avatarProp
|
||||
}
|
||||
|
||||
await client.createDoc(contact.class.Person, contact.space.Contacts, person)
|
||||
|
@ -50,14 +50,14 @@
|
||||
|
||||
async function createCandidate () {
|
||||
const uploadFile = await getResource(attachment.helper.UploadFile)
|
||||
const avatarUUID = avatar !== undefined
|
||||
? await uploadFile(avatar)
|
||||
: undefined
|
||||
const avatarProp = avatar !== undefined
|
||||
? { avatar: await uploadFile(avatar) }
|
||||
: {}
|
||||
const candidate: Data<Person> = {
|
||||
name: combineName(firstName, lastName),
|
||||
city: object.city,
|
||||
channels: object.channels,
|
||||
avatar: avatarUUID
|
||||
...avatarProp
|
||||
}
|
||||
const candidateData: MixinData<Person, Candidate> = {
|
||||
title: object.title,
|
||||
@ -92,7 +92,7 @@
|
||||
try {
|
||||
const uploadFile = await getResource(attachment.helper.UploadFile)
|
||||
|
||||
resume.uuid = await uploadFile(file, space, candidateId)
|
||||
resume.uuid = await uploadFile(file, contact.space.Contacts, candidateId)
|
||||
resume.name = file.name
|
||||
resume.size = file.size
|
||||
resume.type = file.type
|
||||
|
@ -153,6 +153,15 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function onConnectClose (res: any): Promise<void> {
|
||||
if (res?.value) {
|
||||
await client.createDoc(setting.class.Integration, accountId as string as Ref<Space>, {
|
||||
type: telegram.integrationType.Telegram,
|
||||
value: res.value
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex-between header">
|
||||
@ -200,7 +209,7 @@
|
||||
label={'Connect'}
|
||||
primary
|
||||
on:click={(e) => {
|
||||
showPopup(Connect, {}, e.target)
|
||||
showPopup(Connect, {}, e.target, onConnectClose)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -17,8 +17,7 @@
|
||||
import type { Class, Doc, DocumentQuery, Ref, TxResult } from '@anticrm/core'
|
||||
import type { FullTextAdapter, IndexedDoc } from '@anticrm/server-core'
|
||||
|
||||
import { Client } from '@elastic/elasticsearch'
|
||||
|
||||
import { Client, errors as esErr } from '@elastic/elasticsearch'
|
||||
class ElasticAdapter implements FullTextAdapter {
|
||||
constructor (private readonly client: Client, private readonly db: string) {}
|
||||
|
||||
@ -113,10 +112,18 @@ class ElasticAdapter implements FullTextAdapter {
|
||||
}
|
||||
|
||||
async remove (id: Ref<Doc>): Promise<void> {
|
||||
await this.client.delete({
|
||||
index: this.db,
|
||||
id
|
||||
})
|
||||
try {
|
||||
await this.client.delete({
|
||||
index: this.db,
|
||||
id
|
||||
})
|
||||
} catch (e: any) {
|
||||
if (e instanceof esErr.ResponseError && e.meta.statusCode === 404) {
|
||||
return
|
||||
}
|
||||
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user