Skip to content

Commit

Permalink
add date and time aliases to frontend. Add model typing to backend.
Browse files Browse the repository at this point in the history
frontend/backend now use typings to better reflect desired use of field (id timestamp vs dateonly).
  • Loading branch information
devinleighsmith committed Nov 14, 2023
1 parent bedc627 commit d262e1a
Show file tree
Hide file tree
Showing 75 changed files with 288 additions and 201 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Mapster;
using Pims.Core.Extensions;
using Pims.Dal.Helpers.Extensions;
using Entity = Pims.Dal.Entities;

Expand All @@ -21,8 +22,8 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.FundingTypeCode, src => src.AcquisitionFundingTypeCodeNavigation)
.Map(dest => dest.FundingOther, src => src.FundingOther)
.Map(dest => dest.AssignedDate, src => src.AssignedDate)
.Map(dest => dest.DeliveryDate, src => src.DeliveryDate)
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.DeliveryDate, src => src.DeliveryDate.ToNullableDateOnly())
.Map(dest => dest.CompletionDate, src => src.CompletionDate.ToNullableDateOnly())
.Map(dest => dest.TotalAllowableCompensation, src => src.TotalAllowableCompensation)
.Map(dest => dest.FileStatusTypeCode, src => src.AcquisitionFileStatusTypeCodeNavigation)
.Map(dest => dest.AcquisitionPhysFileStatusTypeCode, src => src.AcqPhysFileStatusTypeCodeNavigation)
Expand All @@ -48,8 +49,8 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.AcquisitionFundingTypeCode, src => src.FundingTypeCode.Id)
.Map(dest => dest.FundingOther, src => src.FundingOther)
.Map(dest => dest.AssignedDate, src => src.AssignedDate)
.Map(dest => dest.DeliveryDate, src => src.DeliveryDate)
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.DeliveryDate, src => src.DeliveryDate.ToNullableDateTime())
.Map(dest => dest.CompletionDate, src => src.CompletionDate.ToNullableDateTime())
.Map(dest => dest.TotalAllowableCompensation, src => src.TotalAllowableCompensation)
.Map(dest => dest.AcquisitionFileStatusTypeCode, src => src.FileStatusTypeCode.Id)
.Map(dest => dest.AcqPhysFileStatusTypeCode, src => src.AcquisitionPhysFileStatusTypeCode.Id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public class AcquisitionFileModel : FileModel
/// <summary>
/// The date for delivery of the property to the project.
/// </summary>
public DateTime? DeliveryDate { get; set; }
public DateOnly? DeliveryDate { get; set; }

/// <summary>
/// The date of acquisition file completion.
/// </summary>
public DateTime? CompletionDate { get; set; }
public DateOnly? CompletionDate { get; set; }

/// <summary>
/// get/set - The acquisition physical file status type.
Expand Down
33 changes: 17 additions & 16 deletions source/backend/api/Models/Concepts/AcquisitionFile/AgreementMap.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Mapster;
using Pims.Core.Extensions;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts
Expand All @@ -11,40 +12,40 @@ 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.AgreementDate, src => src.AgreementDate)
.Map(dest => dest.AgreementDate, src => src.AgreementDate.ToNullableDateOnly())
.Map(dest => dest.IsDraft, src => src.IsDraft)
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.CommencementDate, src => src.CommencementDate)
.Map(dest => dest.PossessionDate, src => src.PossessionDate)
.Map(dest => dest.CompletionDate, src => src.CompletionDate.ToNullableDateOnly())
.Map(dest => dest.TerminationDate, src => src.TerminationDate.ToNullableDateOnly())
.Map(dest => dest.CommencementDate, src => src.CommencementDate.ToNullableDateOnly())
.Map(dest => dest.PossessionDate, src => src.PossessionDate.ToNullableDateOnly())
.Map(dest => dest.DepositAmount, src => src.DepositAmount)
.Map(dest => dest.NoLaterThanDays, src => src.NoLaterThanDays)
.Map(dest => dest.PurchasePrice, src => src.PurchasePrice)
.Map(dest => dest.LegalSurveyPlanNum, src => src.LegalSurveyPlanNum)
.Map(dest => dest.OfferDate, src => src.OfferDate)
.Map(dest => dest.OfferDate, src => src.OfferDate.ToNullableDateOnly())
.Map(dest => dest.ExpiryDateTime, src => src.ExpiryTs)
.Map(dest => dest.SignedDate, src => src.SignedDate)
.Map(dest => dest.InspectionDate, src => src.InspectionDate)
.Map(dest => dest.SignedDate, src => src.SignedDate.ToNullableDateOnly())
.Map(dest => dest.InspectionDate, src => src.InspectionDate.ToNullableDateOnly())
.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.AgreementDate, src => src.AgreementDate)
.Map(dest => dest.AgreementDate, src => src.AgreementDate.ToNullableDateTime())
.Map(dest => dest.IsDraft, src => src.IsDraft)
.Map(dest => dest.CompletionDate, src => src.CompletionDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.CommencementDate, src => src.CommencementDate)
.Map(dest => dest.PossessionDate, src => src.PossessionDate)
.Map(dest => dest.CompletionDate, src => src.CompletionDate.ToNullableDateTime())
.Map(dest => dest.TerminationDate, src => src.TerminationDate.ToNullableDateTime())
.Map(dest => dest.CommencementDate, src => src.CommencementDate.ToNullableDateTime())
.Map(dest => dest.PossessionDate, src => src.PossessionDate.ToNullableDateTime())
.Map(dest => dest.DepositAmount, src => src.DepositAmount)
.Map(dest => dest.NoLaterThanDays, src => src.NoLaterThanDays)
.Map(dest => dest.PurchasePrice, src => src.PurchasePrice)
.Map(dest => dest.LegalSurveyPlanNum, src => src.LegalSurveyPlanNum)
.Map(dest => dest.OfferDate, src => src.OfferDate)
.Map(dest => dest.OfferDate, src => src.OfferDate.ToNullableDateTime())
.Map(dest => dest.ExpiryTs, src => src.ExpiryDateTime)
.Map(dest => dest.SignedDate, src => src.SignedDate)
.Map(dest => dest.InspectionDate, src => src.InspectionDate)
.Map(dest => dest.SignedDate, src => src.SignedDate.ToNullableDateTime())
.Map(dest => dest.InspectionDate, src => src.InspectionDate.ToNullableDateTime())
.Inherits<BaseAppModel, Entity.IBaseAppEntity>();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public class AgreementModel : BaseAppModel

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

