Доработки по ревью

This commit is contained in:
Olga Nemt 2023-10-17 15:05:58 +05:00
parent a42bfdfebd
commit eaf149a667
11 changed files with 250 additions and 330 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace AsbCloudApp.Data.SAUB namespace AsbCloudApp.Data.SAUB
@ -13,25 +14,15 @@ namespace AsbCloudApp.Data.SAUB
/// </summary> /// </summary>
public int Id { get; set; } public int Id { get; set; }
/// <summary>
/// Идентификатор телеметрии drill test
/// </summary>
public int IdTelemetry { get; set; }
/// <summary> /// <summary>
/// Время начала drill test /// Время начала drill test
/// </summary> /// </summary>
public int TimeStampStart { get; set; } public DateTime TimeStampStart { get; set; }
/// <summary> /// <summary>
/// Глубина начала drill test /// Глубина начала drill test
/// </summary> /// </summary>
public float? DepthStart { get; set; } public float DepthStart { get; set; }
/// <summary>
///
/// </summary>
public TelemetryDto? Telemetry { get; set; } = null!;
/// <summary> /// <summary>
/// Параметры теста /// Параметры теста

View File

@ -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<int>(type: "integer", nullable: false, comment: "Идентификатор"),
id_telemetry = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор телеметрии"),
timestamp_start = table.Column<int>(type: "integer", nullable: false, comment: "Время начала"),
depthStart = table.Column<float>(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<int>(type: "integer", nullable: false, comment: "Идентификатор drill test"),
id_telemetry_drill_test = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор телеметрии drill test"),
step = table.Column<int>(type: "integer", nullable: false, comment: "Шаг"),
workload = table.Column<float>(type: "real", nullable: true, comment: "Нагрузка"),
speed = table.Column<float>(type: "real", nullable: true, comment: "Заданная скорость"),
depth_speed = table.Column<float>(type: "real", nullable: true, comment: "Скорость проходки"),
time_drill_step = table.Column<float>(type: "real", nullable: true, comment: "Время бурения шага"),
depth_drill_step = table.Column<float>(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");
}
}
}

View File

