Skip to content

Commit

Permalink
Add logger to ProductController for legacy
Browse files Browse the repository at this point in the history
endpoints
  • Loading branch information
yorickdewid committed Apr 25, 2024
1 parent 7b95aec commit b30c108
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/FunderMaps.Webservice/Controllers/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace FunderMaps.Webservice.Controllers;
/// Controller for all product endpoints.
/// </summary>
[Route("api/v3/product")]
public sealed class ProductController(ModelService modelService) : FunderMapsController
public sealed class ProductController(ModelService modelService, ILogger<ProductController> logger) : FunderMapsController
{
// GET: api/v3/product/analysis
/// <summary>
Expand All @@ -30,13 +30,16 @@ public Task<AnalysisProduct> GetAnalysisAsync(string id)
public Task<StatisticsProduct> GetStatisticsAsync(string id)
=> modelService.GetStatisticsAsync(id, TenantId);


// TODO: LEGACY
// GET: api/v3/product/analysis
[Authorize(Roles = "Service, Administrator")]
[HttpGet("analysis")]
public Task<AnalysisProduct> GetAnalysisLegacyAsync([FromQuery] string id)
=> GetAnalysisAsync(id);
{
logger.LogWarning("Legacy endpoint called: {Endpoint}", HttpContext.Request.Path);

return GetAnalysisAsync(id);
}

// TODO: LEGACY
// GET: api/v3/product/statistics
Expand All @@ -46,5 +49,9 @@ public Task<AnalysisProduct> GetAnalysisLegacyAsync([FromQuery] string id)
[Authorize(Roles = "Service,Administrator")]
[HttpGet("statistics")]
public Task<StatisticsProduct> GetStatisticsLegacyAsync([FromQuery] string id)
=> GetStatisticsAsync(id);
{
logger.LogWarning("Legacy endpoint called: {Endpoint}", HttpContext.Request.Path);

return GetStatisticsAsync(id);
}
}

0 comments on commit b30c108

Please sign in to comment.