Skip to content

Commit

Permalink
IS99 Scaffold (bcgov#4637)
Browse files Browse the repository at this point in the history
* Generated scaffold

* Fixed compilation

* Fixed compilation

* Fixed test compilation
  • Loading branch information
FuriousLlama authored Feb 5, 2025
1 parent 8cfb71c commit 2508611
Show file tree
Hide file tree
Showing 15 changed files with 677 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.AgreementDate, src => src.AgreementDt)
.Map(dest => dest.GenerationDate, src => src.GenerationDt)
.Map(dest => dest.Financials, src => src.PimsCompReqFinancials)
.Map(dest => dest.LegacyPayee, src => src.LegacyPayee)
//.Map(dest => dest.LegacyPayee, src => src.LegacyPayee) TODO: needs fixing
.Map(dest => dest.IsPaymentInTrust, src => src.IsPaymentInTrust)
.Map(dest => dest.GstNumber, src => src.GstNumber)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate)
Expand All @@ -53,7 +53,7 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.AgreementDt, src => src.AgreementDate)
.Map(dest => dest.GenerationDt, src => src.GenerationDate)
.Map(dest => dest.PimsCompReqFinancials, src => src.Financials)
.Map(dest => dest.LegacyPayee, src => src.LegacyPayee)
//.Map(dest => dest.LegacyPayee, src => src.LegacyPayee) TODO: needs fixing
.Map(dest => dest.IsPaymentInTrust, src => src.IsPaymentInTrust)
.Map(dest => dest.GstNumber, src => src.GstNumber)
.Map(dest => dest.FinalizedDate, src => src.FinalizedDate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public PimsCompensationRequisition Update(PimsCompensationRequisition compensati
.FirstOrDefault(x => x.CompensationRequisitionId.Equals(compensationRequisition.CompensationRequisitionId)) ?? throw new KeyNotFoundException();

// Don't let the frontend override the legacy payee - this is only intended to be populated via ETL
compensationRequisition.LegacyPayee = existingCompensationRequisition.LegacyPayee;
//compensationRequisition.LegacyPayee = existingCompensationRequisition.LegacyPayee; TODO: Fix this

Context.Entry(existingCompensationRequisition).CurrentValues.SetValues(compensationRequisition);
Context.UpdateChild<PimsCompensationRequisition, long, PimsCompReqFinancial, long>(a => a.PimsCompReqFinancials, compensationRequisition.CompensationRequisitionId, compensationRequisition.PimsCompReqFinancials.ToArray(), true);
Expand Down
171 changes: 168 additions & 3 deletions source/backend/entities/PimsBaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,18 @@ public PimsBaseContext(DbContextOptions<PimsBaseContext> options)

public virtual DbSet<PimsExpropPmtPmtItemHist> PimsExpropPmtPmtItemHists { get; set; }

public virtual DbSet<PimsExpropriationNotice> PimsExpropriationNotices { get; set; }

public virtual DbSet<PimsExpropriationNoticeHist> PimsExpropriationNoticeHists { get; set; }

public virtual DbSet<PimsExpropriationPayment> PimsExpropriationPayments { get; set; }

public virtual DbSet<PimsExpropriationPaymentHist> PimsExpropriationPaymentHists { get; set; }

public virtual DbSet<PimsExpropriationVesting> PimsExpropriationVestings { get; set; }

public virtual DbSet<PimsExpropriationVestingHist> PimsExpropriationVestingHists { get; set; }

public virtual DbSet<PimsFenceType> PimsFenceTypes { get; set; }

public virtual DbSet<PimsFinancialActivityCode> PimsFinancialActivityCodes { get; set; }
Expand Down Expand Up @@ -2063,6 +2071,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasDefaultValueSql("(user_name())")
.HasComment("The user or proxy account that created or last updated the record.");
entity.Property(e => e.InterestHolderId).HasComment("Foreign key reference to the PIMS_INTEREST_HOLDER table.");
entity.Property(e => e.LegacyPayee).HasComment("Payee where only the name is known from the PAIMS system,");

entity.HasOne(d => d.AcquisitionFileTeam).WithMany(p => p.PimsCompReqPayees).HasConstraintName("PIM_ACQNTM_PIM_CMPRQP_FK");

Expand Down Expand Up @@ -2136,8 +2145,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasDefaultValueSql("(user_name())")
.HasComment("The user or proxy account that created or last updated the record.");
entity.Property(e => e.DetailedRemarks).HasComment("Detailed remarks for the compensation requisition.");
entity.Property(e => e.ExpropNoticeServedDt).HasComment("Expropriation notice served date.");
entity.Property(e => e.ExpropVestingDt).HasComment("Expropriation vesting date.");
entity.Property(e => e.FinalizedDate).HasComment("Date that the draft Compensation Req changed from Draft to Final status.");
entity.Property(e => e.FiscalYear).HasComment("Fiscal year of the compensation requisition.");
entity.Property(e => e.GenerationDt).HasComment("Document generation date.");
Expand All @@ -2152,7 +2159,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasDefaultValue(false)
.HasComment("Indicates if the payment was made in trust.");
entity.Property(e => e.LeaseId).HasComment("Foreign key to the PIMS_LEASE table.");
entity.Property(e => e.LegacyPayee).HasComment("Payee where only the name is known from the PAIMS system,");
entity.Property(e => e.ResponsibilityId).HasComment("Foreign key to the PIMS_RESPONSIBILITY table.");
entity.Property(e => e.SpecialInstruction).HasComment("Special instructions for the compensation requisition.");
entity.Property(e => e.YearlyFinancialId).HasComment("Foreign key to the PIMS_YEARLY_FINANCIAL table.");
Expand Down Expand Up @@ -4062,6 +4068,81 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())");
});

