@ -6,6 +6,7 @@ import { z } from 'zod'
|
||||
import { isWriteTypebotForbidden } from '../helpers/isWriteTypebotForbidden'
|
||||
import { archiveResults } from '@typebot.io/results/archiveResults'
|
||||
import { removeObjectsFromTypebot } from '@typebot.io/lib/s3/removeObjectsRecursively'
|
||||
import { env } from '@typebot.io/env'
|
||||
|
||||
export const deleteTypebot = authenticatedProcedure
|
||||
.meta({
|
||||
@ -86,10 +87,11 @@ export const deleteTypebot = authenticatedProcedure
|
||||
where: { id: typebotId },
|
||||
data: { isArchived: true, publicId: null, customDomain: null },
|
||||
})
|
||||
await removeObjectsFromTypebot({
|
||||
workspaceId: existingTypebot.workspace.id,
|
||||
typebotId,
|
||||
})
|
||||
if (env.S3_BUCKET)
|
||||
await removeObjectsFromTypebot({
|
||||
workspaceId: existingTypebot.workspace.id,
|
||||
typebotId,
|
||||
})
|
||||
return {
|
||||
message: 'success',
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ export const deleteWorkspace = authenticatedProcedure
|
||||
where: { id: workspaceId },
|
||||
})
|
||||
|
||||
await removeObjectsFromWorkspace(workspaceId)
|
||||
if (env.S3_BUCKET) await removeObjectsFromWorkspace(workspaceId)
|
||||
|
||||
if (isNotEmpty(workspace.stripeId) && env.STRIPE_SECRET_KEY) {
|
||||
const stripe = new Stripe(env.STRIPE_SECRET_KEY, {
|
||||
|
Reference in New Issue
Block a user