finished factory reset endpoint

This commit is contained in:
faris Aljohari
2024-09-19 12:58:46 +03:00
parent 90127bd510
commit c49aad3e43
3 changed files with 98 additions and 0 deletions
@@ -22,6 +22,7 @@ import {
ControlDeviceDto,
BatchControlDevicesDto,
BatchStatusDevicesDto,
BatchFactoryResetDevicesDto,
} from '../dtos/control.device.dto';
import { CheckRoomGuard } from 'src/guards/room.guard';
import { CheckUserHavePermission } from 'src/guards/user.device.permission.guard';
@@ -291,4 +292,21 @@ export class DeviceController {
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Post('factory/reset/:deviceUuid')
async batchFactoryResetDevices(
@Body() batchFactoryResetDevicesDto: BatchFactoryResetDevicesDto,
) {
try {
return await this.deviceService.batchFactoryResetDevices(
batchFactoryResetDevicesDto,
);
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
}