modelBuilder.Entity<PimsExpropriationNotice>(entity =>
{
entity.HasKey(e => e.ExpropriationNoticeId).HasName("EXPNOT_PK");

entity.ToTable("PIMS_EXPROPRIATION_NOTICE", tb =>
{
tb.HasComment("Entity continaing the date and recipient of the expropriation notice.");
tb.HasTrigger("PIMS_EXPNOT_A_S_IUD_TR");
tb.HasTrigger("PIMS_EXPNOT_I_S_I_TR");
tb.HasTrigger("PIMS_EXPNOT_I_S_U_TR");
});

entity.Property(e => e.ExpropriationNoticeId)
.HasDefaultValueSql("(NEXT VALUE FOR [PIMS_EXPROPRIATION_NOTICE_ID_SEQ])")
.HasComment("Unique auto-generated surrogate primary key");
entity.Property(e => e.AcquisitionFileId).HasComment("Foreign key to the PIMS_ACQUISITION table.");
entity.Property(e => e.AcquisitionOwnerId).HasComment("Foreign key to the PIMS_ACQUISITION_OWNER table.");
entity.Property(e => e.AppCreateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the user created the record.");
entity.Property(e => e.AppCreateUserDirectory)
.HasDefaultValueSql("(user_name())")
.HasComment("The directory of the user account that created the record.");
entity.Property(e => e.AppCreateUserGuid).HasComment("The GUID of the user account that created the record.");
entity.Property(e => e.AppCreateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user account that created the record.");
entity.Property(e => e.AppLastUpdateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the user updated the record.");
entity.Property(e => e.AppLastUpdateUserDirectory)
.HasDefaultValueSql("(user_name())")
.HasComment("The directory of the user account that updated the record.");
entity.Property(e => e.AppLastUpdateUserGuid).HasComment("The GUID of the user account that updated the record.");
entity.Property(e => e.AppLastUpdateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user account that updated the record.");
entity.Property(e => e.CompensationRequisitionId)
.HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMPENSATION_REQUISITION_ID_SEQ])")
.HasComment("Foreign key to the PIMS_COMPENSATION_REQUISITION table.");
entity.Property(e => e.ConcurrencyControlNumber)
.HasDefaultValue(1L)
.HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o");
entity.Property(e => e.DbCreateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the record was created.");
entity.Property(e => e.DbCreateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user or proxy account that created the record.");
entity.Property(e => e.DbLastUpdateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the record was created or last updated.");
entity.Property(e => e.DbLastUpdateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user or proxy account that created or last updated the record.");
entity.Property(e => e.ExpropNoticeServedDt).HasComment("Expropriation notice served date.");
entity.Property(e => e.InterestHolderId).HasComment("Foreign key to the PIMS_INTEREST_HOLDER table.");

entity.HasOne(d => d.AcquisitionFile).WithMany(p => p.PimsExpropriationNotices)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("PIM_ACQNFL_PIM_EXPNOT_FK");

entity.HasOne(d => d.AcquisitionOwner).WithMany(p => p.PimsExpropriationNotices).HasConstraintName("PIM_ACQOWN_PIM_EXPNOT_FK");

entity.HasOne(d => d.InterestHolder).WithMany(p => p.PimsExpropriationNotices).HasConstraintName("PIM_INTHLD_PIM_EXPNOT_FK");
});

modelBuilder.Entity<PimsExpropriationNoticeHist>(entity =>
{
entity.HasKey(e => e.ExpropriationNoticeHistId).HasName("PIMS_EXPNOT_H_PK");

entity.Property(e => e.ExpropriationNoticeHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_EXPROPRIATION_NOTICE_H_ID_SEQ])");
entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())");
});

modelBuilder.Entity<PimsExpropriationPayment>(entity =>
{
entity.HasKey(e => e.ExpropriationPaymentId).HasName("EXPPMT_PK");
Expand Down Expand Up @@ -4141,6 +4222,75 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())");
});

modelBuilder.Entity<PimsExpropriationVesting>(entity =>
{
entity.HasKey(e => e.ExpropriationVestingId).HasName("EXPVST_PK");

entity.ToTable("PIMS_EXPROPRIATION_VESTING", tb =>
{
tb.HasComment("Entity continaing the vesting date of the expropriation.");
tb.HasTrigger("PIMS_EXPVST_A_S_IUD_TR");
tb.HasTrigger("PIMS_EXPVST_I_S_I_TR");
tb.HasTrigger("PIMS_EXPVST_I_S_U_TR");
});

entity.Property(e => e.ExpropriationVestingId)
.HasDefaultValueSql("(NEXT VALUE FOR [PIMS_EXPROPRIATION_VESTING_ID_SEQ])")
.HasComment("Unique auto-generated surrogate primary key");
entity.Property(e => e.AcquisitionFileId).HasComment("Foreign key of the acquisition file.");
entity.Property(e => e.AppCreateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the user created the record.");
entity.Property(e => e.AppCreateUserDirectory)
.HasDefaultValueSql("(user_name())")
.HasComment("The directory of the user account that created the record.");
entity.Property(e => e.AppCreateUserGuid).HasComment("The GUID of the user account that created the record.");
entity.Property(e => e.AppCreateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user account that created the record.");
entity.Property(e => e.AppLastUpdateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the user updated the record.");
entity.Property(e => e.AppLastUpdateUserDirectory)
.HasDefaultValueSql("(user_name())")
.HasComment("The directory of the user account that updated the record.");
entity.Property(e => e.AppLastUpdateUserGuid).HasComment("The GUID of the user account that updated the record.");
entity.Property(e => e.AppLastUpdateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user account that updated the record.");
entity.Property(e => e.CompensationRequisitionId)
.HasDefaultValueSql("(NEXT VALUE FOR [PIMS_COMPENSATION_REQUISITION_ID_SEQ])")
.HasComment("Foreign key to the PIMS_COMPENSATION_REQUISITION table.");
entity.Property(e => e.ConcurrencyControlNumber)
.HasDefaultValue(1L)
.HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o");
entity.Property(e => e.DbCreateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the record was created.");
entity.Property(e => e.DbCreateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user or proxy account that created the record.");
entity.Property(e => e.DbLastUpdateTimestamp)
.HasDefaultValueSql("(getutcdate())")
.HasComment("The date and time the record was created or last updated.");
entity.Property(e => e.DbLastUpdateUserid)
.HasDefaultValueSql("(user_name())")
.HasComment("The user or proxy account that created or last updated the record.");
entity.Property(e => e.ExpropVestingDt).HasComment("Expropriation vesting date.");

entity.HasOne(d => d.AcquisitionFile).WithMany(p => p.PimsExpropriationVestings)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("PIM_ACQNFL_PIM_EXPVST_FK");
});

modelBuilder.Entity<PimsExpropriationVestingHist>(entity =>
{
entity.HasKey(e => e.ExpropriationVestingHistId).HasName("PIMS_EXPVST_H_PK");

entity.Property(e => e.ExpropriationVestingHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_EXPROPRIATION_VESTING_H_ID_SEQ])");
entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())");
});

modelBuilder.Entity<PimsFenceType>(entity =>
{
entity.HasKey(e => e.FenceTypeCode).HasName("FNCTYP_PK");
Expand Down Expand Up @@ -9525,12 +9675,24 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.HasSequence("PIMS_EXPROP_PMT_PMT_ITEM_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_EXPROPRIATION_NOTICE_H_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_EXPROPRIATION_NOTICE_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_EXPROPRIATION_PAYMENT_H_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_EXPROPRIATION_PAYMENT_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_EXPROPRIATION_VESTING_H_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_EXPROPRIATION_VESTING_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_FILE_ENTITY_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
Expand Down Expand Up @@ -9624,6 +9786,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.HasSequence("PIMS_LEASE_LEASE_PURPOSE_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_LEASE_LICENSE_TEAM_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_LEASE_NOTE_H_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
Expand Down
6 changes: 6 additions & 0 deletions source/backend/entities/ef/PimsAcquisitionFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,15 @@ public partial class PimsAcquisitionFile
[InverseProperty("AcquisitionFile")]
public virtual ICollection<PimsCompensationRequisition> PimsCompensationRequisitions { get; set; } = new List<PimsCompensationRequisition>();

[InverseProperty("AcquisitionFile")]
public virtual ICollection<PimsExpropriationNotice> PimsExpropriationNotices { get; set; } = new List<PimsExpropriationNotice>();

[InverseProperty("AcquisitionFile")]
public virtual ICollection<PimsExpropriationPayment> PimsExpropriationPayments { get; set; } = new List<PimsExpropriationPayment>();

[InverseProperty("AcquisitionFile")]
public virtual ICollection<PimsExpropriationVesting> PimsExpropriationVestings { get; set; } = new List<PimsExpropriationVesting>();

[InverseProperty("AcquisitionFile")]
public virtual ICollection<PimsInterestHolder> PimsInterestHolders { get; set; } = new List<PimsInterestHolder>();

Expand Down
3 changes: 3 additions & 0 deletions source/backend/entities/ef/PimsAcquisitionOwner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public partial class PimsAcquisitionOwner
[InverseProperty("AcquisitionOwner")]
public virtual ICollection<PimsCompReqPayee> PimsCompReqPayees { get; set; } = new List<PimsCompReqPayee>();

[InverseProperty("AcquisitionOwner")]
public virtual ICollection<PimsExpropriationNotice> PimsExpropriationNotices { get; set; } = new List<PimsExpropriationNotice>();

[InverseProperty("AcquisitionOwner")]
public virtual ICollection<PimsExpropriationPayment> PimsExpropriationPayments { get; set; } = new List<PimsExpropriationPayment>();
}
8 changes: 8 additions & 0 deletions source/backend/entities/ef/PimsCompReqPayee.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Pims.Dal.Entities;
/// </summary>
[Table("PIMS_COMP_REQ_PAYEE")]
[Index("AcquisitionFileTeamId", Name = "CMPRQP_ACQUISITION_FILE_TEAM_ID_IDX")]
[Index("AcquisitionOwnerId", Name = "CMPRQP_ACQUISITION_OWNER_ID_IDX")]
[Index("CompensationRequisitionId", Name = "CMPRQP_COMPENSATION_REQUISITION_ID_IDX")]
[Index("InterestHolderId", Name = "CMPRQP_INTEREST_HOLDER_ID_IDX")]
public partial class PimsCompReqPayee
Expand Down Expand Up @@ -46,6 +47,13 @@ public partial class PimsCompReqPayee
[Column("ACQUISITION_FILE_TEAM_ID")]
public long? AcquisitionFileTeamId { get; set; }

/// <summary>
/// Payee where only the name is known from the PAIMS system,
/// </summary>
[Column("LEGACY_PAYEE")]
[StringLength(1000)]
public string LegacyPayee { get; set; }

/// <summary>
/// Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions source/backend/entities/ef/PimsCompReqPayeeHist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public partial class PimsCompReqPayeeHist
[Column("ACQUISITION_FILE_TEAM_ID")]
public long? AcquisitionFileTeamId { get; set; }

[Column("LEGACY_PAYEE")]
[StringLength(1000)]
public string LegacyPayee { get; set; }

[Column("CONCURRENCY_CONTROL_NUMBER")]
public long ConcurrencyControlNumber { get; set; }

Expand Down
Loading

0 comments on commit 2508611

Please sign in to comment.