Skip to content

Commit

Permalink
Merge pull request #4209 from asanchezr/release/uat_is84
Browse files Browse the repository at this point in the history
UAT Release - IS84
  • Loading branch information
devinleighsmith authored Jul 18, 2024
2 parents d474b05 + 568e81f commit 0c1914f
Show file tree
Hide file tree
Showing 741 changed files with 110,493 additions and 21,519 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/retag-test-to-uat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,27 @@ jobs:
run: dotnet run
working-directory: ${{env.sync-directory}}

tag-release-image:
name: Release Tag
needs: [deploy]
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
- name: Login to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_SERVER }}
openshift_token: ${{ env.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: 3cd915-tools
- name: tag uat image such that it can be promoted to prod
shell: bash
run: |
VERSION=$(make version)
oc tag pims-app:uat pims-app:v${VERSION}-master
oc tag pims-api:uat pims-api:v${VERSION}-master
ci-cd-end-notification:
name: CI-CD End Notification to Teams Channel
runs-on: ubuntu-latest
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/uat_hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ jobs:
run: dotnet run
working-directory: ${{env.sync-directory}}

tag-release-image:
name: Release Tag
needs: [deploy]
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
- name: Login to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_SERVER }}
openshift_token: ${{ env.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: 3cd915-tools
- name: tag uat image such that it can be promoted to prod
shell: bash
run: |
VERSION=$(make version)
oc tag pims-app:uat pims-app:v${VERSION}-master
oc tag pims-api:uat pims-api:v${VERSION}-master
ci-cd-end-notification:
if: always()
name: CI-CD End Notification to Teams Channel
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/uat_pre_release_hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,27 @@ jobs:
run: dotnet run
working-directory: ${{env.sync-directory}}

tag-release-image:
name: Release Tag
needs: [deploy]
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
- name: Login to OpenShift
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ env.OPENSHIFT_SERVER }}
openshift_token: ${{ env.OPENSHIFT_TOKEN }}
insecure_skip_tls_verify: true
namespace: 3cd915-tools
- name: tag uat image such that it can be promoted to prod
shell: bash
run: |
VERSION=$(make version)
oc tag pims-app:uat pims-app:v${VERSION}-master
oc tag pims-api:uat pims-api:v${VERSION}-master
ci-cd-end-notification:
if: always()
name: CI-CD End Notification to Teams Channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public IActionResult AddCompensationRequisition([FromRoute] long id, [FromBody]
DateTime.Now);
_logger.LogInformation($"Dispatching to service: {_acquisitionService.GetType()}");

var compensationReqEntity = _mapper.Map<Dal.Entities.PimsCompensationRequisition>(compensationRequisition);
var compensationReqEntity = _mapper.Map<PimsCompensationRequisition>(compensationRequisition);
var newCompensationRequisition = _acquisitionService.AddCompensationRequisition(id, compensationReqEntity);

return new JsonResult(_mapper.Map<CompensationRequisitionModel>(newCompensationRequisition));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using MapsterMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Pims.Api.Helpers.Exceptions;
using Pims.Api.Models.Concepts.AcquisitionFile;
using Pims.Api.Models.Concepts.CompensationRequisition;
using Pims.Api.Policies;
using Pims.Api.Services;
Expand Down Expand Up @@ -89,6 +91,27 @@ public IActionResult UpdateCompensationRequisition([FromRoute] long id, [FromBod
return new JsonResult(_mapper.Map<CompensationRequisitionModel>(compensation));
}

[HttpGet("{id:long}/properties")]
[HasPermission(Permissions.CompensationRequisitionView)]
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<AcquisitionFilePropertyModel>), 200)]
[SwaggerOperation(Tags = new[] { "compensation-requisition" })]
[TypeFilter(typeof(NullJsonResultFilter))]
public IActionResult GetCompensationRequisitionProperties([FromRoute] long id)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(CompensationRequisitionController),
nameof(GetCompensationRequisitionProperties),
User.GetUsername(),
DateTime.Now);
_logger.LogInformation("Dispatching to service: {Service}", _compensationRequisitionService.GetType());

