-
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 #4209 from asanchezr/release/uat_is84
UAT Release - IS84
- Loading branch information
Showing
741 changed files
with
110,493 additions
and
21,519 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
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
79 changes: 79 additions & 0 deletions
79
source/backend/api/Areas/Leases/Controllers/LeaseRenewalController.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,79 @@ | ||
|
||
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.Lease; | ||
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.Lease.Controllers | ||
{ | ||
/// <summary> | ||
/// LeaseRenewalController class, provides endpoints for interacting with lease renewals. | ||
/// </summary> | ||
[Authorize] | ||
[ApiController] | ||
[ApiVersion("1.0")] | ||
[Area("leases")] | ||
[Route("v{version:apiVersion}/[area]")] | ||
[Route("[area]")] | ||
public class LeaseRenewalController : ControllerBase | ||
{ | ||
#region Variables | ||
private readonly ILeaseService _leaseService; | ||
private readonly IMapper _mapper; | ||
private readonly ILogger _logger; | ||
#endregion | ||
|
||
#region Constructors | ||
|
||
/// <summary> | ||
/// Creates a new instance of a LeaseRenewalController class, initializes it with the specified arguments. | ||
/// </summary> | ||
/// <param name="leaseService"></param> | ||
/// <param name="mapper"></param> | ||
/// <param name="logger"></param> | ||
/// | ||
public LeaseRenewalController(ILeaseService leaseService, IMapper mapper, ILogger<LeaseRenewalController> logger) | ||
{ | ||
_leaseService = leaseService; | ||
_mapper = mapper; | ||
_logger = logger; | ||
} | ||
#endregion | ||
|
||
#region Endpoints | ||
|
||
/// <summary> | ||
/// Get the renewals on the passed lease id. | ||
/// </summary> | ||
/// <returns></returns> | ||
[HttpGet("{leaseId:long}/renewals")] | ||
[HasPermission(Permissions.LeaseView)] | ||
[Produces("application/json")] | ||
[ProducesResponseType(typeof(IEnumerable<LeaseRenewalModel>), 200)] | ||
[SwaggerOperation(Tags = new[] { "lease" })] | ||
[TypeFilter(typeof(NullJsonResultFilter))] | ||
public IActionResult GetRenewals(long leaseId) | ||
{ | ||
_logger.LogInformation( | ||
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}", | ||
nameof(LeaseRenewalController), | ||
nameof(GetRenewals), | ||
User.GetUsername(), | ||
DateTime.Now); | ||
|
||
var leaseRenewals = _leaseService.GetRenewalsByLeaseId(leaseId); | ||
|
||
return new JsonResult(_mapper.Map<IEnumerable<LeaseRenewalModel>>(leaseRenewals)); | ||
} | ||
#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
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
Oops, something went wrong.