public DateTime? AgreementDate { get; set; }
public DateOnly? AgreementDate { get; set; }

public bool? IsDraft { get; set; }

public DateTime? CompletionDate { get; set; }
public DateOnly? CompletionDate { get; set; }

public DateTime? TerminationDate { get; set; }
public DateOnly? TerminationDate { get; set; }

public DateTime? CommencementDate { get; set; }
public DateOnly? CommencementDate { get; set; }

public DateTime? PossessionDate { get; set; }
public DateOnly? PossessionDate { get; set; }

public decimal? DepositAmount { get; set; }

Expand All @@ -30,12 +30,12 @@ public class AgreementModel : BaseAppModel

public string LegalSurveyPlanNum { get; set; }

public DateTime? OfferDate { get; set; }
public DateOnly? OfferDate { get; set; }

public DateTime? ExpiryDateTime { get; set; }

public DateTime? SignedDate { get; set; }
public DateOnly? SignedDate { get; set; }

public DateTime? InspectionDate { get; set; }
public DateOnly? InspectionDate { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Mapster;
using Pims.Core.Extensions;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts
Expand All @@ -19,11 +20,11 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.ChartOfAccounts, src => src.ChartOfAccounts)
.Map(dest => dest.ResponsibilityId, src => src.ResponsibilityId)
.Map(dest => dest.Responsibility, src => src.Responsibility)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate)
.Map(dest => dest.AgreementDate, src => src.AgreementDt)
.Map(dest => dest.ExpropriationNoticeServedDate, src => src.ExpropNoticeServedDt)
.Map(dest => dest.ExpropriationVestingDate, src => src.ExpropVestingDt)
.Map(dest => dest.GenerationDate, src => src.GenerationDt)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate.ToNullableDateOnly())
.Map(dest => dest.AgreementDate, src => src.AgreementDt.ToNullableDateOnly())
.Map(dest => dest.ExpropriationNoticeServedDate, src => src.ExpropNoticeServedDt.ToNullableDateOnly())
.Map(dest => dest.ExpropriationVestingDate, src => src.ExpropVestingDt.ToNullableDateOnly())
.Map(dest => dest.GenerationDate, src => src.GenerationDt.ToNullableDateOnly())
.Map(dest => dest.Financials, src => src.PimsCompReqFinancials)
.Map(dest => dest.AcquisitionOwnerId, src => src.AcquisitionOwnerId)
.Map(dest => dest.AcquisitionOwner, src => src.AcquisitionOwner)
Expand All @@ -35,7 +36,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.IsPaymentInTrust, src => src.IsPaymentInTrust)
.Map(dest => dest.GstNumber, src => src.GstNumber)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate)
.Map(dest => dest.AdvancedPaymentServedDate, src => src.AdvPmtServedDt)
.Map(dest => dest.AdvancedPaymentServedDate, src => src.AdvPmtServedDt.ToNullableDateOnly())
.Map(dest => dest.SpecialInstruction, src => src.SpecialInstruction)
.Map(dest => dest.DetailedRemarks, src => src.DetailedRemarks)
.Map(dest => dest.AlternateProjectId, src => src.AlternateProjectId)
Expand All @@ -50,12 +51,12 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.YearlyFinancialId, src => src.YearlyFinancialId)
.Map(dest => dest.ChartOfAccountsId, src => src.ChartOfAccountsId)
.Map(dest => dest.ResponsibilityId, src => src.ResponsibilityId)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate)
.Map(dest => dest.AgreementDt, src => src.AgreementDate)
.Map(dest => dest.ExpropNoticeServedDt, src => src.ExpropriationNoticeServedDate)
.Map(dest => dest.ExpropVestingDt, src => src.ExpropriationVestingDate)
.Map(dest => dest.AdvPmtServedDt, src => src.AdvancedPaymentServedDate)
.Map(dest => dest.GenerationDt, src => src.GenerationDate)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate.ToNullableDateTime())
.Map(dest => dest.AgreementDt, src => src.AgreementDate.ToNullableDateTime())
.Map(dest => dest.ExpropNoticeServedDt, src => src.ExpropriationNoticeServedDate.ToNullableDateTime())
.Map(dest => dest.ExpropVestingDt, src => src.ExpropriationVestingDate.ToNullableDateTime())
.Map(dest => dest.AdvPmtServedDt, src => src.AdvancedPaymentServedDate.ToNullableDateTime())
.Map(dest => dest.GenerationDt, src => src.GenerationDate.ToNullableDateTime())
.Map(dest => dest.PimsCompReqFinancials, src => src.Financials)
.Map(dest => dest.AcquisitionOwnerId, src => src.AcquisitionOwnerId)
.Map(dest => dest.InterestHolderId, src => src.InterestHolderId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ public class CompensationRequisitionModel : BaseAppModel

public FinancialCodeModel Responsibility { get; set; }

public DateTime? FinalizedDate { get; set; }
public DateOnly? FinalizedDate { get; set; }

public DateTime? AgreementDate { get; set; }
public DateOnly? AgreementDate { get; set; }

public DateTime? ExpropriationNoticeServedDate { get; set; }
public DateOnly? ExpropriationNoticeServedDate { get; set; }

public DateTime? ExpropriationVestingDate { get; set; }
public DateOnly? ExpropriationVestingDate { get; set; }

public DateTime? AdvancedPaymentServedDate { get; set; }
public DateOnly? AdvancedPaymentServedDate { get; set; }

public DateTime? GenerationDate { get; set; }
public DateOnly? GenerationDate { get; set; }

public List<CompensationFinancialModel> Financials { get; set; }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using Mapster;
using Pims.Core.Extensions;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts
Expand All @@ -12,7 +14,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.LeaseId, src => src.LeaseId)
.Map(dest => dest.Description, src => src.Description)
.Map(dest => dest.AmountPaid, src => src.AmountPaid)
.Map(dest => dest.DepositDate, src => src.DepositDate)
.Map(dest => dest.DepositDateOnly, src => DateOnly.FromDateTime(src.DepositDate))
.Map(dest => dest.DepositType, src => src.SecurityDepositTypeCodeNavigation)
.Map(dest => dest.OtherTypeDescription, src => src.OtherDepositTypeDesc)
.Map(dest => dest.DepositReturns, src => src.PimsSecurityDepositReturns)
Expand All @@ -23,7 +25,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.SecurityDepositId, src => src.Id)
.Map(dest => dest.Description, src => src.Description)
.Map(dest => dest.AmountPaid, src => src.AmountPaid)
.Map(dest => dest.DepositDate, src => src.DepositDate)
.Map(dest => dest.DepositDate, src => src.DepositDateOnly.ToNullableDateTime())
.Map(dest => dest.SecurityDepositTypeCode, src => src.DepositType.Id)
.Map(dest => dest.OtherDepositTypeDesc, src => src.OtherTypeDescription)
.Map(dest => dest.PimsSecurityDepositHolder, src => src.ContactHolder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class SecurityDepositModel : BaseModel
/// <summary>
/// get/set - Security deposit date.
/// </summary>
public DateTime? DepositDate { get; set; }
public DateOnly? DepositDateOnly { get; set; }

/// <summary>
/// get/set - Security deposit type.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Mapster;
using System;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts
Expand All @@ -10,22 +11,22 @@ public void Register(TypeAdapterConfig config)
config.NewConfig<Entity.PimsSecurityDepositReturn, SecurityDepositReturnModel>()
.Map(dest => dest.Id, src => src.SecurityDepositReturnId)
.Map(dest => dest.ParentDepositId, src => src.SecurityDepositId)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.TerminationDate, src => DateOnly.FromDateTime(src.TerminationDate))
.Map(dest => dest.ClaimsAgainst, src => src.ClaimsAgainst)
.Map(dest => dest.ReturnAmount, src => src.ReturnAmount)
.Map(dest => dest.InterestPaid, src => src.InterestPaid)
.Map(dest => dest.ReturnDate, src => src.ReturnDate)
.Map(dest => dest.ReturnDate, src => DateOnly.FromDateTime(src.ReturnDate))
.Map(dest => dest.ContactHolder, src => src.PimsSecurityDepositReturnHolder)
.Inherits<Entity.IBaseEntity, BaseModel>();

