fixing propagation

This commit is contained in:
hannathkadher
2025-03-07 23:01:38 +04:00
parent 226781e53f
commit 1220ee395d
12 changed files with 236 additions and 68 deletions

View File

@ -19,6 +19,11 @@ import { ValidateSpacesDto } from '../dtos/validation.space.dto';
import { ProjectParam } from '../dtos';
import { SuccessResponseDto } from '@app/common/dto/success.response.dto';
import { In } from 'typeorm';
import {
ORPHAN_COMMUNITY_NAME,
ORPHAN_SPACE_NAME,
} from '@app/common/constants/orphan-constant';
import { ProjectEntity } from '@app/common/modules/project/entities';
@Injectable()
export class ValidationService {
@ -286,4 +291,24 @@ export class ValidationService {
);
}
}
async getOrphanSpace(project: ProjectEntity): Promise<SpaceEntity> {
const orphanSpace = await this.spaceRepository.findOne({
where: {
community: {
name: `${ORPHAN_COMMUNITY_NAME}-${project.name}`,
},
spaceName: ORPHAN_SPACE_NAME,
},
});
if (!orphanSpace) {
throw new HttpException(
`Orphan space not found in community ${project.name}`,
HttpStatus.NOT_FOUND,
);
}
return orphanSpace;
}
}