Enable nullable for ef models: Deposit, Cluster, Well, WellOperation, WellOperationCategory, Company, and corresponding dtos.

This commit is contained in:
ngfrolov 2023-02-17 15:30:17 +05:00
parent 3510af3628
commit 61bee21ad9
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7
23 changed files with 7507 additions and 155 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
@ -11,7 +12,7 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// ИД месторождения, необязательный /// ИД месторождения, необязательный
/// </summary> /// </summary>
public int? IdDeposit { get; set; } public int IdDeposit { get; set; }
/// <summary> /// <summary>
/// DTO месторождения /// DTO месторождения
@ -21,7 +22,7 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// Список скважин куста /// Список скважин куста
/// </summary> /// </summary>
public IEnumerable<WellDto>? Wells { get; set; } = null!; public IEnumerable<WellDto> Wells { get; set; } = Enumerable.Empty<WellDto>();
} }
/// <summary> /// <summary>
@ -32,7 +33,6 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// Список скважин куста /// Список скважин куста
/// </summary> /// </summary>
public IEnumerable<WellMapInfoDto>? Wells { get; set; } = null!; public IEnumerable<WellMapInfoDto> Wells { get; set; } = Enumerable.Empty<WellMapInfoDto>();
} }
#nullable disable
} }

View File

@ -1,5 +1,8 @@
namespace AsbCloudApp.Data using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// DTO компании /// DTO компании
/// </summary> /// </summary>
@ -11,7 +14,8 @@
/// <summary> /// <summary>
/// Название /// Название
/// </summary> /// </summary>
public string Caption { get; set; } [Required]
public string Caption { get; set; } = null!;
/// <summary> /// <summary>
/// ИД типа компании /// ИД типа компании
@ -21,6 +25,6 @@
/// <summary> /// <summary>
/// Название типа компании /// Название типа компании
/// </summary> /// </summary>
public string CompanyTypeCaption { get; set; } public string CompanyTypeCaption { get; set; } = null!;
} }
} }

View File

@ -1,7 +1,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// DTO Месторождения /// DTO Месторождения
/// </summary> /// </summary>
@ -17,7 +21,7 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// Кусты месторождения /// Кусты месторождения
/// </summary> /// </summary>
public IEnumerable<ClusterDto> Clusters { get; set; } public IEnumerable<ClusterDto> Clusters { get; set; } = Enumerable.Empty<ClusterDto>();
} }
/// <summary> /// <summary>
@ -28,6 +32,6 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// Кусты месторождения /// Кусты месторождения
/// </summary> /// </summary>
public IEnumerable<ClusterBranchDto> Clusters { get; set; } public IEnumerable<ClusterBranchDto> Clusters { get; set; } = Enumerable.Empty<ClusterBranchDto>();
} }
} }

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// Интерфейс данных с Id /// Интерфейс данных с Id
/// </summary> /// </summary>

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// точка на карте /// точка на карте
/// </summary> /// </summary>

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// âðåìåííàÿ çîíà /// âðåìåííàÿ çîíà
/// </summary> /// </summary>
@ -13,7 +14,7 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// èäåíòèôèêàòîð ÷àñîâîé çîíû /// èäåíòèôèêàòîð ÷àñîâîé çîíû
/// </summary> /// </summary>
public string TimezoneId { get; set; } public string? TimezoneId { get; set; }
/// <summary> /// <summary>
/// çàïðåò íà ïåðåîïðåäåëåíèå /// çàïðåò íà ïåðåîïðåäåëåíèå
@ -21,7 +22,7 @@ namespace AsbCloudApp.Data
public bool IsOverride { get; set; } public bool IsOverride { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
public override bool Equals(object obj) public override bool Equals(object? obj)
{ {
if (obj is SimpleTimezoneDto tTimeZone if (obj is SimpleTimezoneDto tTimeZone
&& tTimeZone.Hours == Hours && tTimeZone.Hours == Hours
@ -34,7 +35,7 @@ namespace AsbCloudApp.Data
/// <inheritdoc/> /// <inheritdoc/>
public override int GetHashCode() public override int GetHashCode()
=> Hours.GetHashCode() => Hours.GetHashCode()
| TimezoneId.GetHashCode() | TimezoneId?.GetHashCode()??-1
| IsOverride.GetHashCode(); | IsOverride.GetHashCode();
/// <inheritdoc/> /// <inheritdoc/>

View File

@ -1,8 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// Скважина /// Скважина
/// </summary> /// </summary>
@ -15,22 +18,23 @@ namespace AsbCloudApp.Data
public double? Longitude { get; set; } public double? Longitude { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
public SimpleTimezoneDto Timezone { get; set; } [Required]
public SimpleTimezoneDto Timezone { get; set; } = null!;
/// <summary> /// <summary>
/// Название типа скважины /// Название типа скважины
/// </summary> /// </summary>
public string WellType { get; set; } public string WellType { get; set; } = null!;
/// <summary> /// <summary>
/// ID типа скважины /// ID типа скважины
/// </summary> /// </summary>
public int? IdWellType { get; set; } public int IdWellType { get; set; }
/// <summary> /// <summary>
/// ID куста /// ID куста
/// </summary> /// </summary>
public int? IdCluster { get; set; } public int IdCluster { get; set; }
/// <summary> /// <summary>
/// 0 - неизвестно, /// 0 - неизвестно,
@ -57,11 +61,11 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// Объект телеметрии (инфо от панели оператора) /// Объект телеметрии (инфо от панели оператора)
/// </summary> /// </summary>
public TelemetryBaseDto Telemetry { get; set; } public TelemetryBaseDto? Telemetry { get; set; }
/// <summary> /// <summary>
/// Компании участвующие в работах на скважине /// Компании участвующие в работах на скважине
/// </summary> /// </summary>
public IEnumerable<CompanyDto> Companies { get; set; } public IEnumerable<CompanyDto> Companies { get; set; } = Enumerable.Empty<CompanyDto>();
} }
} }

View File

@ -1,5 +1,8 @@
namespace AsbCloudApp.Data using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// базовая информация о скважине /// базовая информация о скважине
/// </summary> /// </summary>
@ -11,16 +14,17 @@
/// <summary> /// <summary>
/// Название /// Название
/// </summary> /// </summary>
public string Caption { get; set; } [Required]
public string Caption { get; set; } = null!;
/// <summary> /// <summary>
/// Название куста /// Название куста
/// </summary> /// </summary>
public string Cluster { get; set; } public string Cluster { get; set; } = null!;
/// <summary> /// <summary>
/// Название месторождения /// Название месторождения
/// </summary> /// </summary>
public string Deposit { get; set; } public string Deposit { get; set; } = null!;
} }
} }