var compensationReqProperties = _compensationRequisitionService.GetProperties(id);

return new JsonResult(_mapper.Map<IEnumerable<AcquisitionFilePropertyModel>>(compensationReqProperties));
}

/// <summary>
/// Deletes the compensation with the matching id.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public class ContactSummaryModel
/// </summary>
public long? PersonId { get; set; }

public PersonModel Person { get; set; }
public Pims.Api.Models.Concepts.Person.PersonModel Person { get; set; }

/// <summary>
/// get/set - The primary key to identify the organization.
/// </summary>
public long? OrganizationId { get; set; }

public OrganizationModel Organization { get; set; }
public Pims.Api.Models.Concepts.Organization.OrganizationModel Organization { get; set; }

/// <summary>
/// get/set - The concurrency row version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public IActionResult UpdateLease(LeaseModel leaseModel, [FromQuery] string[] use
User.GetUsername(),
DateTime.Now);

var leaseEntity = _mapper.Map<Pims.Dal.Entities.PimsLease>(leaseModel);
var leaseEntity = _mapper.Map<Dal.Entities.PimsLease>(leaseModel);
var userOverrides = userOverrideCodes.Select(x => UserOverrideCode.Parse(x));
var updatedLease = _leaseService.Update(leaseEntity, userOverrides);

