mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
reduce code duplication
This commit is contained in:
@ -58,7 +58,7 @@ export class SubSpaceService {
|
||||
return await queryRunner.manager.save(subspaces);
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
'An unexpected error occurred while creating subspaces.',
|
||||
`An unexpected error occurred while creating subspaces. ${error}`,
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
@ -98,9 +98,8 @@ export class SubSpaceService {
|
||||
otherTags?: CreateTagDto[],
|
||||
): Promise<SubspaceEntity[]> {
|
||||
try {
|
||||
await this.validateName(
|
||||
addSubspaceDtos.map((dto) => dto.subspaceName),
|
||||
space,
|
||||
this.checkForDuplicateNames(
|
||||
addSubspaceDtos.map(({ subspaceName }) => subspaceName),
|
||||
);
|
||||
|
||||
const subspaceData = addSubspaceDtos.map((dto) => ({
|
||||
|
Reference in New Issue
Block a user