mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 12:47:45 +02:00
UBERF-6161: Storage configuration (#5109)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -24,7 +24,7 @@ import type { TriggerControl } from '@hcengineering/server-core'
|
||||
*/
|
||||
export async function OnAttachmentDelete (
|
||||
tx: Tx,
|
||||
{ findAll, hierarchy, fulltextFx, storageFx, removedMap }: TriggerControl
|
||||
{ findAll, hierarchy, fulltextFx, storageFx, removedMap, ctx }: TriggerControl
|
||||
): Promise<Tx[]> {
|
||||
const rmTx = TxProcessor.extractTx(tx) as TxRemoveDoc<Attachment>
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function OnAttachmentDelete (
|
||||
})
|
||||
|
||||
storageFx(async (adapter, bucket) => {
|
||||
await adapter.remove(bucket, [attach.file])
|
||||
await adapter.remove(ctx, bucket, [attach.file])
|
||||
})
|
||||
|
||||
return []
|
||||
|
||||
@@ -106,12 +106,7 @@ export class CollaborativeContentRetrievalStage implements FullTextPipelineStage
|
||||
if (collaborativeDoc !== undefined && collaborativeDoc !== '') {
|
||||
const { documentId } = parseCollaborativeDoc(collaborativeDoc)
|
||||
|
||||
let docInfo: any | undefined
|
||||
try {
|
||||
docInfo = await this.storageAdapter?.stat(this.workspace, documentId)
|
||||
} catch (err: any) {
|
||||
// not found.
|
||||
}
|
||||
const docInfo: any | undefined = await this.storageAdapter?.stat(this.metrics, this.workspace, documentId)
|
||||
|
||||
if (docInfo !== undefined) {
|
||||
const digest = docInfo.etag
|
||||
@@ -120,7 +115,7 @@ export class CollaborativeContentRetrievalStage implements FullTextPipelineStage
|
||||
;(update as any)[docUpdKey(digestKey)] = digest
|
||||
|
||||
const contentType = ((docInfo.metaData['content-type'] as string) ?? '').split(';')[0]
|
||||
const readable = await this.storageAdapter?.get(this.workspace, documentId)
|
||||
const readable = await this.storageAdapter?.get(this.metrics, this.workspace, documentId)
|
||||
|
||||
if (readable !== undefined) {
|
||||
let textContent = await this.metrics.with(
|
||||
|
||||
@@ -38,7 +38,7 @@ import { workbenchId } from '@hcengineering/workbench'
|
||||
*/
|
||||
export async function OnContactDelete (
|
||||
tx: Tx,
|
||||
{ findAll, hierarchy, storageFx, removedMap, txFactory }: TriggerControl
|
||||
{ findAll, hierarchy, storageFx, removedMap, txFactory, ctx }: TriggerControl
|
||||
): Promise<Tx[]> {
|
||||
const rmTx = tx as TxRemoveDoc<Contact>
|
||||
|
||||
@@ -61,14 +61,15 @@ export async function OnContactDelete (
|
||||
}
|
||||
|
||||
storageFx(async (adapter, bucket) => {
|
||||
await adapter.remove(bucket, [avatar])
|
||||
await adapter.remove(ctx, bucket, [avatar])
|
||||
|
||||
if (avatar != null) {
|
||||
const extra = await adapter.list(bucket, avatar)
|
||||
const extra = await adapter.list(ctx, bucket, avatar)
|
||||
if (extra.length > 0) {
|
||||
await adapter.remove(
|
||||
ctx,
|
||||
bucket,
|
||||
Array.from(extra.entries()).map((it) => it[1].name)
|
||||
Array.from(extra.entries()).map((it) => it[1]._id)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user