Skip to content

Commit

Permalink
Scaffold/s77 (#3925)
Browse files Browse the repository at this point in the history
* Generated scaffold

* Fixed compilation. Note: The current code will not functionally work. Another PR will fix functionality
  • Loading branch information
FuriousLlama committed Apr 4, 2024
1 parent 06422b5 commit 5934152
Show file tree
Hide file tree
Showing 21 changed files with 121 additions and 82 deletions.
6 changes: 6 additions & 0 deletions source/backend/api/Services/AcquisitionFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ public PimsAcquisitionFile UpdateProperties(PimsAcquisitionFile acquisitionFile,
throw new BusinessRuleViolationException("You must remove all takes and interest holders from an acquisition file property before removing that property from an acquisition file");
}
_acquisitionFilePropertyRepository.Delete(deletedProperty);
/*
TODO: Fix mapings
if (deletedProperty.Property.IsPropertyOfInterest)
{
PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
Expand All @@ -357,6 +359,7 @@ public PimsAcquisitionFile UpdateProperties(PimsAcquisitionFile acquisitionFile,
_propertyRepository.Delete(deletedProperty.Property);
}
}
*/
}

_acqFileRepository.CommitTransaction();
Expand Down Expand Up @@ -788,6 +791,8 @@ private void TransferPropertiesOfInterest(PimsAcquisitionFile acquisitionFile, b
}

// PSP-7892: Follow ownership priority when updating an existing property
/*
TODO: Fix mapings
if (property.IsOwned || isOwned)
{
isOwned = true;
Expand Down Expand Up @@ -816,6 +821,7 @@ private void TransferPropertiesOfInterest(PimsAcquisitionFile acquisitionFile, b
{
throw new UserOverrideException(UserOverrideCode.PoiToInventory, "You have one or more take(s) that will be changed from 'Other Interest' to 'Core Inventory'. Do you want to acknowledge and proceed?");
}
*/

