-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #581 from Laixer/develop
v3.3.6
- Loading branch information
Showing
27 changed files
with
466 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace FunderMaps.Core.Entities | ||
{ | ||
/// <summary> | ||
/// Product telemetry. | ||
/// </summary> | ||
public sealed class ProductTelemetry | ||
{ | ||
/// <summary> | ||
/// Product name. | ||
/// </summary> | ||
[Required] | ||
public string Product { get; set; } | ||
|
||
/// <summary> | ||
/// Product hit count. | ||
/// </summary> | ||
public int Count { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/FunderMaps.Data/Extensions/FunderMapsDataServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using AutoMapper; | ||
using FunderMaps.Core.Entities; | ||
using FunderMaps.Core.Interfaces.Repositories; | ||
using FunderMaps.Webservice.DataTransferObjects; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
|
||
namespace FunderMaps.Webservice.Controllers | ||
{ | ||
/// <summary> | ||
/// Controller for all product quotas. | ||
/// </summary> | ||
[Route("quota")] | ||
public sealed class QuotaController : ControllerBase | ||
{ | ||
private readonly IMapper _mapper; | ||
private readonly ITelemetryRepository _telemetryRepository; | ||
|
||
/// <summary> | ||
/// Create new instance. | ||
/// </summary> | ||
public QuotaController(IMapper mapper, ITelemetryRepository telemetryRepository) | ||
{ | ||
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); | ||
_telemetryRepository = telemetryRepository ?? throw new ArgumentNullException(nameof(telemetryRepository)); | ||
} | ||
|
||
// GET: api/quota/usage | ||
/// <summary> | ||
/// Request product quota usage. | ||
/// </summary> | ||
[HttpGet("usage")] | ||
[ProducesResponseType(StatusCodes.Status200OK)] | ||
[ProducesResponseType(StatusCodes.Status404NotFound)] | ||
public async Task<ActionResult<IList<ProductTelemetryDto>>> GetQuotaUsageAsync() | ||
{ | ||
// Assign. | ||
IAsyncEnumerable<ProductTelemetry> productUsageList = _telemetryRepository.ListAllUsageAsync(); | ||
|
||
// Map. | ||
var result = await _mapper.MapAsync<IList<ProductTelemetryDto>, ProductTelemetry>(productUsageList); | ||
|
||
// Return. | ||
return Ok(productUsageList); | ||
} | ||
} | ||
} |
Oops, something went wrong.