View File

@ -2,6 +2,7 @@
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
#nullable enable
/// <summary> /// <summary>
/// DTO категория операции /// DTO категория операции
/// </summary> /// </summary>
@ -13,7 +14,9 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// название /// название
/// </summary> /// </summary>
public string Name { get; set; } [Required]
[StringLength(512)]
public string Name { get; set; } = null!;
/// <summary> /// <summary>
/// Идентификатор родительской категории /// Идентификатор родительской категории
@ -24,12 +27,12 @@ namespace AsbCloudApp.Data
/// Название ключевого показателя операции /// Название ключевого показателя операции
/// </summary> /// </summary>
[StringLength(32)] [StringLength(32)]
public string KeyValueName { get; set; } public string? KeyValueName { get; set; }
/// <summary> /// <summary>
/// Единицы измерения ключевого показателя операции /// Единицы измерения ключевого показателя операции
/// </summary> /// </summary>
[StringLength(16)] [StringLength(16)]
public string KeyValueUnits { get; set; } public string? KeyValueUnits { get; set; }
} }
} }

View File

@ -1,9 +1,9 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data namespace AsbCloudApp.Data
{ {
//todo: добавить валидацию #nullable enable
/// <summary> /// <summary>
/// Операции на скважине (заведенные пользователем) /// Операции на скважине (заведенные пользователем)
/// </summary> /// </summary>
@ -13,21 +13,24 @@ namespace AsbCloudApp.Data
public int Id { get; set; } public int Id { get; set; }
/// <inheritdoc/> /// <inheritdoc/>
[Required]
public int IdWell { get; set; } public int IdWell { get; set; }
/// <summary> /// <summary>
/// id секции скважины /// id секции скважины
/// </summary> /// </summary>
[Required]
public int IdWellSectionType { get; set; } public int IdWellSectionType { get; set; }
/// <summary> /// <summary>
/// название секции скважины /// название секции скважины
/// </summary> /// </summary>
public string WellSectionTypeName { get; set; } public string WellSectionTypeName { get; set; } = null!;
/// <summary> /// <summary>
/// id категории операции /// id категории операции
/// </summary> /// </summary>
[Required]
public int IdCategory { get; set; } public int IdCategory { get; set; }
/// <summary> /// <summary>
@ -38,26 +41,30 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// название категории операции /// название категории операции
/// </summary> /// </summary>
public string CategoryName { get; set; } public string CategoryName { get; set; } = null!;
/// <summary> /// <summary>
/// дополнительная информация по операции /// дополнительная информация по операции
/// </summary> /// </summary>
public string CategoryInfo { get; set; } [StringLength(8192)]
public string? CategoryInfo { get; set; }
/// <summary> /// <summary>
/// 0 = план или 1 = факт или прогноз = 2 /// 0 = план или 1 = факт или прогноз = 2
/// </summary> /// </summary>
[Required]
public int IdType { get; set; } public int IdType { get; set; }
/// <summary> /// <summary>
/// Глубина на начало операции, м /// Глубина на начало операции, м
/// </summary> /// </summary>
[Range(0, 50_000)]
public double DepthStart { get; set; } public double DepthStart { get; set; }
/// <summary> /// <summary>
/// Глубина после завершения операции, м /// Глубина после завершения операции, м
/// </summary> /// </summary>
[Range(0, 50_000)]
public double DepthEnd { get; set; } public double DepthEnd { get; set; }
/// <summary> /// <summary>
@ -78,11 +85,14 @@ namespace AsbCloudApp.Data
/// <summary> /// <summary>
/// Продолжительность, часы /// Продолжительность, часы
/// </summary> /// </summary>
[Range(0, 50)]
public double DurationHours { get; set; } public double DurationHours { get; set; }
/// <summary> /// <summary>
/// Полезный комментарий /// Полезный комментарий
/// </summary> /// </summary>
public string Comment { get; set; } [StringLength(8192)]
public string? Comment { get; set; }
} }
#nullable disable
} }

View File

