From 7bfe273c2c88ff26cac38ebb7af167a35f11a1b3 Mon Sep 17 00:00:00 2001 From: devinleighsmith <41091511+devinleighsmith@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:09:58 -0700 Subject: [PATCH] scaffold (#4341) --- source/backend/entities/PimsBaseContext.cs | 57 ++++++++++++- .../ef/PimsConsultationOutcomeType.cs | 79 +++++++++++++++++++ .../entities/ef/PimsLeaseConsultation.cs | 13 +++ .../entities/ef/PimsLeaseConsultationHist.cs | 5 ++ .../entities/ef/PimsPropertyBoundaryLiteVw.cs | 36 +++++++++ .../entities/ef/PimsPropertyLocationLiteVw.cs | 36 +++++++++ .../entities/ef/PimsResearchFileNote.cs | 2 - 7 files changed, 225 insertions(+), 3 deletions(-) create mode 100644 source/backend/entities/ef/PimsConsultationOutcomeType.cs create mode 100644 source/backend/entities/ef/PimsPropertyBoundaryLiteVw.cs create mode 100644 source/backend/entities/ef/PimsPropertyLocationLiteVw.cs diff --git a/source/backend/entities/PimsBaseContext.cs b/source/backend/entities/PimsBaseContext.cs index 44f2deb602..58344f1110 100644 --- a/source/backend/entities/PimsBaseContext.cs +++ b/source/backend/entities/PimsBaseContext.cs @@ -102,6 +102,8 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsCompensationRequisitionHists { get; set; } + public virtual DbSet PimsConsultationOutcomeTypes { get; set; } + public virtual DbSet PimsConsultationStatusTypes { get; set; } public virtual DbSet PimsConsultationTypes { get; set; } @@ -462,6 +464,8 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsPropertyAnomalyTypes { get; set; } + public virtual DbSet PimsPropertyBoundaryLiteVws { get; set; } + public virtual DbSet PimsPropertyBoundaryVws { get; set; } public virtual DbSet PimsPropertyContacts { get; set; } @@ -480,6 +484,8 @@ public PimsBaseContext(DbContextOptions options) public virtual DbSet PimsPropertyLeaseHists { get; set; } + public virtual DbSet PimsPropertyLocationLiteVws { get; set; } + public virtual DbSet PimsPropertyLocationVws { get; set; } public virtual DbSet PimsPropertyOperations { get; set; } @@ -1698,6 +1704,38 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.ConsultationOutcomeTypeCode).HasName("OUTCMT_PK"); + + entity.ToTable("PIMS_CONSULTATION_OUTCOME_TYPE", tb => + { + tb.HasComment("Description of the consultation outcome type for a lease or license."); + tb.HasTrigger("PIMS_OUTCMT_I_S_I_TR"); + tb.HasTrigger("PIMS_OUTCMT_I_S_U_TR"); + }); + + entity.Property(e => e.ConsultationOutcomeTypeCode).HasComment("Code value of the consultation outcome type."); + 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.Description).HasComment("Description of the consultation outcome type."); + entity.Property(e => e.DisplayOrder).HasComment("Onscreen display order of the code types."); + entity.Property(e => e.IsDisabled).HasComment("Indicates if the code type is active."); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.ConsultationStatusTypeCode).HasName("CONSTY_PK"); @@ -4345,6 +4383,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) 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.ConsultationOutcomeTypeCode) + .HasDefaultValue("INPROGRESS") + .HasComment("Foreign key to the PIMS_CONSULTATION_OUTCOME_TYPE table."); entity.Property(e => e.ConsultationStatusTypeCode) .HasDefaultValue("UNKNOWN") .HasComment("Foreign key to the PIMS_CONSULTATION_STATUS_TYPE table."); @@ -4373,6 +4414,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.RequestedOn).HasComment("Date that the approval / consultation request was sent."); entity.Property(e => e.ResponseReceivedDate).HasComment("Date that the consultation request response was received."); + entity.HasOne(d => d.ConsultationOutcomeTypeCodeNavigation).WithMany(p => p.PimsLeaseConsultations) + .OnDelete(DeleteBehavior.ClientSetNull) + .HasConstraintName("PIM_OUTCMT_PIM_LESCON_FK"); + entity.HasOne(d => d.ConsultationStatusTypeCodeNavigation).WithMany(p => p.PimsLeaseConsultations) .OnDelete(DeleteBehavior.ClientSetNull) .HasConstraintName("PIM_CONSTY_PIM_LESCON_FK"); @@ -6845,6 +6890,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.IsDisabled).HasComment("Indicates if the code is disabled."); }); + modelBuilder.Entity(entity => + { + entity.ToView("PIMS_PROPERTY_BOUNDARY_LITE_VW"); + }); + modelBuilder.Entity(entity => { entity.ToView("PIMS_PROPERTY_BOUNDARY_VW"); @@ -7019,6 +7069,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())"); }); + modelBuilder.Entity(entity => + { + entity.ToView("PIMS_PROPERTY_LOCATION_LITE_VW"); + }); + modelBuilder.Entity(entity => { entity.ToView("PIMS_PROPERTY_LOCATION_VW"); @@ -7538,7 +7593,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey(e => new { e.ResearchFileNoteId, e.ResearchFileId }).HasName("RFLNOT_PK"); + entity.HasKey(e => e.ResearchFileNoteId).HasName("RFLNOT_PK"); entity.ToTable("PIMS_RESEARCH_FILE_NOTE", tb => { diff --git a/source/backend/entities/ef/PimsConsultationOutcomeType.cs b/source/backend/entities/ef/PimsConsultationOutcomeType.cs new file mode 100644 index 0000000000..1153c3dd73 --- /dev/null +++ b/source/backend/entities/ef/PimsConsultationOutcomeType.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace Pims.Dal.Entities; + +/// +/// Description of the consultation outcome type for a lease or license. +/// +[Table("PIMS_CONSULTATION_OUTCOME_TYPE")] +public partial class PimsConsultationOutcomeType +{ + /// + /// Code value of the consultation outcome type. + /// + [Key] + [Column("CONSULTATION_OUTCOME_TYPE_CODE")] + [StringLength(20)] + public string ConsultationOutcomeTypeCode { get; set; } + + /// + /// Description of the consultation outcome type. + /// + [Required] + [Column("DESCRIPTION")] + [StringLength(200)] + public string Description { get; set; } + + /// + /// Onscreen display order of the code types. + /// + [Column("DISPLAY_ORDER")] + public int? DisplayOrder { get; set; } + + /// + /// Indicates if the code type is active. + /// + [Column("IS_DISABLED")] + public bool IsDisabled { get; set; } + + /// + /// 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 + /// + [Column("CONCURRENCY_CONTROL_NUMBER")] + public long ConcurrencyControlNumber { get; set; } + + /// + /// The date and time the record was created. + /// + [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbCreateTimestamp { get; set; } + + /// + /// The user or proxy account that created the record. + /// + [Required] + [Column("DB_CREATE_USERID")] + [StringLength(30)] + public string DbCreateUserid { get; set; } + + /// + /// The date and time the record was created or last updated. + /// + [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")] + public DateTime DbLastUpdateTimestamp { get; set; } + + /// + /// The user or proxy account that created or last updated the record. + /// + [Required] + [Column("DB_LAST_UPDATE_USERID")] + [StringLength(30)] + public string DbLastUpdateUserid { get; set; } + + [InverseProperty("ConsultationOutcomeTypeCodeNavigation")] + public virtual ICollection PimsLeaseConsultations { get; set; } = new List(); +} diff --git a/source/backend/entities/ef/PimsLeaseConsultation.cs b/source/backend/entities/ef/PimsLeaseConsultation.cs index fbf1ebe80b..8f2abaa7bc 100644 --- a/source/backend/entities/ef/PimsLeaseConsultation.cs +++ b/source/backend/entities/ef/PimsLeaseConsultation.cs @@ -7,6 +7,7 @@ namespace Pims.Dal.Entities; [Table("PIMS_LEASE_CONSULTATION")] +[Index("ConsultationOutcomeTypeCode", Name = "LESCON_CONSULTATION_OUTCOME_TYPE_CODE_IDX")] [Index("ConsultationStatusTypeCode", Name = "LESCON_CONSULTATION_STATUS_TYPE_CODE_IDX")] [Index("ConsultationTypeCode", Name = "LESCON_CONSULTATION_TYPE_CODE_IDX")] [Index("LeaseId", Name = "LESCON_LEASE_ID_IDX")] @@ -62,6 +63,14 @@ public partial class PimsLeaseConsultation [StringLength(20)] public string ConsultationStatusTypeCode { get; set; } + /// + /// Foreign key to the PIMS_CONSULTATION_OUTCOME_TYPE table. + /// + [Required] + [Column("CONSULTATION_OUTCOME_TYPE_CODE")] + [StringLength(20)] + public string ConsultationOutcomeTypeCode { get; set; } + /// /// Description for the approval / consultation when "Other" consultation type is selected. /// @@ -189,6 +198,10 @@ public partial class PimsLeaseConsultation [StringLength(30)] public string DbLastUpdateUserid { get; set; } + [ForeignKey("ConsultationOutcomeTypeCode")] + [InverseProperty("PimsLeaseConsultations")] + public virtual PimsConsultationOutcomeType ConsultationOutcomeTypeCodeNavigation { get; set; } + [ForeignKey("ConsultationStatusTypeCode")] [InverseProperty("PimsLeaseConsultations")] public virtual PimsConsultationStatusType ConsultationStatusTypeCodeNavigation { get; set; } diff --git a/source/backend/entities/ef/PimsLeaseConsultationHist.cs b/source/backend/entities/ef/PimsLeaseConsultationHist.cs index 8e7b217888..41fdefa880 100644 --- a/source/backend/entities/ef/PimsLeaseConsultationHist.cs +++ b/source/backend/entities/ef/PimsLeaseConsultationHist.cs @@ -45,6 +45,11 @@ public partial class PimsLeaseConsultationHist [StringLength(20)] public string ConsultationStatusTypeCode { get; set; } + [Required] + [Column("CONSULTATION_OUTCOME_TYPE_CODE")] + [StringLength(20)] + public string ConsultationOutcomeTypeCode { get; set; } + [Column("OTHER_DESCRIPTION")] [StringLength(2000)] public string OtherDescription { get; set; } diff --git a/source/backend/entities/ef/PimsPropertyBoundaryLiteVw.cs b/source/backend/entities/ef/PimsPropertyBoundaryLiteVw.cs new file mode 100644 index 0000000000..f19e8dc411 --- /dev/null +++ b/source/backend/entities/ef/PimsPropertyBoundaryLiteVw.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using NetTopologySuite.Geometries; + +namespace Pims.Dal.Entities; + +[Keyless] +public partial class PimsPropertyBoundaryLiteVw +{ + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + + [Column("GEOMETRY", TypeName = "geometry")] + public Geometry Geometry { get; set; } + + [Column("IS_OWNED")] + public bool IsOwned { get; set; } + + [Column("IS_RETIRED")] + public bool? IsRetired { get; set; } + + [Column("IS_OTHER_INTEREST")] + public bool? IsOtherInterest { get; set; } + + [Column("IS_DISPOSED")] + public bool? IsDisposed { get; set; } + + [Column("HAS_ACTIVE_ACQUISITION_FILE")] + public bool? HasActiveAcquisitionFile { get; set; } + + [Column("HAS_ACTIVE_RESEARCH_FILE")] + public bool? HasActiveResearchFile { get; set; } +} diff --git a/source/backend/entities/ef/PimsPropertyLocationLiteVw.cs b/source/backend/entities/ef/PimsPropertyLocationLiteVw.cs new file mode 100644 index 0000000000..0e2186c007 --- /dev/null +++ b/source/backend/entities/ef/PimsPropertyLocationLiteVw.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using NetTopologySuite.Geometries; + +namespace Pims.Dal.Entities; + +[Keyless] +public partial class PimsPropertyLocationLiteVw +{ + [Column("PROPERTY_ID")] + public long PropertyId { get; set; } + + [Column("GEOMETRY", TypeName = "geometry")] + public Geometry Geometry { get; set; } + + [Column("IS_OWNED")] + public bool IsOwned { get; set; } + + [Column("IS_RETIRED")] + public bool? IsRetired { get; set; } + + [Column("IS_OTHER_INTEREST")] + public bool? IsOtherInterest { get; set; } + + [Column("IS_DISPOSED")] + public bool? IsDisposed { get; set; } + + [Column("HAS_ACTIVE_ACQUISITION_FILE")] + public bool? HasActiveAcquisitionFile { get; set; } + + [Column("HAS_ACTIVE_RESEARCH_FILE")] + public bool? HasActiveResearchFile { get; set; } +} diff --git a/source/backend/entities/ef/PimsResearchFileNote.cs b/source/backend/entities/ef/PimsResearchFileNote.cs index 58947c7cb2..9bab82edfd 100644 --- a/source/backend/entities/ef/PimsResearchFileNote.cs +++ b/source/backend/entities/ef/PimsResearchFileNote.cs @@ -9,7 +9,6 @@ namespace Pims.Dal.Entities; /// /// Defines the relationship betwwen a research file and a note. /// -[PrimaryKey("ResearchFileNoteId", "ResearchFileId")] [Table("PIMS_RESEARCH_FILE_NOTE")] [Index("NoteId", Name = "RFLNOT_NOTE_ID_IDX")] [Index("ResearchFileId", Name = "RFLNOT_RESEARCH_FILE_ID_IDX")] @@ -20,7 +19,6 @@ public partial class PimsResearchFileNote [Column("RESEARCH_FILE_NOTE_ID")] public long ResearchFileNoteId { get; set; } - [Key] [Column("RESEARCH_FILE_ID")] public long ResearchFileId { get; set; }