Skip to content

Commit

Permalink
Rename person_employments, add end date logic (#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
hortha authored Aug 13, 2024
1 parent 3deed24 commit 3063e7f
Show file tree
Hide file tree
Showing 35 changed files with 3,571 additions and 706 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Configure(EntityTypeBuilder<TpsCsvExtractItem> builder)
builder.Property(x => x.EstablishmentEmailAddress).HasMaxLength(200);
builder.Property(x => x.EmploymentStartDate).IsRequired();
builder.Property(x => x.EmploymentType).IsRequired();
builder.Property(x => x.WithdrawlIndicator).HasMaxLength(1).IsFixedLength();
builder.Property(x => x.WithdrawalIndicator).HasMaxLength(1).IsFixedLength();
builder.Property(x => x.Gender).HasMaxLength(10).IsRequired();
builder.Property(x => x.Created).IsRequired();
builder.Property(x => x.Key).HasMaxLength(50).IsRequired();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void Configure(EntityTypeBuilder<TpsCsvExtractLoadItem> builder)
builder.Property(x => x.EmploymentStartDate).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.EmploymentEndDate).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.FullOrPartTimeIndicator).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.WithdrawlIndicator).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.WithdrawalIndicator).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.ExtractDate).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.Gender).HasMaxLength(TpsCsvExtractLoadItem.FieldMaxLength);
builder.Property(x => x.Created).IsRequired();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@

namespace TeachingRecordSystem.Core.DataStore.Postgres.Mappings;

public class PersonEmploymentMapping : IEntityTypeConfiguration<PersonEmployment>
public class TpsEmploymentMapping : IEntityTypeConfiguration<TpsEmployment>
{
public void Configure(EntityTypeBuilder<PersonEmployment> builder)
public void Configure(EntityTypeBuilder<TpsEmployment> builder)
{
builder.ToTable("person_employments");
builder.HasKey(e => e.PersonEmploymentId);
builder.ToTable("tps_employments");
builder.HasKey(e => e.TpsEmploymentId);
builder.Property(e => e.StartDate).IsRequired();
builder.Property(e => e.LastKnownTpsEmployedDate).IsRequired();
builder.Property(e => e.EmploymentType).IsRequired();
builder.Property(e => e.WithdrawalConfirmed).IsRequired();
builder.Property(e => e.CreatedOn).IsRequired();
builder.Property(e => e.UpdatedOn).IsRequired();
builder.Property(e => e.Key).HasMaxLength(50).IsRequired();
builder.Property(e => e.NationalInsuranceNumber).HasMaxLength(9).IsFixedLength();
builder.Property(e => e.PersonPostcode).HasMaxLength(10);
builder.HasIndex(e => e.Key).HasDatabaseName(PersonEmployment.KeyIndexName);
builder.HasIndex(e => e.PersonId).HasDatabaseName(PersonEmployment.PersonIdIndexName);
builder.HasIndex(e => e.EstablishmentId).HasDatabaseName(PersonEmployment.EstablishmentIdIndexName);
builder.HasOne<Person>().WithMany().HasForeignKey(e => e.PersonId).HasConstraintName("fk_person_employments_person_id");
builder.HasOne<Establishment>().WithMany().HasForeignKey(e => e.EstablishmentId).HasConstraintName("fk_person_employments_establishment_id");
builder.HasIndex(e => e.Key).HasDatabaseName(TpsEmployment.KeyIndexName);
builder.HasIndex(e => e.PersonId).HasDatabaseName(TpsEmployment.PersonIdIndexName);
builder.HasIndex(e => e.EstablishmentId).HasDatabaseName(TpsEmployment.EstablishmentIdIndexName);
builder.HasOne<Person>().WithMany().HasForeignKey(e => e.PersonId).HasConstraintName("fk_tps_employments_person_id");
builder.HasOne<Establishment>().WithMany().HasForeignKey(e => e.EstablishmentId).HasConstraintName("fk_tps_employments_establishment_id");
}
}
Loading

0 comments on commit 3063e7f

Please sign in to comment.