Add Valve Controller
This commit is contained in:
parent
e8a1a8385b
commit
5e73961ad5
@ -21,7 +21,7 @@ namespace Cloud.Controllers
|
|||||||
_producerService = producerService;
|
_producerService = producerService;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("farm/{farmId}/greenhouse/{greenhouseId}/watering")]
|
[HttpPost("farm/{farmId}/greenhouse/{ghId}/watering")]
|
||||||
public async Task<IActionResult> interactValve([FromBody] ValveRequest request, int farmId, int ghId)
|
public async Task<IActionResult> interactValve([FromBody] ValveRequest request, int farmId, int ghId)
|
||||||
{
|
{
|
||||||
var kafkaRequest = new
|
var kafkaRequest = new
|
||||||
@ -32,10 +32,11 @@ namespace Cloud.Controllers
|
|||||||
};
|
};
|
||||||
|
|
||||||
var message = JsonSerializer.Serialize(kafkaRequest);
|
var message = JsonSerializer.Serialize(kafkaRequest);
|
||||||
|
return Ok(kafkaRequest);
|
||||||
|
|
||||||
await _producerService.ProduceMessageAsync("InventoryUpdates", message);
|
/*await _producerService.ProduceMessageAsync("ValvesHeatersRequest", message);
|
||||||
|
|
||||||
return Ok($"Valve status is {request.Action}");
|
return Ok($"Valve status is {request.Action}");*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user