mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 21:44:55 +00:00
Merge branch 'create-orphan-space-for-project' of https://github.com/SyncrowIOT/backend into feat/list-space-model
This commit is contained in:
@ -23,13 +23,15 @@ export class CreateOrphanSpaceHandler
|
||||
async execute(command: CreateOrphanSpaceCommand): Promise<void> {
|
||||
try {
|
||||
const { project } = command;
|
||||
const orphanCommunityName = `${ORPHAN_COMMUNITY_NAME}-${project.name}`;
|
||||
|
||||
let orphanCommunity = await this.communityRepository.findOne({
|
||||
where: { name: ORPHAN_COMMUNITY_NAME, project },
|
||||
where: { name: orphanCommunityName, project },
|
||||
});
|
||||
|
||||
if (!orphanCommunity) {
|
||||
orphanCommunity = this.communityRepository.create({
|
||||
name: ORPHAN_COMMUNITY_NAME,
|
||||
name: orphanCommunityName,
|
||||
description: ORPHAN_COMMUNITY_DESCRIPTION,
|
||||
project,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user