diff --git a/AsbCloudDb/Model/Well.cs b/AsbCloudDb/Model/Well.cs index b57efb90..9fb0651d 100644 --- a/AsbCloudDb/Model/Well.cs +++ b/AsbCloudDb/Model/Well.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using System.Text.Json.Serialization; #nullable disable @@ -78,5 +79,9 @@ namespace AsbCloudDb.Model [ForeignKey(nameof(IdTelemetry))] [InverseProperty(nameof(Model.Telemetry.Well))] public virtual Telemetry Telemetry { get; set; } + + [JsonIgnore] + [InverseProperty(nameof(WellOperation.Well))] + public virtual ICollection WellOperations { get; set; } } } diff --git a/AsbCloudDb/Model/WellOperation.cs b/AsbCloudDb/Model/WellOperation.cs index b5fa40ff..024ce579 100644 --- a/AsbCloudDb/Model/WellOperation.cs +++ b/AsbCloudDb/Model/WellOperation.cs @@ -16,8 +16,8 @@ namespace AsbCloudDb.Model [Column("id_well"), Comment("Id скважины")] public int IdWell { get; set; } - [Column("id_section"), Comment("Id секции скважины")] - public int IdSection { get; set; } + [Column("id_well_section_type"), Comment("Id тип секции скважины")] + public int IdWellSectionType { get; set; } [Column("id_category"), Comment("Id категории операции")] public int IdCategory { get; set; } @@ -32,17 +32,21 @@ namespace AsbCloudDb.Model public DateTime StartDate { get; set; } [Column("duration_hours"), Comment("Продолжительность в часах")] - public double Duration { get; set; } + public double DurationHours { get; set; } - [Column("data"), Comment("Данные по операции")] - public string Data { get; set; } + [Column("data"), Comment("Доп. информация к выбраной категории")] + public string Info { get; set; } [Column("comment"), Comment("Комментарий")] public string Comment { get; set; } [JsonIgnore] - [ForeignKey(nameof(IdSection))] - public virtual WellSection WellSection { get; set; } + [ForeignKey(nameof(IdWell))] + public virtual Well Well { get; set; } + + [JsonIgnore] + [ForeignKey(nameof(IdWellSectionType))] + public virtual WellSectionType WellSectionType { get; set; } [JsonIgnore] [ForeignKey(nameof(IdCategory))] diff --git a/AsbCloudDb/Model/WellSectionType.cs b/AsbCloudDb/Model/WellSectionType.cs index 59c31505..6c6b930d 100644 --- a/AsbCloudDb/Model/WellSectionType.cs +++ b/AsbCloudDb/Model/WellSectionType.cs @@ -21,5 +21,9 @@ namespace AsbCloudDb.Model [JsonIgnore] [InverseProperty(nameof(WellSection.WellSectionType))] public virtual ICollection WellSections { get; set; } + + [JsonIgnore] + [InverseProperty(nameof(WellOperation.WellSectionType))] + public virtual ICollection WellOperations { get; set; } } } diff --git a/AsbCloudInfrastructure/Services/WellOperationService.cs b/AsbCloudInfrastructure/Services/WellOperationService.cs index aaa37aa2..e8bf9227 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService.cs @@ -27,8 +27,8 @@ namespace AsbCloudInfrastructure.Services int skip = 0, int take = 32, CancellationToken token = default) { var query = dbSet - .Include(s => s.WellSection) - .Where(s => s.WellSection.IdWell == idWell) + .Include(s => s.WellSectionType) + .Where(s => s.IdWell == idWell) .AsNoTracking(); var result = new PaginationContainer