@ -0,0 +1,322 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Enable_nullable_on_deposit_cluster_well_company_wellOperation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_cluster_t_deposit_id_fk",
table: "t_cluster");
migrationBuilder.DropForeignKey(
name: "FK_t_well_t_well_type_id_well_type",
table: "t_well");
migrationBuilder.DropForeignKey(
name: "t_well_t_cluster_id_fk",
table: "t_well");
migrationBuilder.Sql("update t_well set timezone = '{\"Hours\": 5}' where timezone is null;");
migrationBuilder.Sql("update t_cluster set timezone = '{\"Hours\": 5}' where timezone is null;");
migrationBuilder.Sql("update t_deposit set timezone = '{\"Hours\": 5}' where timezone is null;");
migrationBuilder.AlterColumn<string>(
name: "timezone",
table: "t_well",
type: "jsonb",
nullable: false,
defaultValue: "{}",
comment: "Смещение часового пояса от UTC",
oldClrType: typeof(string),
oldType: "jsonb",
oldNullable: true,
oldComment: "Смещение часового пояса от UTC");
migrationBuilder.AlterColumn<int>(
name: "id_well_type",
table: "t_well",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AlterColumn<int>(
name: "id_cluster",
table: "t_well",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_well",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "timezone",
table: "t_deposit",
type: "jsonb",
nullable: false,
defaultValue: "{}",
comment: "Смещение часового пояса от UTC",
oldClrType: typeof(string),
oldType: "jsonb",
oldNullable: true,
oldComment: "Смещение часового пояса от UTC");
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_deposit",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_company_type",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_company",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "timezone",
table: "t_cluster",
type: "jsonb",
nullable: false,
defaultValue: "{}",
comment: "Смещение часового пояса от UTC",
oldClrType: typeof(string),
oldType: "jsonb",
oldNullable: true,
oldComment: "Смещение часового пояса от UTC");
migrationBuilder.AlterColumn<int>(
name: "id_deposit",
table: "t_cluster",
type: "integer",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "integer",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_cluster",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
comment: "Название",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true,
oldComment: "Название");
migrationBuilder.AddForeignKey(
name: "t_cluster_t_deposit_id_fk",
table: "t_cluster",
column: "id_deposit",
principalTable: "t_deposit",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_t_well_t_well_type_id_well_type",
table: "t_well",
column: "id_well_type",
principalTable: "t_well_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_well_t_cluster_id_fk",
table: "t_well",
column: "id_cluster",
principalTable: "t_cluster",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_cluster_t_deposit_id_fk",
table: "t_cluster");
migrationBuilder.DropForeignKey(
name: "FK_t_well_t_well_type_id_well_type",
table: "t_well");
migrationBuilder.DropForeignKey(
name: "t_well_t_cluster_id_fk",
table: "t_well");
migrationBuilder.AlterColumn<string>(
name: "timezone",
table: "t_well",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC",
oldClrType: typeof(string),
oldType: "jsonb",
oldComment: "Смещение часового пояса от UTC");
migrationBuilder.AlterColumn<int>(
name: "id_well_type",
table: "t_well",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<int>(
name: "id_cluster",
table: "t_well",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_well",
type: "character varying(255)",
maxLength: 255,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255);
migrationBuilder.AlterColumn<string>(
name: "timezone",
table: "t_deposit",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC",
oldClrType: typeof(string),
oldType: "jsonb",
oldComment: "Смещение часового пояса от UTC");
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_deposit",
type: "character varying(255)",
maxLength: 255,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255);
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_company_type",
type: "character varying(255)",
maxLength: 255,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255);
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_company",
type: "character varying(255)",
maxLength: 255,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255);
migrationBuilder.AlterColumn<string>(
name: "timezone",
table: "t_cluster",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC",
oldClrType: typeof(string),
oldType: "jsonb",
oldComment: "Смещение часового пояса от UTC");
migrationBuilder.AlterColumn<int>(
name: "id_deposit",
table: "t_cluster",
type: "integer",
nullable: true,
oldClrType: typeof(int),
oldType: "integer");
migrationBuilder.AlterColumn<string>(
name: "caption",
table: "t_cluster",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Название",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldComment: "Название");
migrationBuilder.AddForeignKey(
name: "t_cluster_t_deposit_id_fk",
table: "t_cluster",
column: "id_deposit",
principalTable: "t_deposit",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_well_t_well_type_id_well_type",
table: "t_well",
column: "id_well_type",
principalTable: "t_well_type",
principalColumn: "id");
migrationBuilder.AddForeignKey(
name: "t_well_t_cluster_id_fk",
table: "t_well",
column: "id_cluster",
principalTable: "t_cluster",
principalColumn: "id");
}
}
}

View File