config.NewConfig<SecurityDepositReturnModel, Entity.PimsSecurityDepositReturn>()
.Map(dest => dest.SecurityDepositReturnId, src => src.Id)
.Map(dest => dest.SecurityDepositId, src => src.ParentDepositId)
.Map(dest => dest.TerminationDate, src => src.TerminationDate)
.Map(dest => dest.TerminationDate, src => src.TerminationDate.ToDateTime(TimeOnly.MinValue))
.Map(dest => dest.ClaimsAgainst, src => src.ClaimsAgainst)
.Map(dest => dest.ReturnAmount, src => src.ReturnAmount)
.Map(dest => dest.InterestPaid, src => src.InterestPaid)
.Map(dest => dest.ReturnDate, src => src.ReturnDate)
.Map(dest => dest.ReturnDate, src => src.ReturnDate.ToDateTime(TimeOnly.MinValue))
.Map(dest => dest.PimsSecurityDepositReturnHolder, src => src.ContactHolder)
.Inherits<BaseModel, Entity.IBaseEntity>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class SecurityDepositReturnModel : BaseModel
/// <summary>
/// get/set - The termination date of the deposit.
/// </summary>
public DateTime TerminationDate { get; set; }
public DateOnly TerminationDate { get; set; }

/// <summary>
/// get/set - any claims made against the deposit total, reducing the returned amount.
Expand All @@ -42,7 +42,7 @@ public class SecurityDepositReturnModel : BaseModel
/// <summary>
/// get/set - The date when the deposit was returned.
/// </summary>
public DateTime ReturnDate { get; set; }
public DateOnly ReturnDate { get; set; }

