Add endpoint to update device firmware

This commit is contained in:
faris Aljohari
2024-05-18 20:23:17 +03:00
parent 6b881ce01e
commit cd40dc897b
4 changed files with 78 additions and 4 deletions

View File

@ -152,6 +152,25 @@ export class DeviceController {
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Post(':deviceUuid/firmware/:firmwareVersion')
async updateDeviceFirmware(
@Param('deviceUuid') deviceUuid: string,
@Param('firmwareVersion') firmwareVersion: number,
) {
try {
return await this.deviceService.updateDeviceFirmware(
deviceUuid,
firmwareVersion,
);
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('getaway/:gatewayUuid/devices')
async getDevicesInGetaway(@Param('gatewayUuid') gatewayUuid: string) {
try {