Skip to content

Commit

Permalink
Merge pull request #3614 from asanchezr/uat_is67_release
Browse files Browse the repository at this point in the history
UAT IS67 Release
  • Loading branch information
devinleighsmith authored Nov 23, 2023
2 parents 84e7e5b + 21b4f19 commit 3c3883f
Show file tree
Hide file tree
Showing 338 changed files with 85,356 additions and 9,113 deletions.
29 changes: 2 additions & 27 deletions .github/workflows/retag-test-to-uat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,12 @@ jobs:
- name: call scripts to upgrade database
shell: bash
run: |
oc process -f ./openshift/4.0/templates/jobs/db-deploy.yaml -p DB_SECRET_NAME=pims-database -p GIT_BRANCH=test -p SERVER_NAME=sqlprd.th.gov.bc.ca -p DB_NAME=PIMS_UAT -p NAMESPACE=3cd915-test | oc create -f - | grep -oP "(?<=job\.batch/)[^\s]*" | (read JOB_NAME; oc wait --for=condition=complete job/$JOB_NAME --timeout=120s)
sync-keycloak:
name: Sync Keycloak
needs: database-upgrade
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v3

- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: "6.0.x"

- name: Install dependencies for keycloak sync
run: dotnet restore
working-directory: ${{env.sync-directory}}

- name: Build keycloak sync
run: dotnet build
working-directory: ${{env.sync-directory}}