@ -13,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations namespace AsbCloudDb.Migrations
{ {
[DbContext(typeof(AsbCloudDbContext))] [DbContext(typeof(AsbCloudDbContext))]
[Migration("20231017055919_Add_Drill_Test")] [Migration("20231017094813_Add_Drill_Test")]
partial class Add_Drill_Test partial class Add_Drill_Test
{ {
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -156,6 +156,73 @@ namespace AsbCloudDb.Migrations
}); });
}); });
modelBuilder.Entity("AsbCloudDb.Model.Contact", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Company")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("company")
.HasComment("компания");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("email")
.HasComment("email");
b.Property<string>("FullName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("full_name")
.HasComment("ФИО");
b.Property<int>("IdCompanyType")
.HasMaxLength(255)
.HasColumnType("integer")
.HasColumnName("id_company_type")
.HasComment("вид деятельности");
b.Property<int>("IdWell")
.HasMaxLength(255)
.HasColumnType("integer")
.HasColumnName("id_well")
.HasComment("ключ скважины");
b.Property<string>("Phone")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)")
.HasColumnName("phone")
.HasComment("номер телефона");
b.Property<string>("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 => modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
{ {
b.Property<int>("IdWell") b.Property<int>("IdWell")
@ -360,13 +427,19 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_telemetry") .HasColumnName("id_telemetry")
.HasComment("Идентификатор телеметрии"); .HasComment("Идентификатор телеметрии");
b.Property<float?>("DepthStart") b.Property<float>("DepthStart")
.HasColumnType("real") .HasColumnType("real")
.HasColumnName("depthStart") .HasColumnName("depthStart")
.HasComment("Глубина начала"); .HasComment("Глубина начала");
b.Property<int>("TimeStampStart") b.Property<string>("Params")
.HasColumnType("integer") .IsRequired()
.HasColumnType("jsonb")
.HasColumnName("t_drill_test_params")
.HasComment("Параметры записи drill test");
b.Property<DateTimeOffset>("TimeStampStart")
.HasColumnType("timestamp with time zone")
.HasColumnName("timestamp_start") .HasColumnName("timestamp_start")
.HasComment("Время начала"); .HasComment("Время начала");
@ -379,55 +452,6 @@ namespace AsbCloudDb.Migrations
b.HasComment("Drill_test"); b.HasComment("Drill_test");
}); });
modelBuilder.Entity("AsbCloudDb.Model.DrillTestParameter", b =>
{
b.Property<int>("IdDrillTest")
.HasColumnType("integer")
.HasColumnName("id_drill_test")
.HasComment("Идентификатор drill test");
b.Property<int>("IdTelemetryDrillTest")
.HasColumnType("integer")
.HasColumnName("id_telemetry_drill_test")
.HasComment("Идентификатор телеметрии drill test");
b.Property<float?>("DepthDrillStep")
.HasColumnType("real")
.HasColumnName("depth_drill_step")
.HasComment("Глубина бурения шага");
b.Property<float?>("DepthSpeed")
.HasColumnType("real")
.HasColumnName("depth_speed")
.HasComment("Скорость проходки");
b.Property<float?>("Speed")
.HasColumnType("real")
.HasColumnName("speed")
.HasComment("Заданная скорость");
b.Property<int>("Step")
.HasColumnType("integer")
.HasColumnName("step")
.HasComment("Шаг");
b.Property<float?>("TimeDrillStep")
.HasColumnType("real")
.HasColumnName("time_drill_step")
.HasComment("Время бурения шага");
b.Property<float?>("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 => modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -2274,24 +2298,6 @@ namespace AsbCloudDb.Migrations
Name = "PlannedTrajectory.delete" Name = "PlannedTrajectory.delete"
}, },
new new
{
Id = 513,
Description = "Разрешение просматривать РТК",
Name = "ProcessMap.get"
},
new
{
Id = 514,
Description = "Разрешение редактировать РТК",
Name = "ProcessMap.edit"
},
new
{
Id = 515,
Description = "Разрешение удалять РТК",
Name = "ProcessMap.delete"
},
new
{ {
Id = 516, Id = 516,
Description = "Разрешение просматривать статистику вопросов", Description = "Разрешение просматривать статистику вопросов",
@ -2362,6 +2368,12 @@ namespace AsbCloudDb.Migrations
Id = 527, Id = 527,
Description = "Разрешение на удаление инструкций", Description = "Разрешение на удаление инструкций",
Name = "Manual.delete" Name = "Manual.delete"
},
new
{
Id = 528,
Description = "Разрешение на удаление контакта",
Name = "WellContact.delete"
}); });
}); });
@ -2435,7 +2447,7 @@ namespace AsbCloudDb.Migrations
b.HasComment("Загрузка плановой траектории"); b.HasComment("Загрузка плановой траектории");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2454,15 +2466,20 @@ namespace AsbCloudDb.Migrations
.HasColumnName("axial_load_plan") .HasColumnName("axial_load_plan")
.HasComment("Нагрузка, план"); .HasComment("Нагрузка, план");
b.Property<string>("Comment")
.HasColumnType("text")
.HasColumnName("comment")
.HasComment("Комментарий");
b.Property<double>("DepthEnd") b.Property<double>("DepthEnd")
.HasColumnType("double precision") .HasColumnType("double precision")
.HasColumnName("depth_end") .HasColumnName("depth_end")
.HasComment("Глубина окончания интервала"); .HasComment("Глубина по стволу до, м");
b.Property<double>("DepthStart") b.Property<double>("DepthStart")
.HasColumnType("double precision") .HasColumnType("double precision")
.HasColumnName("depth_start") .HasColumnName("depth_start")
.HasComment("Стартовая глубина"); .HasComment("Глубина по стволу от, м");
b.Property<double>("FlowLimitMax") b.Property<double>("FlowLimitMax")
.HasColumnType("double precision") .HasColumnType("double precision")
@ -2486,7 +2503,7 @@ namespace AsbCloudDb.Migrations
b.Property<int>("IdWell") b.Property<int>("IdWell")
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("well_id") .HasColumnName("id_well")
.HasComment("Id скважины"); .HasComment("Id скважины");
b.Property<int>("IdWellSectionType") b.Property<int>("IdWellSectionType")
@ -2546,16 +2563,18 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("IdUser");
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.HasIndex("IdWellSectionType"); 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<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -2572,12 +2591,12 @@ namespace AsbCloudDb.Migrations
b.Property<double>("DepthEnd") b.Property<double>("DepthEnd")
.HasColumnType("double precision") .HasColumnType("double precision")
.HasColumnName("depth_end") .HasColumnName("depth_end")
.HasComment("Окончательная глубина, м"); .HasComment("Глубина по стволу до, м");
b.Property<double>("DepthStart") b.Property<double>("DepthStart")
.HasColumnType("double precision") .HasColumnType("double precision")
.HasColumnName("depth_start") .HasColumnName("depth_start")
.HasComment("Стартовая глубина, м"); .HasComment("Глубина по стволу от, м");
b.Property<int>("IdUser") b.Property<int>("IdUser")
.HasColumnType("integer") .HasColumnType("integer")
@ -2589,6 +2608,11 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_well") .HasColumnName("id_well")
.HasComment("Id скважины"); .HasComment("Id скважины");
b.Property<int>("IdWellSectionType")
.HasColumnType("integer")
.HasColumnName("id_wellsection_type")
.HasComment("Тип секции");
b.Property<DateTimeOffset>("LastUpdate") b.Property<DateTimeOffset>("LastUpdate")
.HasColumnType("timestamp with time zone") .HasColumnType("timestamp with time zone")
.HasColumnName("last_update") .HasColumnName("last_update")
@ -2645,9 +2669,11 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); 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 => modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
@ -3951,21 +3977,6 @@ namespace AsbCloudDb.Migrations
IdPermission = 512 IdPermission = 512
}, },
new new
{
IdUserRole = 1,
IdPermission = 513
},
new
{
IdUserRole = 1,
IdPermission = 514
},
new
{
IdUserRole = 1,
IdPermission = 515
},
new
{ {
IdUserRole = 1, IdUserRole = 1,
IdPermission = 516 IdPermission = 516
@ -4024,6 +4035,11 @@ namespace AsbCloudDb.Migrations
{ {
IdUserRole = 1, IdUserRole = 1,
IdPermission = 527 IdPermission = 527
},
new
{
IdUserRole = 1,
IdPermission = 528
}); });
}); });
@ -7801,6 +7817,25 @@ namespace AsbCloudDb.Migrations
b.Navigation("CompanyType"); 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 => modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b =>
{ {
b.HasOne("AsbCloudDb.Model.Well", "Well") b.HasOne("AsbCloudDb.Model.Well", "Well")
@ -7861,17 +7896,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Telemetry"); 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 => modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{ {
b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer") b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer")
@ -8103,26 +8127,7 @@ namespace AsbCloudDb.Migrations
b.Navigation("Well"); b.Navigation("Well");
}); });
modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b => modelBuilder.Entity("AsbCloudDb.Model.ProcessMaps.ProcessMapWellDrilling", 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 =>
{ {
b.HasOne("AsbCloudDb.Model.User", "User") b.HasOne("AsbCloudDb.Model.User", "User")
.WithMany() .WithMany()
@ -8136,9 +8141,44 @@ namespace AsbCloudDb.Migrations
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType")
.WithMany()
.HasForeignKey("IdWellSectionType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User"); b.Navigation("User");
b.Navigation("Well"); 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 => modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b =>
@ -8650,6 +8690,8 @@ namespace AsbCloudDb.Migrations
modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b =>
{ {
b.Navigation("Companies"); b.Navigation("Companies");
b.Navigation("Contacts");
}); });
modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => modelBuilder.Entity("AsbCloudDb.Model.Deposit", b =>
@ -8667,11 +8709,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("RelatedUsers"); b.Navigation("RelatedUsers");
}); });
modelBuilder.Entity("AsbCloudDb.Model.DrillTest", b =>
{
b.Navigation("Params");
});
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
{ {
b.Navigation("FileMarks"); b.Navigation("FileMarks");
@ -8736,9 +8773,9 @@ namespace AsbCloudDb.Migrations
modelBuilder.Entity("AsbCloudDb.Model.Well", b => modelBuilder.Entity("AsbCloudDb.Model.Well", b =>
{ {
b.Navigation("DrillingProgramParts"); b.Navigation("Contacts");
b.Navigation("ProcessMaps"); b.Navigation("DrillingProgramParts");
b.Navigation("RelationCompaniesWells"); b.Navigation("RelationCompaniesWells");

View File

@ -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<int>(type: "integer", nullable: false, comment: "Идентификатор"),
id_telemetry = table.Column<int>(type: "integer", nullable: false, comment: "Идентификатор телеметрии"),
timestamp_start = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "Время начала"),
depthStart = table.Column<float>(type: "real", nullable: false, comment: "Глубина начала"),
t_drill_test_params = table.Column<string>(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");
}
}
}

View File

@ -425,13 +425,19 @@ namespace AsbCloudDb.Migrations
.HasColumnName("id_telemetry") .HasColumnName("id_telemetry")
.HasComment("Идентификатор телеметрии"); .HasComment("Идентификатор телеметрии");
b.Property<float?>("DepthStart") b.Property<float>("DepthStart")
.HasColumnType("real") .HasColumnType("real")
.HasColumnName("depthStart") .HasColumnName("depthStart")
.HasComment("Глубина начала"); .HasComment("Глубина начала");
b.Property<int>("TimeStampStart") b.Property<string>("Params")
.HasColumnType("integer") .IsRequired()
.HasColumnType("jsonb")
.HasColumnName("t_drill_test_params")
.HasComment("Параметры записи drill test");
b.Property<DateTimeOffset>("TimeStampStart")
.HasColumnType("timestamp with time zone")
.HasColumnName("timestamp_start") .HasColumnName("timestamp_start")
.HasComment("Время начала"); .HasComment("Время начала");
@ -444,55 +450,6 @@ namespace AsbCloudDb.Migrations
b.HasComment("Drill_test"); b.HasComment("Drill_test");
}); });
modelBuilder.Entity("AsbCloudDb.Model.DrillTestParameter", b =>
{
b.Property<int>("IdDrillTest")
.HasColumnType("integer")
.HasColumnName("id_drill_test")
.HasComment("Идентификатор drill test");
b.Property<int>("IdTelemetryDrillTest")
.HasColumnType("integer")
.HasColumnName("id_telemetry_drill_test")
.HasComment("Идентификатор телеметрии drill test");
b.Property<float?>("DepthDrillStep")
.HasColumnType("real")
.HasColumnName("depth_drill_step")
.HasComment("Глубина бурения шага");
b.Property<float?>("DepthSpeed")
.HasColumnType("real")
.HasColumnName("depth_speed")
.HasComment("Скорость проходки");
b.Property<float?>("Speed")
.HasColumnType("real")
.HasColumnName("speed")
.HasComment("Заданная скорость");
b.Property<int>("Step")
.HasColumnType("integer")
.HasColumnName("step")
.HasComment("Шаг");
b.Property<float?>("TimeDrillStep")
.HasColumnType("real")
.HasColumnName("time_drill_step")
.HasComment("Время бурения шага");
b.Property<float?>("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 => modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -7937,17 +7894,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("Telemetry"); 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 => modelBuilder.Entity("AsbCloudDb.Model.Faq", b =>
{ {
b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer") b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer")
@ -8761,11 +8707,6 @@ namespace AsbCloudDb.Migrations
b.Navigation("RelatedUsers"); b.Navigation("RelatedUsers");
}); });
modelBuilder.Entity("AsbCloudDb.Model.DrillTest", b =>
{
b.Navigation("Params");
});
modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b =>
{ {
b.Navigation("FileMarks"); b.Navigation("FileMarks");

View File

@ -85,7 +85,6 @@ namespace AsbCloudDb.Model
public DbSet<Contact> Contacts => Set<Contact>(); public DbSet<Contact> Contacts => Set<Contact>();
public DbSet<DrillTest> DrillTests => Set<DrillTest>(); public DbSet<DrillTest> DrillTests => Set<DrillTest>();
public DbSet<DrillTestParameter> DrillTestParameters => Set<DrillTestParameter>();
public AsbCloudDbContext() : base() public AsbCloudDbContext() : base()
{ {
Interlocked.Increment(ref referenceCount); Interlocked.Increment(ref referenceCount);
@ -416,15 +415,11 @@ namespace AsbCloudDb.Model
modelBuilder.Entity<DrillTest>() modelBuilder.Entity<DrillTest>()
.HasKey(m => new { m.Id, m.IdTelemetry }); .HasKey(m => new { m.Id, m.IdTelemetry });
modelBuilder.Entity<DrillTestParameter>() modelBuilder.Entity<DrillTest>(entity =>
.HasKey(m => new { m.IdDrillTest, m.IdTelemetryDrillTest }); {
entity.Property(e => e.Params)
modelBuilder.Entity<DrillTestParameter>() .HasJsonConversion();
.HasOne(m => m.DrillTest) });
.WithMany(f => f.Params)
.HasForeignKey(x => new { x.IdDrillTest, x.IdTelemetryDrillTest})
.OnDelete(DeleteBehavior.Cascade);
DefaultData.DefaultContextData.Fill(modelBuilder); DefaultData.DefaultContextData.Fill(modelBuilder);
} }

View File

@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
@ -24,18 +24,19 @@ namespace AsbCloudDb.Model
/// <summary> /// <summary>
/// Время начала drill test /// Время начала drill test
/// </summary> /// </summary>
[Column("timestamp_start"), Comment("Время начала")] [Column("timestamp_start", TypeName = "timestamp with time zone"), Comment("Время начала")]
public int TimeStampStart { get; set; } public DateTimeOffset TimeStampStart { get; set; }
/// <summary> /// <summary>
/// Глубина начала drill test /// Глубина начала drill test
/// </summary> /// </summary>
[Column("depthStart"), Comment("Глубина начала")] [Column("depthStart"), Comment("Глубина начала")]
public float? DepthStart { get; set; } public float DepthStart { get; set; }
[ForeignKey(nameof(IdTelemetry))] [ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry Telemetry { get; set; } = null!; public virtual Telemetry Telemetry { get; set; } = null!;
[Column("t_drill_test_params", TypeName = "jsonb"), Comment("Параметры записи drill test")]
public virtual ICollection<DrillTestParameter> Params { get; set; } = null!; public virtual ICollection<DrillTestParameter> Params { get; set; } = null!;
} }
} }