@ -35,12 +35,13 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Caption") b.Property<string>("Caption")
.IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)") .HasColumnType("character varying(255)")
.HasColumnName("caption") .HasColumnName("caption")
.HasComment("Название"); .HasComment("Название");
b.Property<int?>("IdDeposit") b.Property<int>("IdDeposit")
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("id_deposit"); .HasColumnName("id_deposit");
@ -53,6 +54,7 @@ namespace AsbCloudDb.Migrations
.HasColumnName("longitude"); .HasColumnName("longitude");
b.Property<string>("Timezone") b.Property<string>("Timezone")
.IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("timezone") .HasColumnName("timezone")
.HasComment("Смещение часового пояса от UTC"); .HasComment("Смещение часового пояса от UTC");
@ -61,7 +63,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdDeposit"); b.HasIndex("IdDeposit");
b.ToTable("t_cluster", (string)null); b.ToTable("t_cluster");
b.HasComment("Кусты"); b.HasComment("Кусты");
}); });
@ -76,6 +78,7 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Caption") b.Property<string>("Caption")
.IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)") .HasColumnType("character varying(255)")
.HasColumnName("caption"); .HasColumnName("caption");
@ -90,7 +93,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdCompanyType"); b.HasIndex("IdCompanyType");
b.ToTable("t_company", (string)null); b.ToTable("t_company");
b.HasData( b.HasData(
new new
@ -111,13 +114,14 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Caption") b.Property<string>("Caption")
.IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)") .HasColumnType("character varying(255)")
.HasColumnName("caption"); .HasColumnName("caption");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_company_type", (string)null); b.ToTable("t_company_type");
b.HasData( b.HasData(
new new
@ -157,7 +161,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdWell", "StartDate") b.HasKey("IdWell", "StartDate")
.HasName("t_id_well_date_start_pk"); .HasName("t_id_well_date_start_pk");
b.ToTable("t_daily_report", (string)null); b.ToTable("t_daily_report");
b.HasComment("Ежедневные отчёты"); b.HasComment("Ежедневные отчёты");
}); });
@ -172,6 +176,7 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Caption") b.Property<string>("Caption")
.IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)") .HasColumnType("character varying(255)")
.HasColumnName("caption"); .HasColumnName("caption");
@ -185,13 +190,14 @@ namespace AsbCloudDb.Migrations
.HasColumnName("longitude"); .HasColumnName("longitude");
b.Property<string>("Timezone") b.Property<string>("Timezone")
.IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("timezone") .HasColumnName("timezone")
.HasComment("Смещение часового пояса от UTC"); .HasComment("Смещение часового пояса от UTC");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_deposit", (string)null); b.ToTable("t_deposit");
b.HasComment("Месторождение"); b.HasComment("Месторождение");
}); });
@ -255,7 +261,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry"); b.HasIndex("IdTelemetry");
b.ToTable("t_detected_operation", (string)null); b.ToTable("t_detected_operation");
b.HasComment("автоматически определенные операции по телеметрии"); b.HasComment("автоматически определенные операции по телеметрии");
}); });
@ -292,7 +298,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_driller", (string)null); b.ToTable("t_driller");
b.HasComment("Бурильщик"); b.HasComment("Бурильщик");
}); });
@ -321,7 +327,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell", "IdFileCategory") b.HasIndex("IdWell", "IdFileCategory")
.IsUnique(); .IsUnique();
b.ToTable("t_drilling_program_part", (string)null); b.ToTable("t_drilling_program_part");
b.HasComment("части программ бурения"); b.HasComment("части программ бурения");
}); });
@ -347,7 +353,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_file_category", (string)null); b.ToTable("t_file_category");
b.HasComment("Категории файлов"); b.HasComment("Категории файлов");
@ -736,7 +742,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_file_info", (string)null); b.ToTable("t_file_info");
b.HasComment("Файлы всех категорий"); b.HasComment("Файлы всех категорий");
}); });
@ -787,7 +793,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUser"); b.HasIndex("IdUser");
b.ToTable("t_file_mark", (string)null); b.ToTable("t_file_mark");
b.HasComment("Действия с файлами."); b.HasComment("Действия с файлами.");
}); });
@ -829,7 +835,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry"); b.HasIndex("IdTelemetry");
b.ToTable("t_limiting_parameter", (string)null); b.ToTable("t_limiting_parameter");
b.HasComment("Ограничения по параметрам телеметрии"); b.HasComment("Ограничения по параметрам телеметрии");
}); });
@ -874,7 +880,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_measure", (string)null); b.ToTable("t_measure");
b.HasComment("Таблица c данными для вкладки 'Последние данные'"); b.HasComment("Таблица c данными для вкладки 'Последние данные'");
}); });
@ -900,7 +906,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_measure_category", (string)null); b.ToTable("t_measure_category");
b.HasComment("Категория последних данных"); b.HasComment("Категория последних данных");
@ -971,7 +977,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_operationvalue", (string)null); b.ToTable("t_operationvalue");
b.HasComment("Целевые/нормативные показатели операции"); b.HasComment("Целевые/нормативные показатели операции");
}); });
@ -999,7 +1005,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_permission", (string)null); b.ToTable("t_permission");
b.HasComment("Разрешения на доступ к данным"); b.HasComment("Разрешения на доступ к данным");
@ -1909,7 +1915,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_planned_trajectory", (string)null); b.ToTable("t_planned_trajectory");
b.HasComment("Загрузка плановой траектории"); b.HasComment("Загрузка плановой траектории");
}); });
@ -2014,7 +2020,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType"); b.HasIndex("IdWellSectionType");
b.ToTable("t_process_map", (string)null); b.ToTable("t_process_map");
b.HasComment("Операции по скважине РТК"); b.HasComment("Операции по скважине РТК");
}); });
@ -2033,7 +2039,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_relation_company_well", (string)null); b.ToTable("t_relation_company_well");
b.HasComment("отношение скважин и компаний"); b.HasComment("отношение скважин и компаний");
}); });
@ -2058,7 +2064,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdDrillingProgramPart"); b.HasIndex("IdDrillingProgramPart");
b.ToTable("t_relation_user_drilling_program_part", (string)null); b.ToTable("t_relation_user_drilling_program_part");
b.HasComment("Отношение пользователей и частей ПБ"); b.HasComment("Отношение пользователей и частей ПБ");
}); });
@ -2077,7 +2083,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdPermission"); b.HasIndex("IdPermission");
b.ToTable("t_relation_user_role_permission", (string)null); b.ToTable("t_relation_user_role_permission");
b.HasComment("Отношение ролей пользователей и разрешений доступа"); b.HasComment("Отношение ролей пользователей и разрешений доступа");
@ -2719,7 +2725,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdInclude"); b.HasIndex("IdInclude");
b.ToTable("t_relation_user_role_user_role", (string)null); b.ToTable("t_relation_user_role_user_role");
b.HasComment("Отношение ролей к ролям"); b.HasComment("Отношение ролей к ролям");
@ -3010,7 +3016,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUserRole"); b.HasIndex("IdUserRole");
b.ToTable("t_relation_user_user_role", (string)null); b.ToTable("t_relation_user_user_role");
b.HasComment("Отношение пользователей и ролей"); b.HasComment("Отношение пользователей и ролей");
@ -3066,7 +3072,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_report_property", (string)null); b.ToTable("t_report_property");
b.HasComment("Отчеты с данными по буровым"); b.HasComment("Отчеты с данными по буровым");
}); });
@ -3117,7 +3123,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_schedule", (string)null); b.ToTable("t_schedule");
b.HasComment("График работы бурильщика"); b.HasComment("График работы бурильщика");
}); });
@ -3171,7 +3177,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWell"); b.HasIndex("IdWell");
b.ToTable("t_setpoints_rquest", (string)null); b.ToTable("t_setpoints_rquest");
b.HasComment("Запросы на изменение уставок панели оператора"); b.HasComment("Запросы на изменение уставок панели оператора");
}); });
@ -3198,7 +3204,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_subsystem", (string)null); b.ToTable("t_subsystem");
b.HasComment("Описание подсистем"); b.HasComment("Описание подсистем");
@ -3273,7 +3279,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry"); b.HasIndex("IdTelemetry");
b.ToTable("t_subsystem_operation_time", (string)null); b.ToTable("t_subsystem_operation_time");
b.HasComment("наработки подсистем"); b.HasComment("наработки подсистем");
}); });
@ -3306,7 +3312,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index");
b.ToTable("t_telemetry", (string)null); b.ToTable("t_telemetry");
b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине.");
}); });
@ -3509,7 +3515,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime"); b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_data_saub", (string)null); b.ToTable("t_telemetry_data_saub");
b.HasComment("набор основных данных по SAUB"); b.HasComment("набор основных данных по SAUB");
}); });
@ -3606,7 +3612,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime"); b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_data_spin", (string)null); b.ToTable("t_telemetry_data_spin");
b.HasComment("набор основных данных по SpinMaster"); b.HasComment("набор основных данных по SpinMaster");
}); });
@ -3631,7 +3637,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "IdEvent"); b.HasKey("IdTelemetry", "IdEvent");
b.ToTable("t_telemetry_event", (string)null); b.ToTable("t_telemetry_event");
b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии."); b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
}); });
@ -3691,7 +3697,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdTelemetry"); b.HasIndex("IdTelemetry");
b.ToTable("t_telemetry_message", (string)null); b.ToTable("t_telemetry_message");
b.HasComment("Сообщения на буровых"); b.HasComment("Сообщения на буровых");
}); });
@ -3727,7 +3733,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "IdUser"); b.HasKey("IdTelemetry", "IdUser");
b.ToTable("t_telemetry_user", (string)null); b.ToTable("t_telemetry_user");
b.HasComment("Пользователи панели САУБ. Для сообщений."); b.HasComment("Пользователи панели САУБ. Для сообщений.");
}); });
@ -3769,7 +3775,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry"); b.HasKey("IdTelemetry");
b.ToTable("t_telemetry_wireline_run_out", (string)null); b.ToTable("t_telemetry_wireline_run_out");
b.HasComment("Наработка талевого каната"); b.HasComment("Наработка талевого каната");
}); });
@ -3846,7 +3852,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("Login") b.HasIndex("Login")
.IsUnique(); .IsUnique();
b.ToTable("t_user", (string)null); b.ToTable("t_user");
b.HasComment("Пользователи облака"); b.HasComment("Пользователи облака");
@ -3883,7 +3889,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_user_role", (string)null); b.ToTable("t_user_role");
b.HasComment("Роли пользователей в системе"); b.HasComment("Роли пользователей в системе");
@ -4221,7 +4227,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdUser", "Key"); b.HasKey("IdUser", "Key");
b.ToTable("t_user_settings", (string)null); b.ToTable("t_user_settings");
b.HasComment("настройки интерфейса пользователя"); b.HasComment("настройки интерфейса пользователя");
}); });
@ -4236,11 +4242,12 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Caption") b.Property<string>("Caption")
.IsRequired()
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)") .HasColumnType("character varying(255)")
.HasColumnName("caption"); .HasColumnName("caption");
b.Property<int?>("IdCluster") b.Property<int>("IdCluster")
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("id_cluster"); .HasColumnName("id_cluster");
@ -4253,7 +4260,7 @@ namespace AsbCloudDb.Migrations
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("id_telemetry"); .HasColumnName("id_telemetry");
b.Property<int?>("IdWellType") b.Property<int>("IdWellType")
.HasColumnType("integer") .HasColumnType("integer")
.HasColumnName("id_well_type"); .HasColumnName("id_well_type");
@ -4266,6 +4273,7 @@ namespace AsbCloudDb.Migrations
.HasColumnName("longitude"); .HasColumnName("longitude");
b.Property<string>("Timezone") b.Property<string>("Timezone")
.IsRequired()
.HasColumnType("jsonb") .HasColumnType("jsonb")
.HasColumnName("timezone") .HasColumnName("timezone")
.HasComment("Смещение часового пояса от UTC"); .HasComment("Смещение часового пояса от UTC");
@ -4279,7 +4287,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellType"); b.HasIndex("IdWellType");
b.ToTable("t_well", (string)null); b.ToTable("t_well");
b.HasComment("скважины"); b.HasComment("скважины");
}); });
@ -4307,7 +4315,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSrc"); b.HasIndex("IdWellSrc");
b.ToTable("t_well_composite", (string)null); b.ToTable("t_well_composite");
b.HasComment("Композитная скважина"); b.HasComment("Композитная скважина");
}); });
@ -4333,7 +4341,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdUser"); b.HasIndex("IdUser");
b.ToTable("t_well_final_documents", (string)null); b.ToTable("t_well_final_documents");
b.HasComment("Дело скважины"); b.HasComment("Дело скважины");
}); });
@ -4416,7 +4424,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdWellSectionType"); b.HasIndex("IdWellSectionType");
b.ToTable("t_well_operation", (string)null); b.ToTable("t_well_operation");
b.HasComment("Данные по операциям на скважине"); b.HasComment("Данные по операциям на скважине");
}); });
@ -4457,7 +4465,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("IdParent"); b.HasIndex("IdParent");
b.ToTable("t_well_operation_category", (string)null); b.ToTable("t_well_operation_category");
b.HasComment("Справочник операций на скважине"); b.HasComment("Справочник операций на скважине");
@ -5308,7 +5316,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_well_section_type", (string)null); b.ToTable("t_well_section_type");
b.HasComment("конструкция секции скважины"); b.HasComment("конструкция секции скважины");
@ -5498,7 +5506,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("t_well_type", (string)null); b.ToTable("t_well_type");
b.HasComment("конструкция скважины"); b.HasComment("конструкция скважины");
@ -5555,7 +5563,7 @@ namespace AsbCloudDb.Migrations
b.HasKey("IdTelemetry", "DateTime"); b.HasKey("IdTelemetry", "DateTime");
b.ToTable("t_telemetry_wits_base", (string)null); b.ToTable("t_telemetry_wits_base");
}); });
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b =>
@ -5719,7 +5727,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId"); b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_1", (string)null); b.ToTable("t_telemetry_wits_1");
}); });
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b =>
@ -5807,7 +5815,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId"); b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_50", (string)null); b.ToTable("t_telemetry_wits_50");
}); });
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b =>
@ -5859,7 +5867,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId"); b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_60", (string)null); b.ToTable("t_telemetry_wits_60");
}); });
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b =>
@ -5915,7 +5923,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId"); b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_61", (string)null); b.ToTable("t_telemetry_wits_61");
}); });
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b =>
@ -6003,7 +6011,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId"); b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_7", (string)null); b.ToTable("t_telemetry_wits_7");
}); });
modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b =>
@ -6207,7 +6215,7 @@ namespace AsbCloudDb.Migrations
b.HasIndex("TelemetryId"); b.HasIndex("TelemetryId");
b.ToTable("t_telemetry_wits_8", (string)null); b.ToTable("t_telemetry_wits_8");
}); });
modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => modelBuilder.Entity("AsbCloudDb.Model.Cluster", b =>
@ -6215,6 +6223,8 @@ namespace AsbCloudDb.Migrations
b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") b.HasOne("AsbCloudDb.Model.Deposit", "Deposit")
.WithMany("Clusters") .WithMany("Clusters")
.HasForeignKey("IdDeposit") .HasForeignKey("IdDeposit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("t_cluster_t_deposit_id_fk"); .HasConstraintName("t_cluster_t_deposit_id_fk");
b.Navigation("Deposit"); b.Navigation("Deposit");
@ -6674,6 +6684,8 @@ namespace AsbCloudDb.Migrations
b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") b.HasOne("AsbCloudDb.Model.Cluster", "Cluster")
.WithMany("Wells") .WithMany("Wells")
.HasForeignKey("IdCluster") .HasForeignKey("IdCluster")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("t_well_t_cluster_id_fk"); .HasConstraintName("t_well_t_cluster_id_fk");
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")
@ -6684,7 +6696,9 @@ namespace AsbCloudDb.Migrations
b.HasOne("AsbCloudDb.Model.WellType", "WellType") b.HasOne("AsbCloudDb.Model.WellType", "WellType")
.WithMany("Wells") .WithMany("Wells")
.HasForeignKey("IdWellType"); .HasForeignKey("IdWellType")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cluster"); b.Navigation("Cluster");

View File

@ -3,35 +3,28 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_cluster"), Comment("Кусты")] [Table("t_cluster"), Comment("Кусты")]
public partial class Cluster : IId, IMapPoint public partial class Cluster : IId, IMapPoint
{ {
public Cluster()
{
Wells = new HashSet<Well>();
}
[Key] [Key]
[Column("id")] [Column("id")]
public int Id { get; set; } public int Id { get; set; }
[Column("caption"), Comment("Название")] [Column("caption"), Comment("Название")]
[StringLength(255)] [StringLength(255)]
public string Caption { get; set; } public string Caption { get; set; } = null!;
[Column("id_deposit")] [Column("id_deposit")]
public int? IdDeposit { get; set; } public int IdDeposit { get; set; }
[ForeignKey(nameof(IdDeposit))] [ForeignKey(nameof(IdDeposit))]
[InverseProperty(nameof(Model.Deposit.Clusters))] [InverseProperty(nameof(Model.Deposit.Clusters))]
public virtual Deposit Deposit { get; set; } public virtual Deposit Deposit { get; set; } = null!;
[InverseProperty(nameof(Well.Cluster))] [InverseProperty(nameof(Well.Cluster))]
public virtual ICollection<Well> Wells { get; set; } public virtual ICollection<Well> Wells { get; set; } = null!;
[Column("latitude")] [Column("latitude")]
public double? Latitude { get; set; } public double? Latitude { get; set; }
@ -40,6 +33,6 @@ namespace AsbCloudDb.Model
public double? Longitude { get; set; } public double? Longitude { get; set; }
[Column("timezone", TypeName = "jsonb"), Comment("Смещение часового пояса от UTC")] [Column("timezone", TypeName = "jsonb"), Comment("Смещение часового пояса от UTC")]
public SimpleTimezone Timezone { get; set; } public SimpleTimezone Timezone { get; set; } = new();
} }
} }

