Display basic device information
This commit is contained in:
@ -33,6 +33,18 @@ pub struct DeviceInPath {
|
||||
id: DeviceId,
|
||||
}
|
||||
|
||||
/// Get a single device information
|
||||
pub async fn get_single(actor: WebEnergyActor, id: web::Path<DeviceInPath>) -> HttpResult {
|
||||
let Some(dev) = actor
|
||||
.send(energy_actor::GetSingleDevice(id.id.clone()))
|
||||
.await?
|
||||
else {
|
||||
return Ok(HttpResponse::NotFound().json("Requested device was not found!"));
|
||||
};
|
||||
|
||||
Ok(HttpResponse::Ok().json(dev))
|
||||
}
|
||||
|
||||
/// Validate a device
|
||||
pub async fn validate_device(actor: WebEnergyActor, id: web::Path<DeviceInPath>) -> HttpResult {
|
||||
actor
|
||||
|
Reference in New Issue
Block a user