- name: Start keycloak sync
run: dotnet run
working-directory: ${{env.sync-directory}}
oc process -f ./openshift/4.0/templates/jobs/db-deploy.yaml -p DB_SECRET_NAME=pims-database-uat -p GIT_BRANCH=test -p SERVER_NAME=sqlprd.th.gov.bc.ca -p DB_NAME=PIMS_UAT -p NAMESPACE=3cd915-test | oc create -f - | grep -oP "(?<=job\.batch/)[^\s]*" | (read JOB_NAME; oc wait --for=condition=complete job/$JOB_NAME --timeout=120s)
ci-cd-end-notification:
name: CI-CD End Notification to Teams Channel
runs-on: ubuntu-latest
needs: sync-keycloak
needs: database-upgrade
steps:
- name: check workflow status
uses: martialonline/workflow-status@v4
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<UseWinAuth>false</UseWinAuth>
<WinAuthUserName />
<WinAuthDomain />
<ServerName>ssistst.th.gov.bc.ca</ServerName>
<PathOnServer>/SSISDB/PIMS_DEV/LISDB_PIMS_MANAGEMENT</PathOnServer>
<StartObjectID>LIS_DB_to_PIMS_ACTIVITY_PSP_6943.dtsx</StartObjectID>
<UserIDs />
<UserPasswords />
<OfflineMode>false</OfflineMode>
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
DTS:CreatorName="Xerces\Devin Smith"
DTS:DTSID="{6C914856-AF42-4D92-BBE1-AA6D6E2F0355}"
DTS:ExecutableType="Microsoft.Package"
DTS:LastModifiedProductVersion="16.0.948.0"
DTS:LastModifiedProductVersion="16.0.5270.0"
DTS:LocaleID="1033"
DTS:ObjectName="Package"
DTS:PackageType="5"
DTS:ProtectionLevel="0"
DTS:VersionBuild="6"
DTS:VersionGUID="{BCD0BF53-9147-4093-9AA0-82F4932373C5}">
DTS:VersionBuild="8"
DTS:VersionGUID="{9EEFEAE5-0A29-4CEB-9ECD-01034D41441C}">
<DTS:Property
DTS:Name="PackageFormatVersion">8</DTS:Property>
<DTS:ConnectionManagers>
Expand Down Expand Up @@ -1036,6 +1036,14 @@ where [refTable].[PID] = ?</property>
Size="172,42"
Id="Package\Summary\PIMS_PROPERTY"
TopLeft="358,270" />
<NodeLayout
Size="183,42"
Id="Package\Summary\CONCAT COLUMNS"
TopLeft="363,376" />
<NodeLayout
Size="211,42"
Id="Package\Summary\Update PIMS_PROPERTY"
TopLeft="334,481" />
<EdgeLayout
Id="Package\Summary.Paths[OLE DB Source Output]"
TopLeft="435.5,207">
Expand Down Expand Up @@ -1067,17 +1075,11 @@ where [refTable].[PID] = ?</property>
</mssgle:Curve>
</EdgeLayout.Curve>
<EdgeLayout.Labels>
<EdgeLabelCollection />
<mssgm:EdgeLabel
BoundingBox="0,0,0,0"
RelativePosition="Any" />
</EdgeLayout.Labels>
</EdgeLayout>
<NodeLayout
Size="211,42"
Id="Package\Summary\Update PIMS_PROPERTY"
TopLeft="334,481" />
<NodeLayout
Size="183,42"
Id="Package\Summary\CONCAT COLUMNS"
TopLeft="363,376" />
<EdgeLayout
Id="Package\Summary.Paths[Lookup Match Output]"
TopLeft="444,312">
Expand Down Expand Up @@ -1145,7 +1147,9 @@ where [refTable].[PID] = ?</property>
</mssgle:Curve>
</EdgeLayout.Curve>
<EdgeLayout.Labels>
<EdgeLabelCollection />
<mssgm:EdgeLabel
BoundingBox="0,0,0,0"
RelativePosition="Any" />
</EdgeLayout.Labels>
</EdgeLayout>
</GraphLayout>
Expand All @@ -1170,7 +1174,7 @@ where [refTable].[PID] = ?</property>
<Property>
<Name>OverwriteParamsSQLProp</Name>
<Value
type="q2:boolean">false</Value>
type="q2:string">false</Value>
</Property>
<Property>
<Name>UsedTableName</Name>
Expand All @@ -1180,7 +1184,7 @@ where [refTable].[PID] = ?</property>
<Property>
<Name>TableInfoObjectType</Name>
<Value
type="q4:int">0</Value>
type="q4:string">0</Value>
</Property>
<Property>
<Name>DataSourceViewID</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public AgreementReportModel(PimsAgreement agreement, ClaimsPrincipal user)
AcquisitionNumberAndName = $"{agreement.AcquisitionFile?.FileNumber} - {agreement.AcquisitionFile?.FileName}";
FileCreatedDate = GetNullableDate(agreement.AcquisitionFile?.AppCreateTimestamp);
FileStatus = agreement.AcquisitionFile?.AcquisitionFileStatusTypeCodeNavigation?.Description;
AgreementStatus = !agreement.IsDraft.HasValue || agreement.IsDraft.Value ? "Draft" : "Final";
//AgreementStatus = !agreement.IsDraft.HasValue || agreement.IsDraft.Value ? "Draft" : "Final"; TODO: Fix this
LegalSurveyPlan = agreement.LegalSurveyPlanNum;
AgreementType = agreement.AgreementTypeCodeNavigation?.Description ?? string.Empty;
AgreementDate = GetNullableDate(agreement.AgreementDate);
Expand Down
2 changes: 2 additions & 0 deletions source/backend/api/Controllers/LookupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public IActionResult GetAll()
var acqChecklistSectionTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllAcquisitionChecklistSectionTypes());
var acqChecklistItemStatusTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllAcquisitionChecklistItemStatusTypes());
var agreementTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllAgreementTypes());
var agreementStatusTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllAgreementStatusTypes());
var interestHolderInterestTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllInterestHolderInterestTypes());
var expropriationPaymentItemTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllExpropriationPaymentItemTypes());
var mgmtActivityStatusTypes = _mapper.Map<Model.LookupModel[]>(_lookupRepository.GetAllPropMgmtActivityStatusTypes());
Expand Down Expand Up @@ -189,6 +190,7 @@ public IActionResult GetAll()
codes.AddRange(acqChecklistSectionTypes);
codes.AddRange(acqChecklistItemStatusTypes);
codes.AddRange(agreementTypes);
codes.AddRange(agreementStatusTypes);
codes.AddRange(interestHolderInterestTypes);
codes.AddRange(expropriationPaymentItemTypes);
codes.AddRange(mgmtActivityStatusTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.AgreementId, src => src.AgreementId)
.Map(dest => dest.AcquisitionFileId, src => src.AcquisitionFileId)
.Map(dest => dest.AgreementType, src => src.AgreementTypeCodeNavigation)
.Map(dest => dest.AgreementStatusType, src => src.AgreementStatusTypeCodeNavigation)
.Map(dest => dest.AgreementDate, src => src.AgreementDate)
.Map(dest => dest.IsDraft, src => src.IsDraft)
//.Map(dest => dest.IsDraft, src => src.IsDraft) TODO: Fix this
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.CommencementDate, src => src.CommencementDate)
Expand All @@ -25,14 +26,16 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.ExpiryDateTime, src => src.ExpiryTs)
.Map(dest => dest.SignedDate, src => src.SignedDate)
.Map(dest => dest.InspectionDate, src => src.InspectionDate)
.Map(dest => dest.CancellationNote, src => src.CancellationNote)
.Inherits<Entity.IBaseAppEntity, BaseAppModel>();