View File

@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_company")] [Table("t_company")]
@ -16,7 +14,7 @@ namespace AsbCloudDb.Model
[Column("caption")] [Column("caption")]
[StringLength(255)] [StringLength(255)]
public string Caption { get; set; } public string Caption { get; set; } = null!;
[Column("id_company_type"), Comment("вид деятельности")] [Column("id_company_type"), Comment("вид деятельности")]
[StringLength(255)] [StringLength(255)]
@ -24,12 +22,12 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdCompanyType))] [ForeignKey(nameof(IdCompanyType))]
[InverseProperty(nameof(Model.CompanyType.Companies))] [InverseProperty(nameof(Model.CompanyType.Companies))]
public virtual CompanyType CompanyType { get; set; } public virtual CompanyType CompanyType { get; set; } = null!;
[InverseProperty(nameof(User.Company))] [InverseProperty(nameof(User.Company))]
public virtual ICollection<User> Users { get; set; } public virtual ICollection<User> Users { get; set; } = null!;
[InverseProperty(nameof(RelationCompanyWell.Company))] [InverseProperty(nameof(RelationCompanyWell.Company))]
public virtual ICollection<RelationCompanyWell> RelationCompaniesWells { get; set; } public virtual ICollection<RelationCompanyWell> RelationCompaniesWells { get; set; } = null!;
} }
} }

