diff --git a/src/Application/WeatherForecasts/Queries/GetWeatherForecasts/GetWeatherForecastsQuery.cs b/src/Application/WeatherForecasts/Queries/GetWeatherForecasts/GetWeatherForecastsQuery.cs deleted file mode 100644 index cf75269..0000000 --- a/src/Application/WeatherForecasts/Queries/GetWeatherForecasts/GetWeatherForecastsQuery.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace Hutopy.Application.WeatherForecasts.Queries.GetWeatherForecasts; - -public record GetWeatherForecastsQuery : IRequest>; - -public class GetWeatherForecastsQueryHandler : IRequestHandler> -{ - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - -#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously - public async Task> Handle(GetWeatherForecastsQuery request, CancellationToken cancellationToken) -#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously - { - var rng = new Random(); - - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateTime.Now.AddDays(index), - TemperatureC = rng.Next(-20, 55), - Summary = Summaries[rng.Next(Summaries.Length)] - }); - } -} diff --git a/src/Application/WeatherForecasts/Queries/GetWeatherForecasts/WeatherForecast.cs b/src/Application/WeatherForecasts/Queries/GetWeatherForecasts/WeatherForecast.cs deleted file mode 100644 index e01216a..0000000 --- a/src/Application/WeatherForecasts/Queries/GetWeatherForecasts/WeatherForecast.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Hutopy.Application.WeatherForecasts.Queries.GetWeatherForecasts; - -public class WeatherForecast -{ - public DateTime Date { get; init; } - - public int TemperatureC { get; init; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; init; } -} diff --git a/src/Web/Endpoints/WeatherForecasts.cs b/src/Web/Endpoints/WeatherForecasts.cs deleted file mode 100644 index 75f26c4..0000000 --- a/src/Web/Endpoints/WeatherForecasts.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Hutopy.Application.WeatherForecasts.Queries.GetWeatherForecasts; - -namespace Hutopy.Web.Endpoints; - -public class WeatherForecasts : EndpointGroupBase -{ - public override void Map(WebApplication app) - { - app.MapGroup(this) - .RequireAuthorization() - .MapGet(GetWeatherForecasts); - } - - private static async Task> GetWeatherForecasts(ISender sender) - { - return await sender.Send(new GetWeatherForecastsQuery()); - } -} diff --git a/src/Web/Web.http b/src/Web/Web.http index 054f4e4..5dfb87a 100644 --- a/src/Web/Web.http +++ b/src/Web/Web.http @@ -38,12 +38,6 @@ Content-Type: application/json ### -# GET WeatherForecast -GET {{base_url}}/api/WeatherForecasts -Authorization: Bearer {{auth_token}} - -### - # GET GetMyUser GET {{base_url}}/api/GetMyUser Authorization: Bearer {{auth_token}}