mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-24 20:07:53 +00:00
for now
This commit is contained in:
@@ -75,9 +75,8 @@ export class SubSpaceModelService {
|
||||
queryRunner: QueryRunner,
|
||||
) {
|
||||
const updateResults: IUpdateSubspaceModelInterface[] = [];
|
||||
|
||||
for (const dto of updateDtos) {
|
||||
try {
|
||||
try {
|
||||
for (const dto of updateDtos) {
|
||||
const subspaceModel = await this.findOne(dto.subspaceUuid);
|
||||
const updateResult: IUpdateSubspaceModelInterface = {
|
||||
uuid: dto.subspaceUuid,
|
||||
@@ -94,14 +93,18 @@ export class SubSpaceModelService {
|
||||
}
|
||||
|
||||
updateResults.push(updateResult);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`SubspaceModel with ${dto.subspaceUuid} not able to update ${error}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return updateResults;
|
||||
return updateResults;
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) {
|
||||
throw error;
|
||||
}
|
||||
throw new HttpException(
|
||||
error.message || 'Failed to update SpaceModels',
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async deleteSubspaceModels(
|
||||
@@ -179,7 +182,9 @@ export class SubSpaceModelService {
|
||||
spaceModel: SpaceModelEntity,
|
||||
queryRunner: QueryRunner,
|
||||
) {
|
||||
const subspaces: IModifySubspaceModelInterface = {};
|
||||
const subspaces: IModifySubspaceModelInterface = {
|
||||
spaceModelUuid: spaceModel.uuid,
|
||||
};
|
||||
try {
|
||||
if (dto.add) {
|
||||
const addedSubspaces = await this.createSubSpaceModels(
|
||||
@@ -194,11 +199,20 @@ export class SubSpaceModelService {
|
||||
queryRunner,
|
||||
);
|
||||
subspaces.update = updatedSubspaces;
|
||||
} else if (dto.delete) {
|
||||
const deletedSubspaces = await this.deleteSubspaceModels(
|
||||
dto.delete,
|
||||
queryRunner,
|
||||
);
|
||||
subspaces.delete = deletedSubspaces;
|
||||
}
|
||||
return subspaces;
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) {
|
||||
throw error;
|
||||
}
|
||||
throw new HttpException(
|
||||
error.message || 'Failed to update SpaceModel',
|
||||
error.message || 'Failed to modify SpaceModels',
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user