/// <summary>
/// get/set - Contact Holder.
Expand Down
10 changes: 6 additions & 4 deletions source/backend/api/Models/Concepts/Lease/LeaseMap.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Mapster;
using Pims.Api.Helpers.Extensions;
using Pims.Core.Extensions;
using Pims.Dal.Helpers.Extensions;
using System;
using Entity = Pims.Dal.Entities;

namespace Pims.Api.Models.Concepts
Expand All @@ -19,8 +21,8 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.TfaFileNumber, src => src.TfaFileNumber)
.Map(dest => dest.PsFileNo, src => src.PsFileNo)
.Map(dest => dest.MotiName, src => src.GetMotiName())
.Map(dest => dest.ExpiryDate, src => src.GetExpiryDate())
.Map(dest => dest.StartDate, src => src.OrigStartDate)
.Map(dest => dest.ExpiryDate, src => src.GetExpiryDate().ToNullableDateOnly())
.Map(dest => dest.StartDate, src => DateOnly.FromDateTime(src.OrigStartDate))
.Map(dest => dest.ProgramName, src => src.GetProgramName())
.Map(dest => dest.OtherCategoryType, src => src.LeaseCategoryOtherDesc)
.Map(dest => dest.OtherProgramType, src => src.OtherLeaseProgramType)
Expand Down Expand Up @@ -66,8 +68,8 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.OtherLeasePurposeType, src => src.OtherPurposeType)
.Map(dest => dest.LeasePurposeOtherDesc, src => src.OtherPurposeType)
.Map(dest => dest.OtherLeaseLicenseType, src => src.OtherType)
.Map(dest => dest.OrigExpiryDate, src => src.ExpiryDate)
.Map(dest => dest.OrigStartDate, src => src.StartDate)
.Map(dest => dest.OrigExpiryDate, src => src.ExpiryDate.ToNullableDateTime())
.Map(dest => dest.OrigStartDate, src => src.StartDate.ToNullableDateTime())
.Map(dest => dest.RegionCode, src => src.Region.Id)
.Map(dest => dest.LeaseProgramTypeCode, src => src.ProgramType.GetTypeId())
.Map(dest => dest.LeasePayRvblTypeCode, src => src.PaymentReceivableType.GetTypeId())
Expand Down
Loading

0 comments on commit d262e1a

Please sign in to comment.