mirror of
https://github.com/hcengineering/platform.git
synced 2025-03-20 14:01:51 +00:00
fix: get rid of removeAllObjects by prefix (#6479)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
32335e066b
commit
f7d831a756
@ -176,11 +176,11 @@ export function createDummyStorageAdapter (): StorageAdapter {
|
||||
export async function removeAllObjects (
|
||||
ctx: MeasureContext,
|
||||
storage: StorageAdapter,
|
||||
workspaceId: WorkspaceId,
|
||||
prefix?: string
|
||||
workspaceId: WorkspaceId
|
||||
): Promise<void> {
|
||||
ctx.warn('removing all objects from workspace', { workspaceId })
|
||||
// We need to list all files and delete them
|
||||
const iterator = await storage.listStream(ctx, workspaceId, prefix)
|
||||
const iterator = await storage.listStream(ctx, workspaceId)
|
||||
let bulk: string[] = []
|
||||
while (true) {
|
||||
const obj = await iterator.next()
|
||||
|
@ -47,7 +47,7 @@ import core, {
|
||||
} from '@hcengineering/core'
|
||||
import notification, { Collaborators } from '@hcengineering/notification'
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
import serverCore, { TriggerControl, removeAllObjects } from '@hcengineering/server-core'
|
||||
import serverCore, { TriggerControl } from '@hcengineering/server-core'
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
|
||||
export async function OnSpaceTypeMembers (tx: Tx, control: TriggerControl): Promise<Tx[]> {
|
||||
@ -181,12 +181,6 @@ export async function OnContactDelete (
|
||||
return []
|
||||
}
|
||||
|
||||
if (removeContact.avatar == null) {
|
||||
return []
|
||||
}
|
||||
|
||||
await removeAllObjects(ctx, storageAdapter, workspace, removeContact.avatar)
|
||||
|
||||
const result: Tx[] = []
|
||||
|
||||
const members = await findAll(contact.class.Member, { contact: removeContact._id })
|
||||
|
@ -17,7 +17,7 @@
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { MeasureContext, Blob as PlatformBlob, WorkspaceId, metricsAggregate, type Ref } from '@hcengineering/core'
|
||||
import { Token, decodeToken } from '@hcengineering/server-token'
|
||||
import { StorageAdapter, removeAllObjects } from '@hcengineering/storage'
|
||||
import { StorageAdapter } from '@hcengineering/storage'
|
||||
import bp from 'body-parser'
|
||||
import cors from 'cors'
|
||||
import express, { Request, Response } from 'express'
|
||||
@ -545,10 +545,6 @@ export function start (
|
||||
// TODO: We need to allow delete only of user attached documents. (https://front.hc.engineering/workbench/platform/tracker/TSK-1081)
|
||||
await config.storageAdapter.remove(ctx, payload.workspace, [uuid])
|
||||
|
||||
// TODO: Add support for related documents.
|
||||
// TODO: Move support of image resize/format change to separate place.
|
||||
await removeAllObjects(ctx, config.storageAdapter, payload.workspace, uuid)
|
||||
|
||||
res.status(200).send()
|
||||
} catch (error: any) {
|
||||
Analytics.handleError(error)
|
||||
|
Loading…
Reference in New Issue
Block a user