Remove serverless functions on soft delete (#9438)
Delete workflow versions serverless functions when soft delete workflow
This commit is contained in:
@ -122,10 +122,10 @@ export class ServerlessFunctionResolver {
|
||||
try {
|
||||
await this.checkFeatureFlag(workspaceId);
|
||||
|
||||
return await this.serverlessFunctionService.deleteOneServerlessFunction(
|
||||
input.id,
|
||||
return await this.serverlessFunctionService.deleteOneServerlessFunction({
|
||||
id: input.id,
|
||||
workspaceId,
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
serverlessFunctionGraphQLApiExceptionHandler(error);
|
||||
}
|
||||
|
||||
@ -205,7 +205,15 @@ export class ServerlessFunctionService {
|
||||
});
|
||||
}
|
||||
|
||||
async deleteOneServerlessFunction(id: string, workspaceId: string) {
|
||||
async deleteOneServerlessFunction({
|
||||
id,
|
||||
workspaceId,
|
||||
isHardDeletion = true,
|
||||
}: {
|
||||
id: string;
|
||||
workspaceId: string;
|
||||
isHardDeletion?: boolean;
|
||||
}) {
|
||||
const existingServerlessFunction =
|
||||
await this.serverlessFunctionRepository.findOneBy({
|
||||
id,
|
||||
@ -219,16 +227,17 @@ export class ServerlessFunctionService {
|
||||
);
|
||||
}
|
||||
|
||||
await this.serverlessFunctionRepository.delete(id);
|
||||
if (isHardDeletion) {
|
||||
await this.serverlessFunctionRepository.delete(id);
|
||||
await this.fileStorageService.delete({
|
||||
folderPath: getServerlessFolder({
|
||||
serverlessFunction: existingServerlessFunction,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
await this.serverlessService.delete(existingServerlessFunction);
|
||||
|
||||
await this.fileStorageService.delete({
|
||||
folderPath: getServerlessFolder({
|
||||
serverlessFunction: existingServerlessFunction,
|
||||
}),
|
||||
});
|
||||
|
||||
return existingServerlessFunction;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user