View File

@ -4,57 +4,39 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_drill_test_parameter"), Comment("Drill_test_parameter")] /// <summary>
/// Параметры записи drill test
/// </summary>
public class DrillTestParameter public class DrillTestParameter
{ {
/// <summary>
/// Идентификатор drill test
/// </summary>
[Key, Column("id_drill_test"), Comment("Идентификатор drill test")]
public int IdDrillTest { get; set; }
/// <summary>
/// Идентификатор телеметрии drill test
/// </summary>
[Key, Column("id_telemetry_drill_test"), Comment("Идентификатор телеметрии drill test")]
public int IdTelemetryDrillTest { get; set; }
/// <summary> /// <summary>
/// Шаг /// Шаг
/// </summary> /// </summary>
[Column("step"), Comment("Шаг")]
public int Step { get; set; } public int Step { get; set; }
/// <summary> /// <summary>
/// Нагрузка /// Нагрузка
/// </summary> /// </summary>
[Column("workload"), Comment("Нагрузка")]
public float? Workload { get; set; } public float? Workload { get; set; }
/// <summary> /// <summary>
/// Заданная скорость /// Заданная скорость
/// </summary> /// </summary>
[Column("speed"), Comment("Заданная скорость")]
public float? Speed { get; set; } public float? Speed { get; set; }
/// <summary> /// <summary>
/// Скорость проходки /// Скорость проходки
/// </summary> /// </summary>
[Column("depth_speed"), Comment("Скорость проходки")]
public float? DepthSpeed { get; set; } public float? DepthSpeed { get; set; }
/// <summary> /// <summary>
/// Время бурения шага /// Время бурения шага
/// </summary> /// </summary>
[Column("time_drill_step"), Comment("Время бурения шага")]
public float? TimeDrillStep { get; set; } public float? TimeDrillStep { get; set; }
/// <summary> /// <summary>
/// Глубина бурения шага /// Глубина бурения шага
/// </summary> /// </summary>
[Column("depth_drill_step"), Comment("Глубина бурения шага")]
public float? DepthDrillStep { get; set; } public float? DepthDrillStep { get; set; }
public virtual DrillTest DrillTest { get; set; } = null!;
} }
} }

