-
Notifications
You must be signed in to change notification settings - Fork 24
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 #4141 from bcgov/test
v5.3 release
- Loading branch information
Showing
1,049 changed files
with
186,734 additions
and
18,869 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,7 +106,7 @@ jobs: | |
- name: Codecov | ||
uses: codecov/[email protected] | ||
env: | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV }} | ||
with: | ||
# User defined upload name. Visible in Codecov UI | ||
|
@@ -122,7 +122,7 @@ jobs: | |
|
||
- name: SonarScanner for .NET 8 with pull request decoration support | ||
id: scan | ||
uses: highbyte/sonarscan-dotnet@v2.1.2 | ||
uses: highbyte/sonarscan-dotnet@v2.3.2 | ||
if: ${{ github.event_name == 'push' }} | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
|
File renamed without changes.
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
96 changes: 96 additions & 0 deletions
96
source/backend/api/Areas/HistoricalNumber/HistoricalNumberController.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using MapsterMapper; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
using Pims.Api.Models.Concepts.Property; | ||
using Pims.Api.Policies; | ||
using Pims.Api.Services; | ||
using Pims.Core.Extensions; | ||
using Pims.Core.Json; | ||
using Pims.Dal.Security; | ||
using Swashbuckle.AspNetCore.Annotations; | ||
|
||
namespace Pims.Api.Areas.HistoricalNumber.Controllers | ||
{ | ||
/// <summary> | ||
/// HistoricalNumberController class, provides endpoints for interacting with property historical numbers. | ||
/// </summary> | ||
[Authorize] | ||
[ApiController] | ||
[ApiVersion("1.0")] | ||
[Area("properties")] | ||
[Route("v{version:apiVersion}/[area]")] | ||
[Route("[area]")] | ||
public class HistoricalNumberController : ControllerBase | ||
{ | ||
#region Variables | ||
private readonly IPropertyService _propertyService; | ||
private readonly IMapper _mapper; | ||
private readonly ILogger _logger; | ||
#endregion | ||
|
||
#region Constructors | ||
|
||
/// <summary> | ||
/// Creates a new instance of a HistoricalNumberController class, initializes it with the specified arguments. | ||
/// </summary> | ||
/// <param name="propertyService"></param> | ||
/// <param name="mapper"></param> | ||
/// | ||
public HistoricalNumberController(IPropertyService propertyService, IMapper mapper, ILogger<HistoricalNumberController> logger) | ||
{ | ||
_propertyService = propertyService; | ||
_mapper = mapper; | ||
_logger = logger; | ||
} | ||
|
||
/// <summary> | ||
/// Gets a list of the historic numbers for a given property id. | ||
/// </summary> | ||
[HttpGet("{propertyId}/historicalNumbers")] | ||
[HasPermission(Permissions.PropertyView)] | ||
[Produces("application/json")] | ||
[ProducesResponseType(typeof(IEnumerable<HistoricalFileNumberModel>), 200)] | ||
[SwaggerOperation(Tags = new[] { "property" })] | ||
[TypeFilter(typeof(NullJsonResultFilter))] | ||
public IActionResult GetHistoricalNumbersForPropertyId(long propertyId) | ||
{ | ||
_logger.LogInformation( | ||
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}", | ||
nameof(HistoricalNumberController), | ||
nameof(GetHistoricalNumbersForPropertyId), | ||
User.GetUsername(), | ||
DateTime.Now); | ||
|
||
var historicalNumbers = _propertyService.GetHistoricalNumbersForPropertyId(propertyId); | ||
return new JsonResult(_mapper.Map<List<HistoricalFileNumberModel>>(historicalNumbers)); | ||
} | ||
|
||
/// <summary> | ||
/// Updates the list of historic numbers for a given property id. | ||
/// </summary> | ||
[HttpPut("{propertyId}/historicalNumbers")] | ||
[HasPermission(Permissions.PropertyEdit)] | ||
[Produces("application/json")] | ||
[ProducesResponseType(typeof(IEnumerable<HistoricalFileNumberModel>), 200)] | ||
[SwaggerOperation(Tags = new[] { "property" })] | ||
[TypeFilter(typeof(NullJsonResultFilter))] | ||
public IActionResult UpdateHistoricalNumbers(long propertyId, IEnumerable<HistoricalFileNumberModel> historicalNumbers) | ||
{ | ||
_logger.LogInformation( | ||
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}", | ||
nameof(HistoricalNumberController), | ||
nameof(UpdateHistoricalNumbers), | ||
User.GetUsername(), | ||
DateTime.Now); | ||
|
||
var historicalEntities = _mapper.Map<IEnumerable<Dal.Entities.PimsHistoricalFileNumber>>(historicalNumbers); | ||
var updatedEntities = _propertyService.UpdateHistoricalFileNumbers(propertyId, historicalEntities); | ||
|
||
return new JsonResult(_mapper.Map<IEnumerable<HistoricalFileNumberModel>>(updatedEntities)); | ||
} | ||
#endregion | ||
} | ||
} |
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
36 changes: 36 additions & 0 deletions
36
source/backend/api/Helpers/Healthchecks/PimsCdogsHealthCheck.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
using Pims.Api.Repositories.Cdogs; | ||
|
||
namespace Pims.Api.Helpers.Healthchecks | ||
{ | ||
public class PimsCdogsHealthcheck : IHealthCheck | ||
{ | ||
private readonly IDocumentGenerationRepository _generationRepository; | ||
|
||
public PimsCdogsHealthcheck(IDocumentGenerationRepository generationRepository) | ||
{ | ||
_generationRepository = generationRepository; | ||
} | ||
|
||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) | ||
{ | ||
try | ||
{ | ||
|
||
var fileTypes = await _generationRepository.TryGetFileTypesAsync(); | ||
if (fileTypes.HttpStatusCode != System.Net.HttpStatusCode.OK || fileTypes.Payload == null || fileTypes.Payload.Dictionary.Count == 0) | ||
{ | ||
return new HealthCheckResult(HealthStatus.Degraded, $"received invalid file types response from CDOGS"); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
return new HealthCheckResult(context.Registration.FailureStatus, $"Cdogs error response: {e.Message} {e.StackTrace}"); | ||
} | ||
return HealthCheckResult.Healthy(); | ||
} | ||
} | ||
} |
Oops, something went wrong.