Expand Down
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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ public IActionResult AddOrganization([FromBody] OrganizationModel model, bool us
{
// Business rule - support country free-form value if country code is "Other". Ignore field otherwise.
var otherCountry = _lookupRepository.GetAllCountries().FirstOrDefault(x => x.Code == Dal.Entities.CountryCodes.Other);
foreach (var organizationAddress in model?.OrganizationAddresses)
if (model?.OrganizationAddresses != null)
{
if (otherCountry != null && organizationAddress?.Address != null && organizationAddress.Address.CountryId != otherCountry.CountryId)
foreach (var organizationAddress in model?.OrganizationAddresses)
{
organizationAddress.Address.CountryOther = null;
if (otherCountry != null && organizationAddress?.Address != null && organizationAddress.Address.CountryId != otherCountry.CountryId)
{
organizationAddress.Address.CountryOther = null;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ public IActionResult AddPerson([FromBody] PersonModel model, bool userOverride =
{
// Business rule - support country free-form value if country code is "Other". Ignore field otherwise.
var otherCountry = _lookupRepository.GetAllCountries().FirstOrDefault(x => x.Code == Dal.Entities.CountryCodes.Other);
foreach (var personAddress in model?.PersonAddresses)
if (model?.PersonAddresses != null)
{
if (otherCountry != null && personAddress != null && personAddress.Address.CountryId != otherCountry.CountryId)
foreach (var personAddress in model?.PersonAddresses)
{
personAddress.Address.CountryOther = null;
if (otherCountry != null && personAddress != null && personAddress.Address.CountryId != otherCountry.CountryId)
{
personAddress.Address.CountryOther = null;
}
}
}

Expand Down
13 changes: 9 additions & 4 deletions source/backend/api/Areas/Reports/Controllers/LeaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Pims.Core.Extensions;
using Pims.Dal.Entities;
using Pims.Dal.Entities.Models;
using Pims.Dal.Helpers.Extensions;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
Expand Down Expand Up @@ -184,11 +185,11 @@ public IActionResult ExportLeasePayments(int fiscalYearStart)

DateTime startDate = fiscalYearStart.ToFiscalYearDate();
var allPayments = _leasePaymentService.GetAllByDateRange(startDate, startDate.AddYears(1).AddDays(-1)); // Add years will give you the equivalent month, except for 29th/ 28th of leap years which is not the case here.
var paymentItems = _mapper.Map<IEnumerable<LeasePaymentReportModel>>(allPayments);
var paymentItems = _mapper.Map<IEnumerable<LeasePaymentReportModel>>(allPayments.OrderBy(p => p?.LeasePeriod?.Lease?.RegionCode).ThenBy(p => p?.LeasePeriod?.Lease?.LFileNo).ThenByDescending(p => p.PaymentReceivedDate));

return acceptHeader.ToString() switch
{
ContentTypes.CONTENTTYPECSV => ReportHelper.GenerateCsv<LeasePaymentReportModel>(paymentItems.OrderBy(p => p.Region).ThenBy(p => p.LFileNumber).ThenByDescending(p => p.PaymentReceivedDate)),
ContentTypes.CONTENTTYPECSV => ReportHelper.GenerateCsv<LeasePaymentReportModel>(paymentItems),
_ => ReportHelper.GenerateExcel(paymentItems, $"LeaseLicense_Payments")
};
}
Expand All @@ -204,9 +205,13 @@ public IActionResult ExportLeasePayments(int fiscalYearStart)
public IEnumerable<LeaseModel> GetCrossJoinLeases(Lease.Models.Search.LeaseFilterModel filter, bool all = false)
{
var page = _leaseService.GetPage((LeaseFilter)filter, all);
var allLeases = page.Items.SelectMany(l => l.PimsLeasePeriods.DefaultIfEmpty(), (lease, period) => (lease, period))
var expiryDate = page.Items.Select(l => l.GetExpiryDate());

var allLeases = page.Items
.SelectMany(l => l.PimsLeasePeriods.DefaultIfEmpty(), (lease, period) => (lease, period))
.SelectMany(lt => lt.lease.PimsPropertyLeases.DefaultIfEmpty(), (leasePeriod, property) => (leasePeriod.period, leasePeriod.lease, property))
.SelectMany(ltp => ltp.lease.PimsLeaseTenants.DefaultIfEmpty(), (leasePeriodProperty, tenant) => (leasePeriodProperty.period, leasePeriodProperty.lease, leasePeriodProperty.property, tenant));
.SelectMany(ltp => ltp.lease.PimsLeaseTenants.DefaultIfEmpty(), (leasePeriodProperty, tenant) => (leasePeriodProperty.period, leasePeriodProperty.lease, leasePeriodProperty.property, tenant))
.SelectMany(ltpr => expiryDate, (leasePeriodPropertyTenant, expiryDate) => (leasePeriodPropertyTenant.period, leasePeriodPropertyTenant.lease, leasePeriodPropertyTenant.property, leasePeriodPropertyTenant.tenant, expiryDate));
var flatLeases = _mapper.Map<IEnumerable<LeaseModel>>(allLeases);
return flatLeases;
}
Expand Down
10 changes: 6 additions & 4 deletions source/backend/api/Areas/Reports/Mapping/Lease/LeaseMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ public class LeaseMap : IRegister
{
public void Register(TypeAdapterConfig config)
{
config.NewConfig<(Entity.PimsLeasePeriod period, Entity.PimsLease lease, Entity.PimsPropertyLease property, Entity.PimsLeaseTenant tenant), Model.LeaseModel>()
config.NewConfig<(Entity.PimsLeasePeriod period, Entity.PimsLease lease, Entity.PimsPropertyLease property, Entity.PimsLeaseTenant tenant, DateTime? expiryDate), Model.LeaseModel>()
.AfterMapping((src, dest) =>
{
MapLease(src, dest);
});
}

private static void MapLease((Entity.PimsLeasePeriod period, Entity.PimsLease lease, Entity.PimsPropertyLease property, Entity.PimsLeaseTenant tenant) src, Model.LeaseModel dest)
private static void MapLease((Entity.PimsLeasePeriod period, Entity.PimsLease lease, Entity.PimsPropertyLease property, Entity.PimsLeaseTenant tenant, DateTime? expiryDate) src, Model.LeaseModel dest)
{
dest.LFileNo = src.lease.LFileNo;
dest.MotiRegion = src.lease.RegionCodeNavigation?.RegionName;
dest.StartDate = src.lease.OrigStartDate.FilterSqlMinDate().ToNullableDateOnly();
dest.EndDate = src.lease.OrigExpiryDate?.FilterSqlMinDate().ToNullableDateOnly();
dest.EndDate = src.expiryDate.ToNullableDateOnly();
dest.CurrentPeriodStartDate = src.lease.GetCurrentPeriodStartDate()?.FilterSqlMinDate().ToNullableDateOnly();
dest.CurrentTermEndDate = src.lease.GetCurrentPeriodEndDate()?.FilterSqlMinDate().ToNullableDateOnly();
dest.ProgramName = src.lease.LeaseProgramTypeCodeNavigation?.GetTypeDescriptionOther(src.lease.OtherLeaseProgramType);
Expand All @@ -36,7 +36,7 @@ private static void MapLease((Entity.PimsLeasePeriod period, Entity.PimsLease le
dest.InspectionNotes = src.lease.InspectionNotes;
dest.InspectionDate = src.lease.InspectionDate?.FilterSqlMinDate();
dest.LeaseNotes = src.lease.LeaseNotes;
dest.IsExpired = (src.lease.GetExpiryDate() < DateTime.Now).BoolToYesNo();
dest.IsExpired = (src.expiryDate < DateTime.Now).BoolToYesNo();
dest.LeaseAmount = src.period?.PaymentAmount;
dest.PeriodStartDate = src.period?.PeriodStartDate.FilterSqlMinDate().ToNullableDateOnly();
dest.PeriodExpiryDate = src.period?.PeriodExpiryDate?.FilterSqlMinDate().ToNullableDateOnly();
Expand All @@ -46,6 +46,8 @@ private static void MapLease((Entity.PimsLeasePeriod period, Entity.PimsLease le
dest.Pid = src.property?.Property?.Pid;
dest.Pin = src.property?.Property?.Pin;
dest.TenantName = src.tenant?.GetTenantName();
dest.FinancialGain = src.lease.IsFinancialGain.BoolToYesNoUnknown();
dest.PublicBenefit = src.lease.IsPublicBenefit.BoolToYesNoUnknown();
}
}
}
18 changes: 18 additions & 0 deletions source/backend/api/Areas/Reports/Mapping/Property/PropertyMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.LandArea, src => src.LandArea)
.Map(dest => dest.LandLegalDescription, src => src.LandLegalDescription)
.Map(dest => dest.Zoning, src => src.Zoning);

config.NewConfig<Entity.PimsPropertyVw, Model.PropertyModel>()
.Map(dest => dest.PropertyTypeId, src => src.PropertyTypeCode)
.Map(dest => dest.ClassificationId, src => src.PropertyClassificationTypeCode)
.Map(dest => dest.Name, src => src.Name)
.Map(dest => dest.Description, src => src.Description)
.Map(dest => dest.Address, src => $"{src.StreetAddress1} {src.StreetAddress2} {src.StreetAddress3}")
.Map(dest => dest.Municipality, src => src.MunicipalityName)
.Map(dest => dest.Postal, src => src.PostalCode)
.Map(dest => dest.Latitude, src => src.Location.Coordinate.Y)
.Map(dest => dest.Longitude, src => src.Location.Coordinate.X)
.Map(dest => dest.IsSensitive, src => src.IsSensitive)

.Map(dest => dest.PID, src => src.PidPadded)
.Map(dest => dest.PIN, src => src.Pin)
.Map(dest => dest.LandArea, src => src.LandArea)
.Map(dest => dest.LandLegalDescription, src => src.LandLegalDescription)
.Map(dest => dest.Zoning, src => src.Zoning);
}
}
}
8 changes: 8 additions & 0 deletions source/backend/api/Areas/Reports/Models/Lease/LeaseModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ public class LeaseModel
[DisplayName("Is Expired?")]
[CsvHelper.Configuration.Attributes.Name("Is Expired?")]
public string IsExpired { get; set; }

[DisplayName("Financial Gain?")]
[CsvHelper.Configuration.Attributes.Name("Financial Gain?")]
public string FinancialGain { get; set; }

[DisplayName("Public Benefit?")]
[CsvHelper.Configuration.Attributes.Name("Public Benefit?")]
public string PublicBenefit { get; set; }
#endregion
}
}
Loading

0 comments on commit 0c1914f

Please sign in to comment.