mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 02:17:54 +00:00
get space model by id
This commit is contained in:
@@ -323,6 +323,22 @@ export class SpaceModelService {
|
||||
}
|
||||
}
|
||||
|
||||
async findOne(params: SpaceModelParam): Promise<BaseResponseDto> {
|
||||
try {
|
||||
await this.validateProject(params.projectUuid);
|
||||
const spaceModel = await this.validateSpaceModel(params.spaceModelUuid);
|
||||
return new SuccessResponseDto({
|
||||
message: 'SpaceModel retrieved successfully',
|
||||
data: spaceModel,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
`Failed to retrieve space model ${error}`,
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async validateSpaceModel(uuid: string): Promise<SpaceModelEntity> {
|
||||
const spaceModel = await this.spaceModelRepository.findOne({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user