diff --git a/AsbCloudApp/Data/SAUB/DrillTestDto.cs b/AsbCloudApp/Data/SAUB/DrillTestDto.cs
index 027f7419..fb3bb492 100644
--- a/AsbCloudApp/Data/SAUB/DrillTestDto.cs
+++ b/AsbCloudApp/Data/SAUB/DrillTestDto.cs
@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data.SAUB
@@ -13,25 +14,15 @@ namespace AsbCloudApp.Data.SAUB
///
public int Id { get; set; }
- ///
- /// Идентификатор телеметрии drill test
- ///
- public int IdTelemetry { get; set; }
-
///
/// Время начала drill test
///
- public int TimeStampStart { get; set; }
+ public DateTime TimeStampStart { get; set; }
///
/// Глубина начала drill test
///
- public float? DepthStart { get; set; }
-
- ///
- ///
- ///
- public TelemetryDto? Telemetry { get; set; } = null!;
+ public float DepthStart { get; set; }
///
/// Параметры теста
diff --git a/AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.cs b/AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.cs
deleted file mode 100644
index 56afad03..00000000
--- a/AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace AsbCloudDb.Migrations
-{
- public partial class Add_Drill_Test : Migration
- {
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.CreateTable(
- name: "t_drill_test",
- columns: table => new
- {
- id = table.Column(type: "integer", nullable: false, comment: "Идентификатор"),
- id_telemetry = table.Column(type: "integer", nullable: false, comment: "Идентификатор телеметрии"),
- timestamp_start = table.Column(type: "integer", nullable: false, comment: "Время начала"),
- depthStart = table.Column(type: "real", nullable: true, comment: "Глубина начала")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_t_drill_test", x => new { x.id, x.id_telemetry });
- table.ForeignKey(
- name: "FK_t_drill_test_t_telemetry_id_telemetry",
- column: x => x.id_telemetry,
- principalTable: "t_telemetry",
- principalColumn: "id",
- onDelete: ReferentialAction.Cascade);
- },
- comment: "Drill_test");
-
- migrationBuilder.CreateTable(
- name: "t_drill_test_parameter",
- columns: table => new
- {
- id_drill_test = table.Column(type: "integer", nullable: false, comment: "Идентификатор drill test"),
- id_telemetry_drill_test = table.Column(type: "integer", nullable: false, comment: "Идентификатор телеметрии drill test"),
- step = table.Column(type: "integer", nullable: false, comment: "Шаг"),
- workload = table.Column(type: "real", nullable: true, comment: "Нагрузка"),
- speed = table.Column(type: "real", nullable: true, comment: "Заданная скорость"),
- depth_speed = table.Column(type: "real", nullable: true, comment: "Скорость проходки"),
- time_drill_step = table.Column(type: "real", nullable: true, comment: "Время бурения шага"),
- depth_drill_step = table.Column(type: "real", nullable: true, comment: "Глубина бурения шага")
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_t_drill_test_parameter", x => new { x.id_drill_test, x.id_telemetry_drill_test });
- table.ForeignKey(
- name: "FK_t_drill_test_parameter_t_drill_test_id_drill_test_id_teleme~",
- columns: x => new { x.id_drill_test, x.id_telemetry_drill_test },
- principalTable: "t_drill_test",
- principalColumns: new[] { "id", "id_telemetry" },
- onDelete: ReferentialAction.Cascade);
- },
- comment: "Drill_test_parameter");
-
- migrationBuilder.CreateIndex(
- name: "IX_t_drill_test_id_telemetry",
- table: "t_drill_test",
- column: "id_telemetry");
- }
-
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "t_drill_test_parameter");
-
- migrationBuilder.DropTable(
- name: "t_drill_test");
- }
- }
-}
diff --git a/AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.Designer.cs b/AsbCloudDb/Migrations/20231017094813_Add_Drill_Test.Designer.cs
similarity index 98%
rename from AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.Designer.cs
rename to AsbCloudDb/Migrations/20231017094813_Add_Drill_Test.Designer.cs
index 3d44bbdd..1b2cf452 100644
--- a/AsbCloudDb/Migrations/20231017055919_Add_Drill_Test.Designer.cs
+++ b/AsbCloudDb/Migrations/20231017094813_Add_Drill_Test.Designer.cs
@@ -13,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
[DbContext(typeof(AsbCloudDbContext))]
- [Migration("20231017055919_Add_Drill_Test")]
+ [Migration("20231017094813_Add_Drill_Test")]
partial class Add_Drill_Test
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -156,6 +156,73 @@ namespace AsbCloudDb.Migrations
});
});
+ modelBuilder.Entity("AsbCloudDb.Model.Contact", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer")
+ .HasColumnName("id");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Company")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("company")
+ .HasComment("компания");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("email")
+ .HasComment("email");
+
+ b.Property("FullName")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("full_name")
+ .HasComment("ФИО");
+
+ b.Property("IdCompanyType")
+ .HasMaxLength(255)
+ .HasColumnType("integer")
+ .HasColumnName("id_company_type")
+ .HasComment("вид деятельности");
+
+ b.Property("IdWell")
+ .HasMaxLength(255)
+ .HasColumnType("integer")
+ .HasColumnName("id_well")
+ .HasComment("ключ скважины");
+
+ b.Property("Phone")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)")
+ .HasColumnName("phone")
+ .HasComment("номер телефона");
+
+ b.Property("Position")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("character varying(255)")
+ .HasColumnName("position")
+ .HasComment("должность");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdCompanyType");
+
+ b.HasIndex("IdWell");
+
+ b.ToTable("t_contact");
+
+ b.HasComment("Контакты");
+ });
+
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
{
b.Property("IdWell")
@@ -360,13 +427,19 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_telemetry")
.HasComment("Идентификатор телеметрии");
- b.Property("DepthStart")
+ b.Property("DepthStart")
.HasColumnType("real")
.HasColumnName("depthStart")
.HasComment("Глубина начала");
- b.Property("TimeStampStart")
- .HasColumnType("integer")
+ b.Property("Params")
+ .IsRequired()
+ .HasColumnType("jsonb")
+ .HasColumnName("t_drill_test_params")
+ .HasComment("Параметры записи drill test");
+
+ b.Property("TimeStampStart")
+ .HasColumnType("timestamp with time zone")
.HasColumnName("timestamp_start")
.HasComment("Время начала");
@@ -379,55 +452,6 @@ namespace AsbCloudDb.Migrations
b.HasComment("Drill_test");
});
- modelBuilder.Entity("AsbCloudDb.Model.DrillTestParameter", b =>
- {
- b.Property("IdDrillTest")
- .HasColumnType("integer")
- .HasColumnName("id_drill_test")
- .HasComment("Идентификатор drill test");
-
- b.Property("IdTelemetryDrillTest")
- .HasColumnType("integer")
- .HasColumnName("id_telemetry_drill_test")
- .HasComment("Идентификатор телеметрии drill test");
-
- b.Property("DepthDrillStep")
- .HasColumnType("real")
- .HasColumnName("depth_drill_step")
- .HasComment("Глубина бурения шага");
-
- b.Property("DepthSpeed")
- .HasColumnType("real")
- .HasColumnName("depth_speed")
- .HasComment("Скорость проходки");
-
- b.Property("Speed")
- .HasColumnType("real")
- .HasColumnName("speed")
- .HasComment("Заданная скорость");
-
- b.Property("Step")
- .HasColumnType("integer")
- .HasColumnName("step")
- .HasComment("Шаг");
-
- b.Property("TimeDrillStep")
- .HasColumnType("real")
- .HasColumnName("time_drill_step")
- .HasComment("Время бурения шага");
-
- b.Property("Workload")
- .HasColumnType("real")
- .HasColumnName("workload")
- .HasComment("Нагрузка");
-
- b.HasKey("IdDrillTest", "IdTelemetryDrillTest");
-
- b.ToTable("t_drill_test_parameter");
-
- b.HasComment("Drill_test_parameter");
- });
-
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{
b.Property("Id")
@@ -2274,24 +2298,6 @@ namespace AsbCloudDb.Migrations
Name = "PlannedTrajectory.delete"
},
new
- {
- Id = 513,
- Description = "Разрешение просматривать РТК",
- Name = "ProcessMap.get"
- },
- new
- {
- Id = 514,
- Description = "Разрешение редактировать РТК",
- Name = "ProcessMap.edit"
- },
- new
- {
- Id = 515,
- Description = "Разрешение удалять РТК",
- Name = "ProcessMap.delete"
- },
- new
{
Id = 516,
Description = "Разрешение просматривать статистику вопросов",
@@ -2362,6 +2368,12 @@ namespace AsbCloudDb.Migrations
Id = 527,
Description = "Разрешение на удаление инструкций",
Name = "Manual.delete"
+ },
+ new
+ {
+ Id = 528,
+ Description = "Разрешение на удаление контакта",
+ Name = "WellContact.delete"
});
});
@@ -2435,7 +2447,7 @@ namespace AsbCloudDb.Migrations
b.HasComment("Загрузка плановой траектории");
});
- modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b =>
+ modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
@@ -2454,15 +2466,20 @@ namespace AsbCloudDb.Migrations
.HasColumnName("axial_load_plan")
.HasComment("Нагрузка, план");
+ b.Property("Comment")
+ .HasColumnType("text")
+ .HasColumnName("comment")
+ .HasComment("Комментарий");
+
b.Property("DepthEnd")
.HasColumnType("double precision")
.HasColumnName("depth_end")
- .HasComment("Глубина окончания интервала");
+ .HasComment("Глубина по стволу до, м");
b.Property("DepthStart")
.HasColumnType("double precision")
.HasColumnName("depth_start")
- .HasComment("Стартовая глубина");
+ .HasComment("Глубина по стволу от, м");
b.Property("FlowLimitMax")
.HasColumnType("double precision")
@@ -2486,7 +2503,7 @@ namespace AsbCloudDb.Migrations
b.Property("IdWell")
.HasColumnType("integer")
- .HasColumnName("well_id")
+ .HasColumnName("id_well")
.HasComment("Id скважины");
b.Property("IdWellSectionType")
@@ -2546,16 +2563,18 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id");
+ b.HasIndex("IdUser");
+
b.HasIndex("IdWell");
b.HasIndex("IdWellSectionType");
- b.ToTable("t_process_map");
+ b.ToTable("t_process_map_well_drilling");
- b.HasComment("Операции по скважине – РТК");
+ b.HasComment("РТК бурение скважины");
});
- modelBuilder.Entity("AsbCloudDb.Model.ProcessMapWellboreDevelopment", b =>
+ modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
@@ -2572,12 +2591,12 @@ namespace AsbCloudDb.Migrations
b.Property("DepthEnd")
.HasColumnType("double precision")
.HasColumnName("depth_end")
- .HasComment("Окончательная глубина, м");
+ .HasComment("Глубина по стволу до, м");
b.Property("DepthStart")
.HasColumnType("double precision")
.HasColumnName("depth_start")
- .HasComment("Стартовая глубина, м");
+ .HasComment("Глубина по стволу от, м");
b.Property("IdUser")
.HasColumnType("integer")
@@ -2589,6 +2608,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_well")
.HasComment("Id скважины");
+ b.Property("IdWellSectionType")
+ .HasColumnType("integer")
+ .HasColumnName("id_wellsection_type")
+ .HasComment("Тип секции");
+
b.Property("LastUpdate")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_update")
@@ -2645,9 +2669,11 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell");
- b.ToTable("t_process_map_wellbore_development");
+ b.HasIndex("IdWellSectionType");
- b.HasComment("РТК план проработка скважины");
+ b.ToTable("t_process_map_well_ream");
+
+ b.HasComment("РТК проработка скважины");
});
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
@@ -3951,21 +3977,6 @@ namespace AsbCloudDb.Migrations
IdPermission = 512
},
new
- {
- IdUserRole = 1,
- IdPermission = 513
- },
- new
- {
- IdUserRole = 1,
- IdPermission = 514
- },
- new
- {
- IdUserRole = 1,
- IdPermission = 515
- },
- new
{
IdUserRole = 1,
IdPermission = 516
@@ -4024,6 +4035,11 @@ namespace AsbCloudDb.Migrations
{
IdUserRole = 1,
IdPermission = 527
+ },
+ new
+ {
+ IdUserRole = 1,
+ IdPermission = 528
});
});
@@ -7801,6 +7817,25 @@ namespace AsbCloudDb.Migrations
b.Navigation("CompanyType");
});
+ modelBuilder.Entity("AsbCloudDb.Model.Contact", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType")
+ .WithMany("Contacts")
+ .HasForeignKey("IdCompanyType")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany("Contacts")
+ .HasForeignKey("IdWell")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("CompanyType");
+
+ b.Navigation("Well");
+ });
+
modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
{
b.HasOne("AsbCloudDb.Model.Well", "Well")
@@ -7861,17 +7896,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Telemetry");
});
- modelBuilder.Entity("AsbCloudDb.Model.DrillTestParameter", b =>
- {
- b.HasOne("AsbCloudDb.Model.DrillTest", "DrillTest")
- .WithMany("Params")
- .HasForeignKey("IdDrillTest", "IdTelemetryDrillTest")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("DrillTest");
- });
-
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{
b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer")
@@ -8103,26 +8127,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well");
});
- modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b =>
- {
- b.HasOne("AsbCloudDb.Model.Well", "Well")
- .WithMany("ProcessMaps")
- .HasForeignKey("IdWell")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
- .WithMany()
- .HasForeignKey("IdWellSectionType")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("Well");
-
- b.Navigation("WellSectionType");
- });
-
- modelBuilder.Entity("AsbCloudDb.Model.ProcessMapWellboreDevelopment", b =>
+ modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{
b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany()
@@ -8136,9 +8141,44 @@ namespace AsbCloudDb.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
+ .WithMany()
+ .HasForeignKey("IdWellSectionType")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
b.Navigation("User");
b.Navigation("Well");
+
+ b.Navigation("WellSectionType");
+ });
+
+ modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellReam", b =>
+ {
+ b.HasOne("AsbCloudDb.Model.User", "User")
+ .WithMany()
+ .HasForeignKey("IdUser")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.Well", "Well")
+ .WithMany()
+ .HasForeignKey("IdWell")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
+ .WithMany()
+ .HasForeignKey("IdWellSectionType")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("User");
+
+ b.Navigation("Well");
+
+ b.Navigation("WellSectionType");
});
modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
@@ -8650,6 +8690,8 @@ namespace AsbCloudDb.Migrations
modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b =>
{
b.Navigation("Companies");
+
+ b.Navigation("Contacts");
});
modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
@@ -8667,11 +8709,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("RelatedUsers");
});
- modelBuilder.Entity("AsbCloudDb.Model.DrillTest", b =>
- {
- b.Navigation("Params");
- });
-
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
{
b.Navigation("FileMarks");
@@ -8736,9 +8773,9 @@ namespace AsbCloudDb.Migrations
modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
{
- b.Navigation("DrillingProgramParts");
+ b.Navigation("Contacts");
- b.Navigation("ProcessMaps");
+ b.Navigation("DrillingProgramParts");
b.Navigation("RelationCompaniesWells");
diff --git a/AsbCloudDb/Migrations/20231017094813_Add_Drill_Test.cs b/AsbCloudDb/Migrations/20231017094813_Add_Drill_Test.cs
new file mode 100644
index 00000000..d5d47871
--- /dev/null
+++ b/AsbCloudDb/Migrations/20231017094813_Add_Drill_Test.cs
@@ -0,0 +1,46 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace AsbCloudDb.Migrations
+{
+ public partial class Add_Drill_Test : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "t_drill_test",
+ columns: table => new
+ {
+ id = table.Column(type: "integer", nullable: false, comment: "Идентификатор"),
+ id_telemetry = table.Column(type: "integer", nullable: false, comment: "Идентификатор телеметрии"),
+ timestamp_start = table.Column(type: "timestamp with time zone", nullable: false, comment: "Время начала"),
+ depthStart = table.Column(type: "real", nullable: false, comment: "Глубина начала"),
+ t_drill_test_params = table.Column(type: "jsonb", nullable: false, comment: "Параметры записи drill test")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_t_drill_test", x => new { x.id, x.id_telemetry });
+ table.ForeignKey(
+ name: "FK_t_drill_test_t_telemetry_id_telemetry",
+ column: x => x.id_telemetry,
+ principalTable: "t_telemetry",
+ principalColumn: "id",
+ onDelete: ReferentialAction.Cascade);
+ },
+ comment: "Drill_test");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_t_drill_test_id_telemetry",
+ table: "t_drill_test",
+ column: "id_telemetry");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "t_drill_test");
+ }
+ }
+}
diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs
index 290680c1..c91ce752 100644
--- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs
+++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs
@@ -425,13 +425,19 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_telemetry")
.HasComment("Идентификатор телеметрии");
- b.Property("DepthStart")
+ b.Property("DepthStart")
.HasColumnType("real")
.HasColumnName("depthStart")
.HasComment("Глубина начала");
- b.Property("TimeStampStart")
- .HasColumnType("integer")
+ b.Property("Params")
+ .IsRequired()
+ .HasColumnType("jsonb")
+ .HasColumnName("t_drill_test_params")
+ .HasComment("Параметры записи drill test");
+
+ b.Property("TimeStampStart")
+ .HasColumnType("timestamp with time zone")
.HasColumnName("timestamp_start")
.HasComment("Время начала");
@@ -444,55 +450,6 @@ namespace AsbCloudDb.Migrations
b.HasComment("Drill_test");
});
- modelBuilder.Entity("AsbCloudDb.Model.DrillTestParameter", b =>
- {
- b.Property("IdDrillTest")
- .HasColumnType("integer")
- .HasColumnName("id_drill_test")
- .HasComment("Идентификатор drill test");
-
- b.Property("IdTelemetryDrillTest")
- .HasColumnType("integer")
- .HasColumnName("id_telemetry_drill_test")
- .HasComment("Идентификатор телеметрии drill test");
-
- b.Property("DepthDrillStep")
- .HasColumnType("real")
- .HasColumnName("depth_drill_step")
- .HasComment("Глубина бурения шага");
-
- b.Property("DepthSpeed")
- .HasColumnType("real")
- .HasColumnName("depth_speed")
- .HasComment("Скорость проходки");
-
- b.Property("Speed")
- .HasColumnType("real")
- .HasColumnName("speed")
- .HasComment("Заданная скорость");
-
- b.Property("Step")
- .HasColumnType("integer")
- .HasColumnName("step")
- .HasComment("Шаг");
-
- b.Property("TimeDrillStep")
- .HasColumnType("real")
- .HasColumnName("time_drill_step")
- .HasComment("Время бурения шага");
-
- b.Property("Workload")
- .HasColumnType("real")
- .HasColumnName("workload")
- .HasComment("Нагрузка");
-
- b.HasKey("IdDrillTest", "IdTelemetryDrillTest");
-
- b.ToTable("t_drill_test_parameter");
-
- b.HasComment("Drill_test_parameter");
- });
-
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{
b.Property("Id")
@@ -7937,17 +7894,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Telemetry");
});
- modelBuilder.Entity("AsbCloudDb.Model.DrillTestParameter", b =>
- {
- b.HasOne("AsbCloudDb.Model.DrillTest", "DrillTest")
- .WithMany("Params")
- .HasForeignKey("IdDrillTest", "IdTelemetryDrillTest")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
-
- b.Navigation("DrillTest");
- });
-
modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{
b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer")
@@ -8761,11 +8707,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("RelatedUsers");
});
- modelBuilder.Entity("AsbCloudDb.Model.DrillTest", b =>
- {
- b.Navigation("Params");
- });
-
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
{
b.Navigation("FileMarks");
diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs
index b7a2e9f2..8b5a359f 100644
--- a/AsbCloudDb/Model/AsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/AsbCloudDbContext.cs
@@ -85,7 +85,6 @@ namespace AsbCloudDb.Model
public DbSet Contacts => Set();
public DbSet DrillTests => Set();
- public DbSet DrillTestParameters => Set();
public AsbCloudDbContext() : base()
{
Interlocked.Increment(ref referenceCount);
@@ -416,15 +415,11 @@ namespace AsbCloudDb.Model
modelBuilder.Entity()
.HasKey(m => new { m.Id, m.IdTelemetry });
- modelBuilder.Entity()
- .HasKey(m => new { m.IdDrillTest, m.IdTelemetryDrillTest });
-
- modelBuilder.Entity()
- .HasOne(m => m.DrillTest)
- .WithMany(f => f.Params)
- .HasForeignKey(x => new { x.IdDrillTest, x.IdTelemetryDrillTest})
- .OnDelete(DeleteBehavior.Cascade);
-
+ modelBuilder.Entity(entity =>
+ {
+ entity.Property(e => e.Params)
+ .HasJsonConversion();
+ });
DefaultData.DefaultContextData.Fill(modelBuilder);
}
diff --git a/AsbCloudDb/Model/DrillTest.cs b/AsbCloudDb/Model/DrillTest.cs
index e62ec2ea..52d29d1a 100644
--- a/AsbCloudDb/Model/DrillTest.cs
+++ b/AsbCloudDb/Model/DrillTest.cs
@@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore;
+using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
@@ -24,18 +24,19 @@ namespace AsbCloudDb.Model
///
/// Время начала drill test
///
- [Column("timestamp_start"), Comment("Время начала")]
- public int TimeStampStart { get; set; }
+ [Column("timestamp_start", TypeName = "timestamp with time zone"), Comment("Время начала")]
+ public DateTimeOffset TimeStampStart { get; set; }
///
/// Глубина начала drill test
///
[Column("depthStart"), Comment("Глубина начала")]
- public float? DepthStart { get; set; }
+ public float DepthStart { get; set; }
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry Telemetry { get; set; } = null!;
+ [Column("t_drill_test_params", TypeName = "jsonb"), Comment("Параметры записи drill test")]
public virtual ICollection Params { get; set; } = null!;
}
}
diff --git a/AsbCloudDb/Model/DrillTestParameter.cs b/AsbCloudDb/Model/DrillTestParameter.cs
index dd88dac8..457de46a 100644
--- a/AsbCloudDb/Model/DrillTestParameter.cs
+++ b/AsbCloudDb/Model/DrillTestParameter.cs
@@ -4,57 +4,39 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
{
- [Table("t_drill_test_parameter"), Comment("Drill_test_parameter")]
+ ///
+ /// Параметры записи drill test
+ ///
public class DrillTestParameter
{
- ///
- /// Идентификатор drill test
- ///
- [Key, Column("id_drill_test"), Comment("Идентификатор drill test")]
- public int IdDrillTest { get; set; }
-
- ///
- /// Идентификатор телеметрии drill test
- ///
- [Key, Column("id_telemetry_drill_test"), Comment("Идентификатор телеметрии drill test")]
- public int IdTelemetryDrillTest { get; set; }
-
///
/// Шаг
///
- [Column("step"), Comment("Шаг")]
public int Step { get; set; }
///
/// Нагрузка
///
- [Column("workload"), Comment("Нагрузка")]
public float? Workload { get; set; }
///
/// Заданная скорость
///
- [Column("speed"), Comment("Заданная скорость")]
public float? Speed { get; set; }
///
/// Скорость проходки
///
- [Column("depth_speed"), Comment("Скорость проходки")]
public float? DepthSpeed { get; set; }
///
/// Время бурения шага
///
- [Column("time_drill_step"), Comment("Время бурения шага")]
public float? TimeDrillStep { get; set; }
///
/// Глубина бурения шага
///
- [Column("depth_drill_step"), Comment("Глубина бурения шага")]
public float? DepthDrillStep { get; set; }
-
- public virtual DrillTest DrillTest { get; set; } = null!;
}
}
diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs
index dc3d20c8..74e61356 100644
--- a/AsbCloudDb/Model/IAsbCloudDbContext.cs
+++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs
@@ -77,7 +77,6 @@ namespace AsbCloudDb.Model
DbSet ManualDirectories { get; }
DbSet Contacts { get; }
DbSet DrillTests { get; }
- DbSet DrillTestParameters { get; }
DatabaseFacade Database { get; }
Task RefreshMaterializedViewAsync(string mwName, CancellationToken token);
diff --git a/AsbCloudWebApi/Controllers/SAUB/DrillTestController.cs b/AsbCloudWebApi/Controllers/SAUB/DrillTestController.cs
index 6f7d7db0..e452814a 100644
--- a/AsbCloudWebApi/Controllers/SAUB/DrillTestController.cs
+++ b/AsbCloudWebApi/Controllers/SAUB/DrillTestController.cs
@@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers.SAUB
{
- [Route("api/[controller]")]
+ [Route("api/telemetry")]
[ApiController]
public class DrillTestController : ControllerBase
@@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
/// запись drill test
///
///
- [HttpPost("{uid}")]
+ [HttpPost("{uid}/[controller]")]
public async Task PostDataAsync(
string uid,
[FromBody] DrillTestDto dto,
diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json
index c28b8530..6801ff38 100644
--- a/AsbCloudWebApi/appsettings.json
+++ b/AsbCloudWebApi/appsettings.json
@@ -7,10 +7,10 @@
}
},
"ConnectionStrings": {
- "DefaultConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True",
- "DebugConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
- "ServerConnection": "Host=192.168.1.70;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True",
- "LocalConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True"
+ "DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
+ "DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
+ "ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
+ "LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
},
"AllowedHosts": "*",
//"userLimits": {