PropertyOwnershipState ownership = new() { isOwned = isOwned, isPropertyOfInterest = isPropertyOfInterest, isOtherInterest = isOtherInterest, isDisposed = false };
_propertyRepository.TransferFileProperty(property, ownership);
Expand Down
3 changes: 3 additions & 0 deletions source/backend/api/Services/DispositionFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ public PimsDispositionFile UpdateProperties(PimsDispositionFile dispositionFile,
foreach (var deletedProperty in differenceSet)
{
_dispositionFilePropertyRepository.Delete(deletedProperty);
/*
TODO: Fix mapings
if (deletedProperty.Property.IsPropertyOfInterest)
{
PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
Expand All @@ -534,6 +536,7 @@ public PimsDispositionFile UpdateProperties(PimsDispositionFile dispositionFile,
_propertyRepository.Delete(deletedProperty.Property);
}
}
*/
}

_dispositionFileRepository.CommitTransaction();
Expand Down
3 changes: 3 additions & 0 deletions source/backend/api/Services/LeaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ public PimsLease Update(PimsLease lease, IEnumerable<UserOverrideCode> userOverr
List<PimsPropertyLease> differenceSet = currentProperties.Where(x => !lease.PimsPropertyLeases.Any(y => y.Internal_Id == x.Internal_Id)).ToList();
foreach (var deletedProperty in differenceSet)
{
/*
TODO: Fix mapings
if (deletedProperty.Property.IsPropertyOfInterest)
{
PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
Expand All @@ -256,6 +258,7 @@ public PimsLease Update(PimsLease lease, IEnumerable<UserOverrideCode> userOverr
_propertyRepository.Delete(deletedProperty.Property);
}
}
*/
}

_leaseRepository.CommitTransaction();
Expand Down
2 changes: 1 addition & 1 deletion source/backend/api/Services/PropertyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public PimsProperty PopulateNewProperty(PimsProperty property, bool isOwned = fa
property.PropertyStatusTypeCode = "UNKNOWN";
property.SurplusDeclarationTypeCode = "UNKNOWN";

property.IsPropertyOfInterest = isPropertyOfInterest;
//property.IsPropertyOfInterest = isPropertyOfInterest; TODO: Fix mapings
property.IsOwned = isOwned;

if (property.Address != null)
Expand Down
5 changes: 4 additions & 1 deletion source/backend/api/Services/ResearchFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public PimsResearchFile UpdateProperties(PimsResearchFile researchFile, IEnumera
foreach (var deletedProperty in differenceSet)
{
_researchFilePropertyRepository.Delete(deletedProperty);
/*
TODO: Fix mapings
if (deletedProperty.Property.IsPropertyOfInterest == true)
{
PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
Expand All @@ -145,6 +147,7 @@ public PimsResearchFile UpdateProperties(PimsResearchFile researchFile, IEnumera
_propertyRepository.Delete(deletedProperty.Property);
}
}
*/
}

_researchFilePropertyRepository.CommitTransaction();
Expand Down Expand Up @@ -266,7 +269,7 @@ private void PopulateNewProperty(PimsProperty property)
property.PropertyStatusTypeCode = "UNKNOWN";
property.SurplusDeclarationTypeCode = "UNKNOWN";

property.IsPropertyOfInterest = true;
//property.IsPropertyOfInterest = true; TODO: Fix mapings

if (property.Address != null)
{
Expand Down
12 changes: 6 additions & 6 deletions source/backend/apimodels/Models/Concepts/Property/PropertyMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.PphStatusUpdateUserGuid, src => src.PphStatusUpdateUserGuid)
.Map(dest => dest.Notes, src => src.Notes)
.Map(dest => dest.IsOwned, src => src.IsOwned)
.Map(dest => dest.IsPropertyOfInterest, src => src.IsPropertyOfInterest)
.Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
.Map(dest => dest.IsDisposed, src => src.IsDisposed)
//.Map(dest => dest.IsPropertyOfInterest, src => src.IsPropertyOfInterest) TODO: Fix mappings
//.Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
//.Map(dest => dest.IsDisposed, src => src.IsDisposed)
.Map(dest => dest.IsVisibleToOtherAgencies, src => src.IsVisibleToOtherAgencies)

// multi-selects
Expand Down Expand Up @@ -95,9 +95,9 @@ public void Register(TypeAdapterConfig config)

.Map(dest => dest.Notes, src => src.Notes)
.Map(dest => dest.IsOwned, src => src.IsOwned)
.Map(dest => dest.IsPropertyOfInterest, src => src.IsPropertyOfInterest)
.Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
.Map(dest => dest.IsDisposed, src => src.IsDisposed)
//.Map(dest => dest.IsPropertyOfInterest, src => src.IsPropertyOfInterest)
//.Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
//.Map(dest => dest.IsDisposed, src => src.IsDisposed)
.Map(dest => dest.IsVisibleToOtherAgencies, src => src.IsVisibleToOtherAgencies)

// multi-selects
Expand Down
3 changes: 2 additions & 1 deletion source/backend/dal/Helpers/Extensions/PropertyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ private static ExpressionStarter<PimsProperty> GenerateCommonPropertyQuery(Claim
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsOwned && p.IsRetired != true);
}
/* TODO: Fix mapings
if (filter.Ownership.Contains("isPropertyOfInterest"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsPropertyOfInterest && p.IsRetired != true);
Expand All @@ -117,7 +118,7 @@ private static ExpressionStarter<PimsProperty> GenerateCommonPropertyQuery(Claim
if (filter.Ownership.Contains("isDisposed"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsDisposed && p.IsRetired != true);
}
}*/
}
else
{
Expand Down
10 changes: 6 additions & 4 deletions source/backend/dal/Repositories/PropertyRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public PimsProperty Update(PimsProperty property, bool overrideLocation = false)
property.SurplusDeclarationDate = existingProperty.SurplusDeclarationDate;
property.IsOwned = existingProperty.IsOwned;
property.IsRetired = existingProperty.IsRetired;
property.IsPropertyOfInterest = existingProperty.IsPropertyOfInterest;
//property.IsPropertyOfInterest = existingProperty.IsPropertyOfInterest; TODO: Fix mapings
property.IsVisibleToOtherAgencies = existingProperty.IsVisibleToOtherAgencies;
property.IsSensitive = existingProperty.IsSensitive;

Expand Down Expand Up @@ -415,10 +415,10 @@ public PimsProperty TransferFileProperty(PimsProperty property, PropertyOwnershi
var existingProperty = Context.PimsProperties
.FirstOrDefault(p => p.PropertyId == property.Internal_Id) ?? throw new KeyNotFoundException();

existingProperty.IsPropertyOfInterest = state.isPropertyOfInterest;
//existingProperty.IsPropertyOfInterest = state.isPropertyOfInterest;
existingProperty.IsOwned = state.isOwned;
existingProperty.IsDisposed = state.isDisposed;
existingProperty.IsOtherInterest = state.isOtherInterest;
//existingProperty.IsDisposed = state.isDisposed;
//existingProperty.IsOtherInterest = state.isOtherInterest;

if (state.isOwned)
{
Expand Down Expand Up @@ -520,6 +520,7 @@ public HashSet<long> GetMatchingIds(PropertyFilterCriteria filter)
{
ownershipBuilder.Or(p => p.IsOwned);
}
/* TODO: Fix mapings
if (filter.IsPropertyOfInterest)
{
ownershipBuilder.Or(p => p.IsPropertyOfInterest);
Expand All @@ -536,6 +537,7 @@ public HashSet<long> GetMatchingIds(PropertyFilterCriteria filter)
{
ownershipBuilder.Or(p => p.IsRetired.HasValue && p.IsRetired.Value);
}
*/

predicate.And(ownershipBuilder);

Expand Down
4 changes: 1 addition & 3 deletions source/backend/entities/PimsBaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5607,12 +5607,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.FileNumber).HasComment("The (ARCS/ORCS) number identifying the Property File.");
entity.Property(e => e.FileNumberSuffix).HasComment("A suffix to distinguish between Property Files with the same number.");
entity.Property(e => e.GeneralLocation).HasComment("Descriptive location of the property, primarily for H120 activities.");
entity.Property(e => e.IsDisposed).HasComment("Has the property currently in disposition status? This infers that the property was once owned by the Ministry but has since ceased to retain ownership of the property.");
entity.Property(e => e.IsOtherInterest).HasComment("Is this a property of other interest to the Ministry?");
entity.Property(e => e.IsOwned)
.HasDefaultValue(true)
.HasComment("Is the property currently owned?");
entity.Property(e => e.IsPropertyOfInterest).HasComment("Is this a property of interest to the Ministry?");
entity.Property(e => e.IsProvincialPublicHwy).HasComment("Is this property a provincial public highway?");
entity.Property(e => e.IsRetired).HasComment("If the property was the source of a subdivision operation or the target of a consolidation operation, the property is marked as retired.");
entity.Property(e => e.IsRwyBeltDomPatent)
Expand Down Expand Up @@ -7176,6 +7173,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())");
entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())");
entity.Property(e => e.CompletionDt).HasComment("Date the take was completed.");
entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValue(1L);
entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())");
Expand Down
18 changes: 0 additions & 18 deletions source/backend/entities/ef/PimsProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,6 @@ public partial class PimsProperty
[Column("IS_OWNED")]
public bool IsOwned { get; set; }

/// <summary>
/// Has the property currently in disposition status? This infers that the property was once owned by the Ministry but has since ceased to retain ownership of the property.
/// </summary>
[Column("IS_DISPOSED")]
public bool IsDisposed { get; set; }

/// <summary>
/// Is this a property of interest to the Ministry?
/// </summary>
[Column("IS_PROPERTY_OF_INTEREST")]
public bool IsPropertyOfInterest { get; set; }

/// <summary>
/// Is this a property of other interest to the Ministry?
/// </summary>
[Column("IS_OTHER_INTEREST")]
public bool IsOtherInterest { get; set; }

/// <summary>
/// Is the property visible to other agencies?
/// </summary>
Expand Down
21 changes: 12 additions & 9 deletions source/backend/entities/ef/PimsPropertyBoundaryVw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ public partial class PimsPropertyBoundaryVw
[Column("IS_OWNED")]
public bool IsOwned { get; set; }

[Column("IS_DISPOSED")]
public bool IsDisposed { get; set; }

[Column("IS_PROPERTY_OF_INTEREST")]
public bool IsPropertyOfInterest { get; set; }

[Column("IS_OTHER_INTEREST")]
public bool IsOtherInterest { get; set; }

[Column("IS_RETIRED")]
public bool? IsRetired { get; set; }

Expand All @@ -154,6 +145,18 @@ public partial class PimsPropertyBoundaryVw
[StringLength(100)]
public string ZoningPotential { get; set; }

[Column("IS_DISPOSED")]
public bool? IsDisposed { get; set; }

[Column("IS_OTHER_INTEREST")]
public bool? IsOtherInterest { get; set; }

[Column("HAS_ACTIVE_ACQUISITION_FILE")]
public bool? HasActiveAcquisitionFile { get; set; }

[Column("HAS_ACTIVE_RESEARCH_FILE")]
public bool? HasActiveResearchFile { get; set; }

[Column("IS_PAYABLE_LEASE")]
public bool? IsPayableLease { get; set; }

Expand Down
18 changes: 9 additions & 9 deletions source/backend/entities/ef/PimsPropertyHist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,6 @@ public partial class PimsPropertyHist
[Column("IS_OWNED")]
public bool IsOwned { get; set; }

[Column("IS_DISPOSED")]
public bool IsDisposed { get; set; }

[Column("IS_PROPERTY_OF_INTEREST")]
public bool IsPropertyOfInterest { get; set; }

[Column("IS_OTHER_INTEREST")]
public bool IsOtherInterest { get; set; }

[Column("IS_VISIBLE_TO_OTHER_AGENCIES")]
public bool IsVisibleToOtherAgencies { get; set; }

Expand Down Expand Up @@ -248,4 +239,13 @@ public partial class PimsPropertyHist

[Column("PROP_MGMT_ORG_ID")]
public long? PropMgmtOrgId { get; set; }

[Column("IS_DISPOSED")]
public bool? IsDisposed { get; set; }

[Column("IS_PROPERTY_OF_INTEREST")]
public bool? IsPropertyOfInterest { get; set; }

[Column("IS_OTHER_INTEREST")]
public bool? IsOtherInterest { get; set; }
}
21 changes: 12 additions & 9 deletions source/backend/entities/ef/PimsPropertyLocationVw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ public partial class PimsPropertyLocationVw
[Column("IS_OWNED")]
public bool IsOwned { get; set; }