config.NewConfig<AgreementModel, Entity.PimsAgreement>()
.Map(dest => dest.AgreementId, src => src.AgreementId)
.Map(dest => dest.AcquisitionFileId, src => src.AcquisitionFileId)
.Map(dest => dest.AgreementTypeCode, src => src.AgreementType.Id)
.Map(dest => dest.AgreementStatusTypeCode, src => src.AgreementStatusType.Id)
.Map(dest => dest.AgreementDate, src => src.AgreementDate)
.Map(dest => dest.IsDraft, src => src.IsDraft)
//.Map(dest => dest.IsDraft, src => src.IsDraft) TODO: Fix this
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.CommencementDate, src => src.CommencementDate)
Expand All @@ -45,6 +48,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.ExpiryTs, src => src.ExpiryDateTime)
.Map(dest => dest.SignedDate, src => src.SignedDate)
.Map(dest => dest.InspectionDate, src => src.InspectionDate)
.Map(dest => dest.CancellationNote, src => src.CancellationNote)
.Inherits<BaseAppModel, Entity.IBaseAppEntity>();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class AgreementModel : BaseAppModel

public TypeModel<string> AgreementType { get; set; }

public TypeModel<string> AgreementStatusType { get; set; }

public DateTime? AgreementDate { get; set; }

public bool? IsDraft { get; set; }
Expand Down Expand Up @@ -37,5 +39,7 @@ public class AgreementModel : BaseAppModel
public DateTime? SignedDate { get; set; }

public DateTime? InspectionDate { get; set; }

