3491 launch cleaning cron (#3872)
* Add command to delete incomplete workspaces * Inject command dependencies * Fix command * Do not delete core.workspace * Reorganize files * Delete src/workspace/cron * Fix --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -17,13 +17,15 @@ export class WorkspaceService extends TypeOrmQueryService<Workspace> {
|
||||
super(workspaceRepository);
|
||||
}
|
||||
|
||||
async deleteWorkspace(id: string) {
|
||||
async deleteWorkspace(id: string, shouldDeleteCoreWorkspace = true) {
|
||||
const workspace = await this.workspaceRepository.findOneBy({ id });
|
||||
|
||||
assert(workspace, 'Workspace not found');
|
||||
|
||||
await this.workspaceManagerService.delete(id);
|
||||
await this.workspaceRepository.delete(id);
|
||||
if (shouldDeleteCoreWorkspace) {
|
||||
await this.workspaceRepository.delete(id);
|
||||
}
|
||||
|
||||
return workspace;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user