View File

@ -2,8 +2,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_company_type")] [Table("t_company_type")]
@ -15,9 +13,9 @@ namespace AsbCloudDb.Model
[Column("caption")] [Column("caption")]
[StringLength(255)] [StringLength(255)]
public string Caption { get; set; } public string Caption { get; set; } = null!;
[InverseProperty(nameof(Company.CompanyType))] [InverseProperty(nameof(Company.CompanyType))]
public virtual ICollection<Company> Companies { get; set; } public virtual ICollection<Company> Companies { get; set; } = null!;
} }
} }

View File

@ -3,28 +3,21 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_deposit"), Comment("Месторождение")] [Table("t_deposit"), Comment("Месторождение")]
public partial class Deposit : IId, IMapPoint public partial class Deposit : IId, IMapPoint
{ {
public Deposit()
{
Clusters = new HashSet<Cluster>();
}
[Key] [Key]
[Column("id")] [Column("id")]
public int Id { get; set; } public int Id { get; set; }
[Column("caption")] [Column("caption")]
[StringLength(255)] [StringLength(255)]
public string Caption { get; set; } public string Caption { get; set; } = null!;
[InverseProperty(nameof(Cluster.Deposit))] [InverseProperty(nameof(Cluster.Deposit))]
public virtual ICollection<Cluster> Clusters { get; set; } public virtual ICollection<Cluster> Clusters { get; set; } = null!;
[Column("latitude")] [Column("latitude")]
public double? Latitude { get; set; } public double? Latitude { get; set; }
@ -33,6 +26,6 @@ namespace AsbCloudDb.Model
public double? Longitude { get; set; } public double? Longitude { get; set; }
[Column("timezone", TypeName = "jsonb"), Comment("Смещение часового пояса от UTC")] [Column("timezone", TypeName = "jsonb"), Comment("Смещение часового пояса от UTC")]
public SimpleTimezone Timezone { get; set; } public SimpleTimezone Timezone { get; set; } = new();
} }
} }

