From a6071df9cd22e62762199ea6a12993d09e839d87 Mon Sep 17 00:00:00 2001 From: Manuel Rodriguez Date: Tue, 14 Nov 2023 13:01:30 -0800 Subject: [PATCH 1/2] Generated scaffold --- source/backend/entities/PimsBaseContext.cs | 51 +++++++++++++++++-- source/backend/entities/ef/PimsAgreement.cs | 13 ++++- .../backend/entities/ef/PimsAgreementHist.cs | 9 +++- .../entities/ef/PimsAgreementStatusType.cs | 49 ++++++++++++++++++ .../entities/ef/PimsPropertyBoundaryVw.cs | 6 +++ .../entities/ef/PimsPropertyLocationVw.cs | 6 +++ 6 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 source/backend/entities/ef/PimsAgreementStatusType.cs diff --git a/source/backend/entities/PimsBaseContext.cs b/source/backend/entities/PimsBaseContext.cs index 80703fc0ce..9360a3eca4 100644 --- a/source/backend/entities/PimsBaseContext.cs +++ b/source/backend/entities/PimsBaseContext.cs @@ -50,6 +50,7 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsAddressUsageTypes { get; set; } public virtual DbSet PimsAgreements { get; set; } public virtual DbSet PimsAgreementHists { get; set; } + public virtual DbSet PimsAgreementStatusTypes { get; set; } public virtual DbSet PimsAgreementTypes { get; set; } public virtual DbSet PimsAreaUnitTypes { get; set; } public virtual DbSet PimsBusinessFunctionCodes { get; set; } @@ -1207,6 +1208,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.AgreementDate).HasComment("Date of the agreement."); + entity.Property(e => e.AgreementStatusTypeCode).HasDefaultValueSql("('DRAFT')"); + entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())"); entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())"); @@ -1219,6 +1222,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())"); + entity.Property(e => e.CancellationNote).HasComment("Note pertaining to the cancellation of the agreement."); + entity.Property(e => e.CommencementDate).HasComment("Date of commencement of the agreement."); entity.Property(e => e.CompletionDate).HasComment("Date of completion of the agreement."); @@ -1241,10 +1246,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.InspectionDate).HasComment("Date of inspection."); - entity.Property(e => e.IsDraft) - .HasDefaultValueSql("(CONVERT([bit],(1)))") - .HasComment("Status of the agreement (currently TRUE/FALSE). Defaults to TRUE."); - entity.Property(e => e.LegalSurveyPlanNum).HasComment("Legal survey plan number,"); entity.Property(e => e.NoLaterThanDays).HasComment("Deposit due date"); @@ -1265,6 +1266,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("PIM_ACQNFL_PIM_AGRMNT_FK"); + entity.HasOne(d => d.AgreementStatusTypeCodeNavigation) + .WithMany(p => p.PimsAgreements) + .HasForeignKey(d => d.AgreementStatusTypeCode) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_AGRSTY_PIM_AGRMNT_FK"); + entity.HasOne(d => d.AgreementTypeCodeNavigation) .WithMany(p => p.PimsAgreements) .HasForeignKey(d => d.AgreementTypeCode) @@ -1282,6 +1289,34 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.AgreementStatusTypeCode) + .HasName("AGRSTY_PK"); + + entity.HasComment("Table that contains the codes and associated descriptions of the agreement types."); + + entity.Property(e => e.AgreementStatusTypeCode).HasComment("Codified version of the agreement status."); + + entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValueSql("((1))"); + + entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())"); + + entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())"); + + entity.Property(e => e.Description).HasComment("Description of the agreement status type."); + + entity.Property(e => e.DisplayOrder).HasComment("Display order of the codes."); + + entity.Property(e => e.IsDisabled) + .HasDefaultValueSql("(CONVERT([bit],(0)))") + .HasComment("Indicates if the code value is inactive."); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.AgreementTypeCode) @@ -7965,6 +8000,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMin(1) .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_FILE_ENTITY_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + + modelBuilder.HasSequence("PIMS_FILE_ENTITY_PERMISSIONS_ID_SEQ") + .HasMin(1) + .HasMax(2147483647); + modelBuilder.HasSequence("PIMS_FINANCIAL_ACTIVITY_CODE_H_ID_SEQ") .HasMin(1) .HasMax(2147483647); diff --git a/source/backend/entities/ef/PimsAgreement.cs b/source/backend/entities/ef/PimsAgreement.cs index 6ec9bfda99..be4daef3a7 100644 --- a/source/backend/entities/ef/PimsAgreement.cs +++ b/source/backend/entities/ef/PimsAgreement.cs @@ -10,6 +10,7 @@ namespace Pims.Dal.Entities { [Table("PIMS_AGREEMENT")] [Index(nameof(AcquisitionFileId), Name = "AGRMNT_ACQUISITION_FILE_ID_IDX")] + [Index(nameof(AgreementStatusTypeCode), Name = "AGRMNT_AGREEMENT_STATUS_TYPE_CODE_IDX")] [Index(nameof(AgreementTypeCode), Name = "AGRMNT_AGREEMENT_TYPE_CODE_IDX")] public partial class PimsAgreement { @@ -22,10 +23,12 @@ public partial class PimsAgreement [Column("AGREEMENT_TYPE_CODE")] [StringLength(20)] public string AgreementTypeCode { get; set; } + [Required] + [Column("AGREEMENT_STATUS_TYPE_CODE")] + [StringLength(20)] + public string AgreementStatusTypeCode { get; set; } [Column("AGREEMENT_DATE", TypeName = "date")] public DateTime? AgreementDate { get; set; } - [Column("IS_DRAFT")] - public bool? IsDraft { get; set; } [Column("COMPLETION_DATE", TypeName = "date")] public DateTime? CompletionDate { get; set; } [Column("TERMINATION_DATE", TypeName = "date")] @@ -53,6 +56,9 @@ public partial class PimsAgreement public DateTime? ExpropriationDate { get; set; } [Column("POSSESSION_DATE", TypeName = "date")] public DateTime? PossessionDate { get; set; } + [Column("CANCELLATION_NOTE")] + [StringLength(2000)] + public string CancellationNote { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] @@ -95,6 +101,9 @@ public partial class PimsAgreement [ForeignKey(nameof(AcquisitionFileId))] [InverseProperty(nameof(PimsAcquisitionFile.PimsAgreements))] public virtual PimsAcquisitionFile AcquisitionFile { get; set; } + [ForeignKey(nameof(AgreementStatusTypeCode))] + [InverseProperty(nameof(PimsAgreementStatusType.PimsAgreements))] + public virtual PimsAgreementStatusType AgreementStatusTypeCodeNavigation { get; set; } [ForeignKey(nameof(AgreementTypeCode))] [InverseProperty(nameof(PimsAgreementType.PimsAgreements))] public virtual PimsAgreementType AgreementTypeCodeNavigation { get; set; } diff --git a/source/backend/entities/ef/PimsAgreementHist.cs b/source/backend/entities/ef/PimsAgreementHist.cs index fd7e11fa30..6e1b923175 100644 --- a/source/backend/entities/ef/PimsAgreementHist.cs +++ b/source/backend/entities/ef/PimsAgreementHist.cs @@ -27,10 +27,12 @@ public partial class PimsAgreementHist [Column("AGREEMENT_TYPE_CODE")] [StringLength(20)] public string AgreementTypeCode { get; set; } + [Required] + [Column("AGREEMENT_STATUS_TYPE_CODE")] + [StringLength(20)] + public string AgreementStatusTypeCode { get; set; } [Column("AGREEMENT_DATE", TypeName = "date")] public DateTime? AgreementDate { get; set; } - [Column("IS_DRAFT")] - public bool? IsDraft { get; set; } [Column("COMPLETION_DATE", TypeName = "date")] public DateTime? CompletionDate { get; set; } [Column("TERMINATION_DATE", TypeName = "date")] @@ -58,6 +60,9 @@ public partial class PimsAgreementHist public DateTime? ExpropriationDate { get; set; } [Column("POSSESSION_DATE", TypeName = "date")] public DateTime? PossessionDate { get; set; } + [Column("CANCELLATION_NOTE")] + [StringLength(2000)] + public string CancellationNote { get; set; } [Column("CONCURRENCY_CONTROL_NUMBER")] public long ConcurrencyControlNumber { get; set; } [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")] diff --git a/source/backend/entities/ef/PimsAgreementStatusType.cs b/source/backend/entities/ef/PimsAgreementStatusType.cs new file mode 100644 index 0000000000..3f0d0c081c --- /dev/null +++ b/source/backend/entities/ef/PimsAgreementStatusType.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +#nullable disable + +namespace Pims.Dal.Entities +{ + [Table("PIMS_AGREEMENT_STATUS_TYPE")] + public partial class PimsAgreementStatusType + { + public PimsAgreementStatusType() + { + PimsAgreements = new HashSet(); + } + + [Key] + [Column("AGREEMENT_STATUS_TYPE_CODE")] + [StringLength(20)] + public string AgreementStatusTypeCode { get; set; } + [Required] + [Column("DESCRIPTION")] + [StringLength(200)] + public string Description { get; set; } + [Column("DISPLAY_ORDER")] + public int? DisplayOrder { get; set; } + [Column("IS_DISABLED")] + public bool? IsDisabled { get; set; } + [Column("CONCURRENCY_CONTROL_NUMBER")] + public long ConcurrencyControlNumber { get; set; } + [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbCreateTimestamp { get; set; } + [Required] + [Column("DB_CREATE_USERID")] + [StringLength(30)] + public string DbCreateUserid { get; set; } + [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbLastUpdateTimestamp { get; set; } + [Required] + [Column("DB_LAST_UPDATE_USERID")] + [StringLength(30)] + public string DbLastUpdateUserid { get; set; } + + [InverseProperty(nameof(PimsAgreement.AgreementStatusTypeCodeNavigation))] + public virtual ICollection PimsAgreements { get; set; } + } +} diff --git a/source/backend/entities/ef/PimsPropertyBoundaryVw.cs b/source/backend/entities/ef/PimsPropertyBoundaryVw.cs index 9da2dbca53..dcc74c63f4 100644 --- a/source/backend/entities/ef/PimsPropertyBoundaryVw.cs +++ b/source/backend/entities/ef/PimsPropertyBoundaryVw.cs @@ -112,5 +112,11 @@ public partial class PimsPropertyBoundaryVw public string ZoningPotential { get; set; } [Column("IS_PAYABLE_LEASE")] public bool? IsPayableLease { get; set; } + [Column("IS_ACTIVE_PAYABLE_LEASE")] + public bool? IsActivePayableLease { get; set; } + [Column("IS_RECEIVABLE_LEASE")] + public bool? IsReceivableLease { get; set; } + [Column("IS_ACTIVE_RECEIVABLE_LEASE")] + public bool? IsActiveReceivableLease { get; set; } } } diff --git a/source/backend/entities/ef/PimsPropertyLocationVw.cs b/source/backend/entities/ef/PimsPropertyLocationVw.cs index 6d8f26c84c..799e62e5b1 100644 --- a/source/backend/entities/ef/PimsPropertyLocationVw.cs +++ b/source/backend/entities/ef/PimsPropertyLocationVw.cs @@ -112,5 +112,11 @@ public partial class PimsPropertyLocationVw public string ZoningPotential { get; set; } [Column("IS_PAYABLE_LEASE")] public bool? IsPayableLease { get; set; } + [Column("IS_ACTIVE_PAYABLE_LEASE")] + public bool? IsActivePayableLease { get; set; } + [Column("IS_RECEIVABLE_LEASE")] + public bool? IsReceivableLease { get; set; } + [Column("IS_ACTIVE_RECEIVABLE_LEASE")] + public bool? IsActiveReceivableLease { get; set; } } } From c2e8e3dc5f32009688b979bc5ae4595d4e2e9ec2 Mon Sep 17 00:00:00 2001 From: Manuel Rodriguez Date: Tue, 14 Nov 2023 14:18:52 -0800 Subject: [PATCH 2/2] Fixed api compilation --- .../Areas/Reports/Models/Acquisition/AgreementReportModel.cs | 2 +- .../api/Models/Concepts/AcquisitionFile/AgreementMap.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/backend/api/Areas/Reports/Models/Acquisition/AgreementReportModel.cs b/source/backend/api/Areas/Reports/Models/Acquisition/AgreementReportModel.cs index 08d5dff577..135062f395 100644 --- a/source/backend/api/Areas/Reports/Models/Acquisition/AgreementReportModel.cs +++ b/source/backend/api/Areas/Reports/Models/Acquisition/AgreementReportModel.cs @@ -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); diff --git a/source/backend/api/Models/Concepts/AcquisitionFile/AgreementMap.cs b/source/backend/api/Models/Concepts/AcquisitionFile/AgreementMap.cs index 8b745c5f2d..5e4eab7ad3 100644 --- a/source/backend/api/Models/Concepts/AcquisitionFile/AgreementMap.cs +++ b/source/backend/api/Models/Concepts/AcquisitionFile/AgreementMap.cs @@ -12,7 +12,7 @@ public void Register(TypeAdapterConfig config) .Map(dest => dest.AcquisitionFileId, src => src.AcquisitionFileId) .Map(dest => dest.AgreementType, src => src.AgreementTypeCodeNavigation) .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) @@ -32,7 +32,7 @@ public void Register(TypeAdapterConfig config) .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.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)