Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffold 67 #3593

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
51 changes: 47 additions & 4 deletions source/backend/entities/PimsBaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public PimsBaseContext(DbContextOptions<PimsBaseContext> options)
public virtual DbSet<PimsAddressUsageType> PimsAddressUsageTypes { get; set; }
public virtual DbSet<PimsAgreement> PimsAgreements { get; set; }
public virtual DbSet<PimsAgreementHist> PimsAgreementHists { get; set; }
public virtual DbSet<PimsAgreementStatusType> PimsAgreementStatusTypes { get; set; }
public virtual DbSet<PimsAgreementType> PimsAgreementTypes { get; set; }
public virtual DbSet<PimsAreaUnitType> PimsAreaUnitTypes { get; set; }
public virtual DbSet<PimsBusinessFunctionCode> PimsBusinessFunctionCodes { get; set; }
Expand Down Expand Up @@ -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())");
Expand All @@ -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.");
Expand All @@ -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");
Expand All @@ -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)
Expand All @@ -1282,6 +1289,34 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())");
});

modelBuilder.Entity<PimsAgreementStatusType>(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<PimsAgreementType>(entity =>
{
entity.HasKey(e => e.AgreementTypeCode)
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 11 additions & 2 deletions source/backend/entities/ef/PimsAgreement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -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; }
Expand Down
9 changes: 7 additions & 2 deletions source/backend/entities/ef/PimsAgreementHist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down
49 changes: 49 additions & 0 deletions source/backend/entities/ef/PimsAgreementStatusType.cs
Original file line number Diff line number Diff line change
@@ -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<PimsAgreement>();
}

[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<PimsAgreement> PimsAgreements { get; set; }
}
}
6 changes: 6 additions & 0 deletions source/backend/entities/ef/PimsPropertyBoundaryVw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
6 changes: 6 additions & 0 deletions source/backend/entities/ef/PimsPropertyLocationVw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
Loading