Add Valve Controller

This commit is contained in:
Артем Харламов 2024-11-19 19:36:05 +04:00
parent e8a1a8385b
commit 5e73961ad5

View File

@ -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}");*/
} }
} }
} }