View File

@ -1,10 +1,9 @@
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
#nullable disable
public class SimpleTimezone public class SimpleTimezone
{ {
public double Hours { get; set; } public double Hours { get; set; } = 5d;
public string TimezoneId { get; set; } public string? TimezoneId { get; set; }
public bool IsOverride { get; set; } public bool IsOverride { get; set; }
} }

View File

@ -4,8 +4,6 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
#nullable disable
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
[Table("t_well"), Comment("скважины")] [Table("t_well"), Comment("скважины")]
@ -17,16 +15,16 @@ namespace AsbCloudDb.Model
[Column("caption")] [Column("caption")]
[StringLength(255)] [StringLength(255)]
public string Caption { get; set; } public string Caption { get; set; } = null!;
[Column("id_cluster")] [Column("id_cluster")]
public int? IdCluster { get; set; } public int IdCluster { get; set; }
[Column("id_telemetry")] [Column("id_telemetry")]
public int? IdTelemetry { get; set; } public int? IdTelemetry { get; set; }
[Column("id_well_type")] [Column("id_well_type")]
public int? IdWellType { get; set; } public int IdWellType { get; set; }
[Column("state"), Comment("0 - неизвестно, 1 - в работе, 2 - завершена")] [Column("state"), Comment("0 - неизвестно, 1 - в работе, 2 - завершена")]
public int IdState { get; set; } public int IdState { get; set; }
@ -38,37 +36,37 @@ namespace AsbCloudDb.Model
public double? Longitude { get; set; } public double? Longitude { get; set; }
[Column("timezone", TypeName = "jsonb"), Comment("Смещение часового пояса от UTC")] [Column("timezone", TypeName = "jsonb"), Comment("Смещение часового пояса от UTC")]
public SimpleTimezone Timezone { get; set; } public SimpleTimezone Timezone { get; set; } = null!;
[ForeignKey(nameof(IdWellType))] [ForeignKey(nameof(IdWellType))]
[InverseProperty(nameof(Model.WellType.Wells))] [InverseProperty(nameof(Model.WellType.Wells))]
public virtual WellType WellType { get; set; } public virtual WellType WellType { get; set; } = null!;
[InverseProperty(nameof(RelationCompanyWell.Well))] [InverseProperty(nameof(RelationCompanyWell.Well))]
public virtual ICollection<RelationCompanyWell> RelationCompaniesWells { get; set; } public virtual ICollection<RelationCompanyWell> RelationCompaniesWells { get; set; } = null!;
[ForeignKey(nameof(IdCluster))] [ForeignKey(nameof(IdCluster))]
[InverseProperty(nameof(Model.Cluster.Wells))] [InverseProperty(nameof(Model.Cluster.Wells))]
public virtual Cluster Cluster { get; set; } public virtual Cluster Cluster { get; set; } = null!;
[ForeignKey(nameof(IdTelemetry))] [ForeignKey(nameof(IdTelemetry))]
[InverseProperty(nameof(Model.Telemetry.Well))] [InverseProperty(nameof(Model.Telemetry.Well))]
public virtual Telemetry Telemetry { get; set; } public virtual Telemetry? Telemetry { get; set; }
[JsonIgnore] [JsonIgnore]
[InverseProperty(nameof(WellOperation.Well))] [InverseProperty(nameof(WellOperation.Well))]
public virtual ICollection<WellOperation> WellOperations { get; set; } public virtual ICollection<WellOperation> WellOperations { get; set; } = null!;
[InverseProperty(nameof(WellComposite.Well))] [InverseProperty(nameof(WellComposite.Well))]
public virtual ICollection<WellComposite> WellComposites { get; set; } public virtual ICollection<WellComposite> WellComposites { get; set; } = null!;
[InverseProperty(nameof(WellComposite.WellSrc))] [InverseProperty(nameof(WellComposite.WellSrc))]
public virtual ICollection<WellComposite> WellCompositeSrcs { get; set; } public virtual ICollection<WellComposite> WellCompositeSrcs { get; set; } = null!;
[InverseProperty(nameof(DrillingProgramPart.Well))] [InverseProperty(nameof(DrillingProgramPart.Well))]
public virtual ICollection<DrillingProgramPart> DrillingProgramParts { get; set; } public virtual ICollection<DrillingProgramPart> DrillingProgramParts { get; set; } = null!;
[InverseProperty(nameof(ProcessMap.Well))] [InverseProperty(nameof(ProcessMap.Well))]
public virtual ICollection<ProcessMap> ProcessMaps { get; set; } public virtual ICollection<ProcessMap> ProcessMaps { get; set; } = null!;
} }
} }

