Add bones for Bts.DataStreamWebApp.Server

This commit is contained in:
John Colvin committed 2024-01-18 00:32:30 -05:00
1 parent c39a270115
commit 8bb7262d81
11 files changed
+210 -1

No files matched your search

@@ -0,0 +1,31 @@
namespace Bts.DataStreamWebApp.Server.Controllers;
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("[controller]")]
public class DataStreamSubscriptionController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<DataStreamSubscriptionController> _logger;
public DataStreamSubscriptionController(ILogger<DataStreamSubscriptionController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetDataStreamSubscription")]
public IEnumerable<DataStreamSubscription> Get()
{
return Enumerable.Range(1, 5).Select(index => new DataStreamSubscription
{
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
}