Add endpoint to get devices by unit ID

This commit is contained in:
faris Aljohari
2024-07-01 14:29:54 +03:00
parent 97c571d710
commit ddfc55d9dd
2 changed files with 53 additions and 1 deletions
+13 -1
View File
@@ -83,7 +83,19 @@ export class DeviceController {
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('unit/:unitUuid')
async getDevicesByUnitId(@Param('unitUuid') unitUuid: string) {
try {
return await this.deviceService.getDevicesByUnitId(unitUuid);
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard, CheckRoomGuard)
@Put('room')