[Column("IS_DISPOSED")]
public bool IsDisposed { get; set; }

[Column("IS_PROPERTY_OF_INTEREST")]
public bool IsPropertyOfInterest { get; set; }

[Column("IS_OTHER_INTEREST")]
public bool IsOtherInterest { get; set; }

[Column("IS_RETIRED")]
public bool? IsRetired { get; set; }

Expand All @@ -154,6 +145,18 @@ public partial class PimsPropertyLocationVw
[StringLength(100)]
public string ZoningPotential { get; set; }

[Column("IS_DISPOSED")]
public bool? IsDisposed { get; set; }

[Column("IS_OTHER_INTEREST")]
public bool? IsOtherInterest { get; set; }

[Column("HAS_ACTIVE_ACQUISITION_FILE")]
public bool? HasActiveAcquisitionFile { get; set; }

[Column("HAS_ACTIVE_RESEARCH_FILE")]
public bool? HasActiveResearchFile { get; set; }

[Column("IS_PAYABLE_LEASE")]
public bool? IsPayableLease { get; set; }

Expand Down
6 changes: 6 additions & 0 deletions source/backend/entities/ef/PimsTake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public partial class PimsTake
[StringLength(4000)]
public string Description { get; set; }

/// <summary>
/// Date the take was completed.
/// </summary>
[Column("COMPLETION_DT")]
public DateOnly? CompletionDt { get; set; }

/// <summary>
/// Is there a new right of way? (default = FALSE)
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions source/backend/entities/ef/PimsTakeHist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public partial class PimsTakeHist
[StringLength(4000)]
public string Description { get; set; }

[Column("COMPLETION_DT")]
public DateOnly? CompletionDt { get; set; }

[Column("IS_NEW_HIGHWAY_DEDICATION")]
public bool IsNewHighwayDedication { get; set; }

Expand Down
3 changes: 3 additions & 0 deletions source/backend/tests/core/Entities/PropertyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public static PimsProperty CreateProperty(int pid, int? pin = null, PimsProperty
{
property.IsOwned = isCoreInventory.Value;
}
/*
TODO: Fix mapings
if (isPointOfInterest.HasValue)
{
property.IsPropertyOfInterest = isPointOfInterest.Value;
Expand All @@ -72,6 +74,7 @@ public static PimsProperty CreateProperty(int pid, int? pin = null, PimsProperty
{
property.IsRetired = isRetired.Value;
}
*/

return property;
}
Expand Down
Loading

0 comments on commit 5934152

Please sign in to comment.