public string CancellationNote { get; set; }
}
}
6 changes: 3 additions & 3 deletions source/backend/api/Pims.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<UserSecretsId>0ef6255f-9ea0-49ec-8c65-c172304b4926</UserSecretsId>
<Version>4.1.2-66.43</Version>
<Version>4.1.2-66.43</Version>
<AssemblyVersion>4.1.2.66</AssemblyVersion>
<Version>4.0.0-67.22</Version>
<Version>4.0.0-67.22</Version>
<AssemblyVersion>4.0.0.67</AssemblyVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ProjectGuid>16BC0468-78F6-4C91-87DA-7403C919E646</ProjectGuid>
</PropertyGroup>
Expand Down
44 changes: 37 additions & 7 deletions source/backend/api/Services/AcquisitionFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ namespace Pims.Api.Services
{
public class AcquisitionFileService : IAcquisitionFileService
{
private static readonly string[] COREINVENTORYINTERESTCODES = { "Section 15", "Section 17", "NOI", "Section 66" };

private readonly ClaimsPrincipal _user;
private readonly ILogger _logger;
private readonly IAcquisitionFileRepository _acqFileRepository;
Expand Down Expand Up @@ -236,6 +238,7 @@ public PimsAcquisitionFile Update(PimsAcquisitionFile acquisitionFile, IEnumerab

_user.ThrowInvalidAccessToAcquisitionFile(_userRepository, _acqFileRepository, acquisitionFile.Internal_Id);
ValidateVersion(acquisitionFile.Internal_Id, acquisitionFile.ConcurrencyControlNumber);
ValidateDrafts(acquisitionFile.Internal_Id);

if (!userOverrides.Contains(UserOverrideCode.UpdateRegion))
{
Expand Down Expand Up @@ -685,6 +688,17 @@ private void ValidateMinistryRegion(long acqFileId, short updatedRegion)
}
}

private void ValidateDrafts(long acqFileId)
{
var agreements = _agreementRepository.GetAgreementsByAquisitionFile(acqFileId);
var compensations = _compensationRequisitionRepository.GetAllByAcquisitionFileId(acqFileId);
if (agreements.Any(a => a?.AgreementStatusTypeCode == "DRAFT" || compensations.Any(c => c.IsDraft.HasValue && c.IsDraft.Value)))
{
throw new BusinessRuleViolationException("You cannot complete a file when there are one or more draft agreements, or one or more draft compensations requisitions." +
"\n\nRemove any draft compensations requisitions. Agreements should be set to final, cancelled, or removed.");
}
}

/// <summary>
/// Attempt to transfer properties of interest to core inventory when an acquisition file is deemed to be completed.
///
Expand All @@ -697,26 +711,23 @@ private void TransferPropertiesOfInterest(PimsAcquisitionFile acquisitionFile, b
// Get the current properties in the research file
var currentProperties = _acquisitionFilePropertyRepository.GetPropertiesByAcquisitionFileId(acquisitionFile.Internal_Id);
var propertiesOfInterest = currentProperties.Where(p => p.Property.IsPropertyOfInterest.HasValue && p.Property.IsPropertyOfInterest.Value);
var propertiesAccounted = currentProperties.Where(x => x.Property.IsPropertyOfInterest.HasValue && !x.Property.IsPropertyOfInterest.Value
&& x.Property.IsOwned.HasValue && !x.Property.IsOwned.Value);

// PSP-6111 Business rule: Transfer properties of interest to core inventory when acquisition file is completed
foreach (var acquisitionProperty in propertiesOfInterest)
{
var property = acquisitionProperty.Property;
if (!userOverride)
{
throw new UserOverrideException(UserOverrideCode.PoiToInventory, "The properties of interest will be added to the inventory as acquired properties.");
}
var takes = _takeRepository.GetAllByPropertyAcquisitionFileId(acquisitionProperty.Internal_Id);
var coreInventoryInterestCodes = new string[] { "Section 15", "Section 17", "NOI", "Section 66" };

var activeTakes = takes.Where(t =>
!(t.IsNewLandAct.HasValue && t.IsNewLandAct.Value && t.LandActEndDt.HasValue && t.LandActEndDt.Value.Date < DateTime.UtcNow.Date) &&
!(t.IsNewLicenseToConstruct.HasValue && t.IsNewLicenseToConstruct.Value && t.LtcEndDt.HasValue && t.LtcEndDt.Value.Date < DateTime.UtcNow.Date) &&
!(t.IsNewInterestInSrw.HasValue && t.IsNewInterestInSrw.Value && t.SrwEndDt.HasValue && t.SrwEndDt.Value.Date < DateTime.UtcNow.Date));

// see psp-6589 for business rules.
var isOwned = !(activeTakes.All(t => (t.IsNewLandAct.HasValue && t.IsNewLandAct.Value && coreInventoryInterestCodes.Contains(t.LandActTypeCode))
var isOwned = !(activeTakes.All(t => (t.IsNewLandAct.HasValue && t.IsNewLandAct.Value && COREINVENTORYINTERESTCODES.Contains(t.LandActTypeCode))
|| (t.IsNewInterestInSrw.HasValue && t.IsNewInterestInSrw.Value)
|| (t.IsThereSurplus.HasValue && t.IsThereSurplus.Value)
|| (t.IsNewLicenseToConstruct.HasValue && t.IsNewLicenseToConstruct.Value)) && activeTakes.Any());
var isPropertyOfInterest = false;

Expand All @@ -730,8 +741,27 @@ private void TransferPropertiesOfInterest(PimsAcquisitionFile acquisitionFile, b
isPropertyOfInterest = true;
}

if (!userOverride && (isOwned || (!isOwned && !isPropertyOfInterest)))
{
throw new UserOverrideException(UserOverrideCode.PoiToInventory, "You have one or more take(s) that will be added to MoTI Inventory. Do you want to acknowledge and proceed?");
}

_propertyRepository.TransferFileProperty(property, isOwned, isPropertyOfInterest);
}

foreach (var acqFileProperty in propertiesAccounted)
{
var property = acqFileProperty.Property;
if (!userOverride)
{
throw new UserOverrideException(UserOverrideCode.PoiToInventory, "The properties of interest will be added to the inventory as acquired properties.");
}

var takes = _takeRepository.GetAllByPropertyAcquisitionFileId(acqFileProperty.Internal_Id);
var isOwned = takes.Any(x => x.IsThereSurplus.HasValue && x.IsThereSurplus.Value);

_propertyRepository.TransferFileProperty(property, isOwned);
}
}

private void AddNoteIfStatusChanged(PimsAcquisitionFile updateAcquisitionFile)
Expand Down
1 change: 1 addition & 0 deletions source/backend/api/Services/DocumentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class DocumentService : BaseService, IDocumentService
"gml",
"kml",
"kmz",
"msg",
};

private readonly IDocumentRepository documentRepository;
Expand Down
2 changes: 1 addition & 1 deletion source/backend/api/appsettings.Test.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"Pims": {
"Environment": {
"Uri": "https://tst-pims.th.gov.bc.ca",
"Uri": "https://pims-app-test-3cd915-dev.apps.silver.devops.gov.bc.ca",
"Name": "Testing"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ private IQueryable<PimsAcquisitionFile> GetCommonAquisitionFileQueryDeep(Acquisi
if (!string.IsNullOrWhiteSpace(filter.ProjectNameOrNumber))
{
predicate = predicate.And(acq => EF.Functions.Like(acq.Project.Code, $"%{filter.ProjectNameOrNumber}%") || EF.Functions.Like(acq.Project.Description, $"%{filter.ProjectNameOrNumber}%")
|| acq.PimsCompensationRequisitions.Any(cr => EF.Functions.Like(cr.AlternateProject.Code, $"%{filter.ProjectNameOrNumber}%") || acq.PimsCompensationRequisitions.Any(cr => EF.Functions.Like(cr.AlternateProject.Description, $"%{filter.ProjectNameOrNumber}%"))));
|| acq.PimsCompensationRequisitions.Any(cr => EF.Functions.Like(cr.AlternateProject.Code, $"%{filter.ProjectNameOrNumber}%") || EF.Functions.Like(cr.AlternateProject.Description, $"%{filter.ProjectNameOrNumber}%")));
}

predicate = predicate.And(acq => regions.Contains(acq.RegionCode));
Expand Down
1 change: 1 addition & 0 deletions source/backend/dal/Repositories/AgreementRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public List<PimsAgreement> GetAgreementsByAquisitionFile(long acquisitionFileId)
return Context.PimsAgreements
.Where(ci => ci.AcquisitionFileId == acquisitionFileId)
.Include(ci => ci.AgreementTypeCodeNavigation)
.Include(ci => ci.AgreementStatusTypeCodeNavigation)
.AsNoTracking()
.ToList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,7 @@ public interface ILookupRepository : IRepository
IEnumerable<PimsPropMgmtActivitySubtype> GetAllPropMgmtActivitySubtypes();

IEnumerable<PimsPropMgmtActivityType> GetAllPropMgmtActivityTypes();

IEnumerable<PimsAgreementStatusType> GetAllAgreementStatusTypes();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface IPropertyRepository : IRepository<PimsProperty>

void Delete(PimsProperty property);

PimsProperty TransferFileProperty(PimsProperty property, bool isOwned, bool isPropertyOfInterest);
PimsProperty TransferFileProperty(PimsProperty property, bool isOwned, bool isPropertyOfInterest = false);

HashSet<long> GetMatchingIds(PropertyFilterCriteria filter);
}
Expand Down
5 changes: 5 additions & 0 deletions source/backend/dal/Repositories/LookupRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ public IEnumerable<PimsPropMgmtActivityType> GetAllPropMgmtActivityTypes()
return Context.PimsPropMgmtActivityTypes.AsNoTracking().ToArray();
}

public IEnumerable<PimsAgreementStatusType> GetAllAgreementStatusTypes()
{
return Context.PimsAgreementStatusTypes.AsNoTracking().ToArray();
}

#endregion
}
}
Loading

0 comments on commit 3c3883f

Please sign in to comment.