View File

@ -77,7 +77,6 @@ namespace AsbCloudDb.Model
DbSet<ManualDirectory> ManualDirectories { get; } DbSet<ManualDirectory> ManualDirectories { get; }
DbSet<Contact> Contacts { get; } DbSet<Contact> Contacts { get; }
DbSet<DrillTest> DrillTests { get; } DbSet<DrillTest> DrillTests { get; }
DbSet<DrillTestParameter> DrillTestParameters { get; }
DatabaseFacade Database { get; } DatabaseFacade Database { get; }
Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token); Task<int> RefreshMaterializedViewAsync(string mwName, CancellationToken token);

View File

@ -15,7 +15,7 @@ using System.Threading.Tasks;
namespace AsbCloudWebApi.Controllers.SAUB namespace AsbCloudWebApi.Controllers.SAUB
{ {
[Route("api/[controller]")] [Route("api/telemetry")]
[ApiController] [ApiController]
public class DrillTestController : ControllerBase public class DrillTestController : ControllerBase
@ -47,7 +47,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
/// <param name="dto">запись drill test</param> /// <param name="dto">запись drill test</param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("{uid}")] [HttpPost("{uid}/[controller]")]
public async Task<IActionResult> PostDataAsync( public async Task<IActionResult> PostDataAsync(
string uid, string uid,
[FromBody] DrillTestDto dto, [FromBody] DrillTestDto dto,

View File

@ -7,10 +7,10 @@
} }
}, },
"ConnectionStrings": { "ConnectionStrings": {
"DefaultConnection": "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=postgres2;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=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=postgres2;Username=postgres;Password=q;Persist Security Info=True", "ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
"LocalConnection": "Host=localhost;Database=postgres2;Username=postgres;Password=q;Persist Security Info=True" "LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
//"userLimits": { //"userLimits": {