Add endpoint to fetch all devices with detailed information

This commit is contained in:
faris Aljohari
2024-08-21 23:26:37 +03:00
parent 5cc3e88371
commit a9d0e06c02
2 changed files with 55 additions and 0 deletions

View File

@ -223,4 +223,17 @@ export class DeviceController {
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get()
async getAllDevices() {
try {
return await this.deviceService.getAllDevices();
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
}