View File

@ -6,7 +6,6 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
#nullable disable
[Table("t_well_operation"), Comment("Данные по операциям на скважине")] [Table("t_well_operation"), Comment("Данные по операциям на скважине")]
public class WellOperation : IId public class WellOperation : IId
{ {
@ -48,26 +47,26 @@ namespace AsbCloudDb.Model
public double DurationHours { get; set; } public double DurationHours { get; set; }
[Column("category_info"), Comment("Доп. информация к выбраной категории")] [Column("category_info"), Comment("Доп. информация к выбраной категории")]
public string CategoryInfo { get; set; } public string? CategoryInfo { get; set; }
[Column("comment"), Comment("Комментарий")] [Column("comment"), Comment("Комментарий")]
public string Comment { get; set; } public string? Comment { get; set; }
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdWell))] [ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; } public virtual Well Well { get; set; } = null!;
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdWellSectionType))] [ForeignKey(nameof(IdWellSectionType))]
public virtual WellSectionType WellSectionType { get; set; } public virtual WellSectionType WellSectionType { get; set; } = null!;
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdCategory))] [ForeignKey(nameof(IdCategory))]
public virtual WellOperationCategory OperationCategory { get; set; } public virtual WellOperationCategory OperationCategory { get; set; } = null!;
[JsonIgnore] [JsonIgnore]
[ForeignKey(nameof(IdPlan))] [ForeignKey(nameof(IdPlan))]
public virtual WellOperation OperationPlan { get; set; } public virtual WellOperation OperationPlan { get; set; } = null!;
} }
} }

View File

@ -5,7 +5,6 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model namespace AsbCloudDb.Model
{ {
#nullable enable
[Table("t_well_operation_category"), Comment("Справочник операций на скважине")] [Table("t_well_operation_category"), Comment("Справочник операций на скважине")]
public class WellOperationCategory : IId public class WellOperationCategory : IId
{ {
@ -143,5 +142,4 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdParent))] [ForeignKey(nameof(IdParent))]
public virtual WellOperationCategory? Parent { get; set; } = null!; public virtual WellOperationCategory? Parent { get; set; } = null!;
} }
#nullable disable
} }

View File

@ -253,9 +253,9 @@ namespace AsbCloudInfrastructure.Services
dto.Timezone = GetTimezone(entity.Id); dto.Timezone = GetTimezone(entity.Id);
dto.StartDate = wellOperationRepository.FirstOperationDate(entity.Id)?.ToRemoteDateTime(dto.Timezone.Hours); dto.StartDate = wellOperationRepository.FirstOperationDate(entity.Id)?.ToRemoteDateTime(dto.Timezone.Hours);
dto.WellType = entity.WellType?.Caption; dto.WellType = entity.WellType.Caption;
dto.Cluster = entity.Cluster?.Caption; dto.Cluster = entity.Cluster.Caption;
dto.Deposit = entity.Cluster?.Deposit?.Caption; dto.Deposit = entity.Cluster.Deposit.Caption;
if (entity.IdTelemetry is not null) if (entity.IdTelemetry is not null)
dto.LastTelemetryDate = telemetryService.GetLastTelemetryDate((int)entity.IdTelemetry); dto.LastTelemetryDate = telemetryService.GetLastTelemetryDate((int)entity.IdTelemetry);
dto.Companies = entity.RelationCompaniesWells dto.Companies = entity.RelationCompaniesWells
@ -347,9 +347,6 @@ namespace AsbCloudInfrastructure.Services
if (well.Latitude is not null & well.Longitude is not null) if (well.Latitude is not null & well.Longitude is not null)
return well; return well;
if (well.IdCluster is null)
throw new Exception($"Can't find coordinates of well {well.Caption} id: {well.Id}");
var cluster = well.Cluster; var cluster = well.Cluster;
if (cluster.Latitude is not null & cluster.Longitude is not null) if (cluster.Latitude is not null & cluster.Longitude is not null)

View File

@ -8,6 +8,7 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1 namespace ConsoleApp1
{ {
@ -27,12 +28,12 @@ namespace ConsoleApp1
public IEnumerable<IConfigurationSection> GetChildren() public IEnumerable<IConfigurationSection> GetChildren()
{ {
return null; return Enumerable.Empty<IConfigurationSection>();
} }
public IChangeToken GetReloadToken() public IChangeToken? GetReloadToken()
{ {
return null; return default;
} }
public IConfigurationSection GetSection(string key) => this; public IConfigurationSection GetSection(string key) => this;