From f94db74d6a69ac879f3479ae4aced6921e5ac475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 10 Aug 2023 10:32:35 +0500 Subject: [PATCH 01/25] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D1=81=D0=BB=D0=BE=D0=B5=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Добавил модели для инструкций 2. Добавил инициализацию новых прав 3. Добавил новые миграции --- .../20230810052950_Add_Manuals.Designer.cs | 8548 +++++++++++++++++ .../Migrations/20230810052950_Add_Manuals.cs | 167 + .../AsbCloudDbContextModelSnapshot.cs | 157 + AsbCloudDb/Model/AsbCloudDbContext.cs | 16 + .../DefaultData/EntityFillerFileCategory.cs | 5 +- .../DefaultData/EntityFillerPermission.cs | 3 + AsbCloudDb/Model/FileCategory.cs | 5 + AsbCloudDb/Model/IAsbCloudDbContext.cs | 3 + AsbCloudDb/Model/Manuals/Manual.cs | 32 + AsbCloudDb/Model/Manuals/ManualFolder.cs | 33 + 10 files changed, 8968 insertions(+), 1 deletion(-) create mode 100644 AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs create mode 100644 AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs create mode 100644 AsbCloudDb/Model/Manuals/Manual.cs create mode 100644 AsbCloudDb/Model/Manuals/ManualFolder.cs diff --git a/AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs b/AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs new file mode 100644 index 00000000..578d4680 --- /dev/null +++ b/AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs @@ -0,0 +1,8548 @@ +// +using System; +using System.Text.Json; +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + [DbContext(typeof(AsbCloudDbContext))] + [Migration("20230810052950_Add_Manuals")] + partial class Add_Manuals + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Russian_Russia.1251") + .HasAnnotation("ProductVersion", "6.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdDeposit") + .HasColumnType("integer") + .HasColumnName("id_deposit"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdDeposit"); + + b.ToTable("t_cluster"); + + b.HasComment("Кусты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCompanyType") + .HasMaxLength(255) + .HasColumnType("integer") + .HasColumnName("id_company_type") + .HasComment("вид деятельности"); + + b.HasKey("Id"); + + b.HasIndex("IdCompanyType"); + + b.ToTable("t_company"); + + b.HasData( + new + { + Id = 1, + Caption = "ООО \"АСБ\"", + IdCompanyType = 3 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IsContact") + .HasColumnType("boolean"); + + b.Property("Order") + .HasColumnType("integer") + .HasColumnName("order"); + + b.HasKey("Id"); + + b.ToTable("t_company_type"); + + b.HasData( + new + { + Id = 1, + Caption = "Недрапользователь", + IsContact = false, + Order = 1 + }, + new + { + Id = 2, + Caption = "Буровой подрядчик", + IsContact = false, + Order = 2 + }, + new + { + Id = 3, + Caption = "Сервис автоматизации бурения", + IsContact = false, + Order = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("StartDate") + .HasColumnType("date") + .HasColumnName("start_date") + .HasComment("Дата отчёта"); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Список параметров для отчёта"); + + b.HasKey("IdWell", "StartDate") + .HasName("t_id_well_date_start_pk"); + + b.ToTable("t_daily_report"); + + b.HasComment("Ежедневные отчёты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.ToTable("t_deposit"); + + b.HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата начала операции"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdReasonOfEnd") + .HasColumnType("integer") + .HasColumnName("id_reason_of_end") + .HasComment("Код признака окончания операции"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUsersAtStart") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя по телеметрии на момент начала операции"); + + b.Property("Value") + .HasColumnType("double precision") + .HasColumnName("value") + .HasComment("Ключевой показатель операции"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_detected_operation"); + + b.HasComment("автоматически определенные операции по телеметрии"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Имя"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("Отчество"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("Фамилия"); + + b.HasKey("Id"); + + b.ToTable("t_driller"); + + b.HasComment("Бурильщик"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdFileCategory") + .HasColumnType("integer") + .HasColumnName("id_file_category"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("Id"); + + b.HasIndex("IdFileCategory"); + + b.HasIndex("IdWell", "IdFileCategory") + .IsUnique(); + + b.ToTable("t_drilling_program_part"); + + b.HasComment("части программ бурения"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer") + .HasColumnType("text") + .HasColumnName("answer") + .HasComment("Текст ответа"); + + b.Property("CounterQuestion") + .HasColumnType("integer") + .HasColumnName("counter_question") + .HasComment("Счетчик повторений вопроса"); + + b.Property("DateAnswer") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_answer") + .HasComment("Дата ответа"); + + b.Property("DateCreatedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created_question") + .HasComment("Дата создания вопроса"); + + b.Property("DateLastEditedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_edited_question") + .HasComment("Дата последнего редактирования вопроса"); + + b.Property("IdAuthorAnswer") + .HasColumnType("integer") + .HasColumnName("id_author_answer") + .HasComment("id автора ответа"); + + b.Property("IdAuthorQuestion") + .HasColumnType("integer") + .HasColumnName("id_author_question") + .HasComment("id автора вопроса"); + + b.Property("IdReplacementQuestion") + .HasColumnType("integer") + .HasColumnName("id_replacement_question") + .HasComment("Ключ заменяющего вопроса"); + + b.Property("IsFrequently") + .HasColumnType("boolean") + .HasColumnName("is_frequently") + .HasComment("Частый вопрос"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text") + .HasColumnName("question") + .HasComment("Текст вопроса"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("Статус вопроса"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthorAnswer"); + + b.HasIndex("IdAuthorQuestion"); + + b.ToTable("t_faq"); + + b.HasComment("вопросы пользователей"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("type") + .HasComment("0 = Инструкции"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_file_category"); + + b.HasComment("Категории файлов"); + + b.HasData( + new + { + Id = 1, + Name = "Растворный сервис", + ShortName = "fluidService" + }, + new + { + Id = 2, + Name = "Цементирование", + ShortName = "cement" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "nnb" + }, + new + { + Id = 4, + Name = "ГТИ", + ShortName = "gti" + }, + new + { + Id = 5, + Name = "Документы по скважине", + ShortName = "wellDocuments" + }, + new + { + Id = 6, + Name = "Супервайзер", + ShortName = "supervisor" + }, + new + { + Id = 7, + Name = "Мастер", + ShortName = "master" + }, + new + { + Id = 8, + Name = "Долотный сервис", + ShortName = "toolService" + }, + new + { + Id = 9, + Name = "Буровой подрядчик", + ShortName = "drillService" + }, + new + { + Id = 10, + Name = "Сервис по заканчиванию скважины", + ShortName = "closingService" + }, + new + { + Id = 12, + Name = "Рапорт", + ShortName = "report" + }, + new + { + Id = 1000, + Name = "Программа бурения" + }, + new + { + Id = 1001, + Name = "Задание от геологов" + }, + new + { + Id = 1002, + Name = "Профиль ствола скважины (ННБ)" + }, + new + { + Id = 1003, + Name = "Технологические расчеты (ННБ)" + }, + new + { + Id = 1004, + Name = "Долотная программа" + }, + new + { + Id = 1005, + Name = "Программа по растворам" + }, + new + { + Id = 1006, + Name = "Программа геофизических исследований" + }, + new + { + Id = 1007, + Name = "Планы спусков обсадных колонн" + }, + new + { + Id = 1008, + Name = "Программы цементирования обсадных колонн" + }, + new + { + Id = 10000, + Name = "Проект на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10001, + Name = "Программа на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10002, + Name = "Акт о начале бурения" + }, + new + { + Id = 10003, + Name = "План работ спуска и цементирования направления" + }, + new + { + Id = 10004, + Name = "Программа цементирования направления" + }, + new + { + Id = 10005, + Name = "Мера обсадных труб (направление)" + }, + new + { + Id = 10006, + Name = "Акт на выполненные работы по цементированию направления" + }, + new + { + Id = 10007, + Name = "Отчет по цементированию направления (график)" + }, + new + { + Id = 10008, + Name = "План работ спуска и цементирования кондуктора" + }, + new + { + Id = 10009, + Name = "Программа цементирования (кондуктор)" + }, + new + { + Id = 10010, + Name = "Мера обсадных труб (кондуктор)" + }, + new + { + Id = 10011, + Name = "Карта крепления кондуктора" + }, + new + { + Id = 10012, + Name = "Акт на выполненные работы по цементированию кондуктора" + }, + new + { + Id = 10013, + Name = "Отчет по цементированию кондуктора (график)" + }, + new + { + Id = 10014, + Name = "Акт о замере расстояния от стола ротора до муфты кондуктора" + }, + new + { + Id = 10015, + Name = "Акт опресовки цементного кольца за кондуктором" + }, + new + { + Id = 10016, + Name = "Акт опресовки ППГ с глухими плашками совместно с кондуктором" + }, + new + { + Id = 10017, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с кондуктором" + }, + new + { + Id = 10018, + Name = "План работ на крепление обсадной колонны (эк. колонна)" + }, + new + { + Id = 10019, + Name = "Программа цементирования (эк. колонна)" + }, + new + { + Id = 10020, + Name = "Мера труб эксплуатационной колонны" + }, + new + { + Id = 10021, + Name = "Карта по креплению скважины (эк. колонна)" + }, + new + { + Id = 10022, + Name = "Акт на установку пружинных центраторов" + }, + new + { + Id = 10023, + Name = "Отчет по цементированию эксплуатационной колонны (график)" + }, + new + { + Id = 10024, + Name = "Акт на выполненные работы по цементированию эксплуатационной колонны" + }, + new + { + Id = 10025, + Name = "Акт об испытании эк. колонны на герметичность (СТОП)" + }, + new + { + Id = 10026, + Name = "Акт опресовки ППГ с глухими плашками совместно с э/колонной" + }, + new + { + Id = 10027, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с э/колонной" + }, + new + { + Id = 10028, + Name = "Акт на вскрытие продуктивного пласта" + }, + new + { + Id = 10029, + Name = "Акт замера параметров раствора при бурении горизонтального участка" + }, + new + { + Id = 10030, + Name = "Разрешение на спуск «хвостовика» (телефонограмма)" + }, + new + { + Id = 10031, + Name = "План работ на спуск «хвостовика»" + }, + new + { + Id = 10032, + Name = "Акт готовности бурового и энергетического оборудования к спуску «хвостовика»" + }, + new + { + Id = 10033, + Name = "Акт шаблонировки ствола скважины перед спуском «хвостовика»" + }, + new + { + Id = 10034, + Name = "Мера обсадных труб (хвостовик)" + }, + new + { + Id = 10035, + Name = "Акт выполненных работ по спуску хвостовика с закачкой (нефти, солевого раствора" + }, + new + { + Id = 10036, + Name = "Акт о переводе скважины на тех. воду" + }, + new + { + Id = 10037, + Name = "Акт об окончании бурения" + }, + new + { + Id = 10038, + Name = "Акт на передачу скважины в освоение (КРС)" + }, + new + { + Id = 10039, + Name = "Акт на опресовку межколонного пространства с КРС" + }, + new + { + Id = 10040, + Name = "Акт на сдачу скважины в ЦДНГ" + }, + new + { + Id = 10041, + Name = "Паспорт ОУС (заполняется геологами)" + }, + new + { + Id = 10042, + Name = "Паспорт скважины (заполняется геологами)" + }, + new + { + Id = 10043, + Name = "Фактические данные бурения (вставляются в паспорт скважины)" + }, + new + { + Id = 20000, + Name = "Справки по страницам" + }, + new + { + Id = 30000, + IdType = 0, + Name = "АСУ ТП" + }, + new + { + Id = 30001, + IdType = 0, + Name = "Технология бурения" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории файла"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Удален ли файл"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_file_info"); + + b.HasComment("Файлы всех категорий"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created") + .HasComment("Дата совершенного действия"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла"); + + b.Property("IdMarkType") + .HasColumnType("integer") + .HasColumnName("id_mark_type") + .HasComment("0 - отклонен, 1 - согласован"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("id пользователя"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Помечен ли файл как удаленный"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdUser"); + + b.ToTable("t_file_mark"); + + b.HasComment("Действия с файлами."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("real") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_float"); + + b.HasComment("таблица данных ГТИ с типом значения float"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("integer") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_int"); + + b.HasComment("таблица данных ГТИ с типом значения int"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_string"); + + b.HasComment("таблица данных ГТИ с типом значения string"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории файла"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UrlPage") + .IsRequired() + .HasColumnType("text") + .HasColumnName("url_page") + .HasComment("Url страницы"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.ToTable("t_help_page"); + + b.HasComment("Справки"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_limiting_parameter"); + + b.HasComment("Ограничения по параметрам телеметрии"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateDownload") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_download") + .HasComment("Дата загрузки файла"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Категория"); + + b.Property("IdFolder") + .HasColumnType("integer") + .HasColumnName("id_folder") + .HasComment("Id папки инструкций"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdFolder"); + + b.ToTable("t_manual"); + + b.HasComment("Инструкции"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Категория"); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("Родительская папки"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название папки"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdParent"); + + b.ToTable("t_manual_folder"); + + b.HasComment("Папка для инструкций"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("data") + .HasComment("Данные таблицы последних данных"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Пометка удаленным"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("timestamp") + .HasComment("время добавления"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_measure"); + + b.HasComment("Таблица c данными для вкладки 'Последние данные'"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_measure_category"); + + b.HasComment("Категория последних данных"); + + b.HasData( + new + { + Id = 1, + Name = "Показатели бурового раствора", + ShortName = "Раствор" + }, + new + { + Id = 2, + Name = "Шламограмма", + ShortName = "Шламограмма" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "ННБ" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdNotificationCategory") + .HasColumnType("integer") + .HasColumnName("id_notification_category") + .HasComment("Id категории уведомления"); + + b.Property("IdTransportType") + .HasColumnType("integer") + .HasColumnName("id_transport_type") + .HasComment("Id типа доставки уведомления"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id получателя"); + + b.Property("Message") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message") + .HasComment("Сообщение уведомления"); + + b.Property("ReadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("read_date") + .HasComment("Дата прочтения уведомления"); + + b.Property("SentDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("sent_date") + .HasComment("Дата отправки уведомления"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasColumnName("title") + .HasComment("Заголовок уведомления"); + + b.HasKey("Id"); + + b.HasIndex("IdNotificationCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_notification"); + + b.HasComment("Уведомления"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_notification_category"); + + b.HasComment("Категории уведомлений"); + + b.HasData( + new + { + Id = 1, + Name = "Системные уведомления" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Конечная глубина"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Старотовая глубина"); + + b.Property("IdOperationCategory") + .HasColumnType("integer") + .HasColumnName("id_operation_category") + .HasComment("Ид категории операции"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Ид скважины"); + + b.Property("StandardValue") + .HasColumnType("double precision") + .HasColumnName("standard_value") + .HasComment("Нормативный показатель"); + + b.Property("TargetValue") + .HasColumnType("double precision") + .HasColumnName("target_value") + .HasComment("Целевой показатель"); + + b.HasKey("Id"); + + b.HasIndex("IdOperationCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_operationvalue"); + + b.HasComment("Целевые/нормативные показатели операции"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description") + .HasComment("Краткое описание"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_permission"); + + b.HasComment("Разрешения на доступ к данным"); + + b.HasData( + new + { + Id = 100, + Description = "Разрешение удалять админ. Кусты", + Name = "AdminCluster.delete" + }, + new + { + Id = 101, + Description = "Разрешение редактировать админ. Кусты", + Name = "AdminCluster.edit" + }, + new + { + Id = 102, + Description = "Разрешение просматривать админ. Кусты", + Name = "AdminCluster.get" + }, + new + { + Id = 103, + Description = "Разрешение удалять админ. Компании", + Name = "AdminCompany.delete" + }, + new + { + Id = 104, + Description = "Разрешение редактировать админ. Компании", + Name = "AdminCompany.edit" + }, + new + { + Id = 105, + Description = "Разрешение просматривать админ. Компании", + Name = "AdminCompany.get" + }, + new + { + Id = 106, + Description = "Разрешение удалять админ. Типы компаний", + Name = "AdminCompanyType.delete" + }, + new + { + Id = 107, + Description = "Разрешение редактировать админ. Типы компаний", + Name = "AdminCompanyType.edit" + }, + new + { + Id = 108, + Description = "Разрешение просматривать админ. Типы компаний", + Name = "AdminCompanyType.get" + }, + new + { + Id = 109, + Description = "Разрешение удалять админ. Месторождения", + Name = "AdminDeposit.delete" + }, + new + { + Id = 110, + Description = "Разрешение редактировать админ. Месторождения", + Name = "AdminDeposit.edit" + }, + new + { + Id = 111, + Description = "Разрешение просматривать админ. Месторождения", + Name = "AdminDeposit.get" + }, + new + { + Id = 112, + Description = "Разрешение удалять админ. Разрешения", + Name = "AdminPermission.delete" + }, + new + { + Id = 113, + Description = "Разрешение редактировать админ. Разрешения", + Name = "AdminPermission.edit" + }, + new + { + Id = 114, + Description = "Разрешение просматривать админ. Разрешения", + Name = "AdminPermission.get" + }, + new + { + Id = 115, + Description = "Разрешение удалять админ. Телеметрию", + Name = "AdminTelemetry.delete" + }, + new + { + Id = 116, + Description = "Разрешение редактировать админ. Телеметрию", + Name = "AdminTelemetry.edit" + }, + new + { + Id = 117, + Description = "Разрешение просматривать админ. Телеметрию", + Name = "AdminTelemetry.get" + }, + new + { + Id = 118, + Description = "Разрешение удалять админ. Пользователей", + Name = "AdminUser.delete" + }, + new + { + Id = 119, + Description = "Разрешение редактировать админ. Пользователей", + Name = "AdminUser.edit" + }, + new + { + Id = 120, + Description = "Разрешение просматривать админ. Пользователей", + Name = "AdminUser.get" + }, + new + { + Id = 121, + Description = "Разрешение удалять админ. Роли пользователей", + Name = "AdminUserRole.delete" + }, + new + { + Id = 122, + Description = "Разрешение редактировать админ. Роли пользователей", + Name = "AdminUserRole.edit" + }, + new + { + Id = 123, + Description = "Разрешение просматривать админ. Роли пользователей", + Name = "AdminUserRole.get" + }, + new + { + Id = 124, + Description = "Разрешение удалять админ. Скважины", + Name = "AdminWell.delete" + }, + new + { + Id = 125, + Description = "Разрешение редактировать админ. Скважины", + Name = "AdminWell.edit" + }, + new + { + Id = 126, + Description = "Разрешение просматривать админ. Скважины", + Name = "AdminWell.get" + }, + new + { + Id = 127, + Description = "Разрешение удалять админ. Подсистемы", + Name = "AdminSubsytem.delete" + }, + new + { + Id = 128, + Description = "Разрешение редактировать админ. Подсистемы", + Name = "AdminSubsytem.edit" + }, + new + { + Id = 129, + Description = "Разрешение просматривать админ. Подсистемы", + Name = "AdminSubsytem.get" + }, + new + { + Id = 200, + Description = "Разрешение редактировать 0", + Name = "Auth.edit" + }, + new + { + Id = 201, + Description = "Разрешение просматривать 0", + Name = "Auth.get" + }, + new + { + Id = 202, + Description = "Разрешение просматривать Кусты", + Name = "Cluster.get" + }, + new + { + Id = 203, + Description = "Разрешение просматривать Месторождения", + Name = "Deposit.get" + }, + new + { + Id = 204, + Description = "Разрешение удалять РТК", + Name = "DrillFlowChart.delete" + }, + new + { + Id = 205, + Description = "Разрешение редактировать РТК", + Name = "DrillFlowChart.edit" + }, + new + { + Id = 206, + Description = "Разрешение просматривать РТК", + Name = "DrillFlowChart.get" + }, + new + { + Id = 207, + Description = "Разрешение удалять Программу бурения", + Name = "DrillingProgram.delete" + }, + new + { + Id = 208, + Description = "Разрешение редактировать Программу бурения", + Name = "DrillingProgram.edit" + }, + new + { + Id = 209, + Description = "Разрешение просматривать Программу бурения", + Name = "DrillingProgram.get" + }, + new + { + Id = 210, + Description = "Разрешение удалять Режимы бурения", + Name = "DrillParams.delete" + }, + new + { + Id = 211, + Description = "Разрешение редактировать Режимы бурения", + Name = "DrillParams.edit" + }, + new + { + Id = 212, + Description = "Разрешение просматривать Режимы бурения", + Name = "DrillParams.get" + }, + new + { + Id = 213, + Description = "Разрешение удалять Файлы", + Name = "File.delete" + }, + new + { + Id = 214, + Description = "Разрешение редактировать Файлы", + Name = "File.edit" + }, + new + { + Id = 215, + Description = "Разрешение просматривать Файлы", + Name = "File.get" + }, + new + { + Id = 216, + Description = "Разрешение удалять Измерения", + Name = "Measure.delete" + }, + new + { + Id = 217, + Description = "Разрешение редактировать Измерения", + Name = "Measure.edit" + }, + new + { + Id = 218, + Description = "Разрешение просматривать Измерения", + Name = "Measure.get" + }, + new + { + Id = 219, + Description = "Разрешение просматривать Сообщения телеметрии", + Name = "Message.get" + }, + new + { + Id = 220, + Description = "Разрешение просматривать Статистику по операциям", + Name = "OperationStat.get" + }, + new + { + Id = 221, + Description = "Разрешение редактировать Рапорта", + Name = "Report.edit" + }, + new + { + Id = 222, + Description = "Разрешение просматривать Рапорта", + Name = "Report.get" + }, + new + { + Id = 223, + Description = "Разрешение просматривать админ. Системная статистика", + Name = "RequestTracker.get" + }, + new + { + Id = 224, + Description = "Разрешение удалять Рекомендации уставок", + Name = "Setpoints.delete" + }, + new + { + Id = 225, + Description = "Разрешение редактировать Рекомендации уставок", + Name = "Setpoints.edit" + }, + new + { + Id = 226, + Description = "Разрешение просматривать Рекомендации уставок", + Name = "Setpoints.get" + }, + new + { + Id = 227, + Description = "Разрешение редактировать Телеметрии", + Name = "Telemetry.edit" + }, + new + { + Id = 228, + Description = "Разрешение просматривать Анализ телеметрии", + Name = "TelemetryAnalytics.get" + }, + new + { + Id = 229, + Description = "Разрешение редактировать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.edit" + }, + new + { + Id = 230, + Description = "Разрешение просматривать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.get" + }, + new + { + Id = 231, + Description = "Разрешение редактировать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.edit" + }, + new + { + Id = 232, + Description = "Разрешение просматривать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.get" + }, + new + { + Id = 233, + Description = "Разрешение редактировать Скважины", + Name = "Well.edit" + }, + new + { + Id = 234, + Description = "Разрешение просматривать Скважины", + Name = "Well.get" + }, + new + { + Id = 235, + Description = "Разрешение редактировать Композитные скважины", + Name = "WellComposite.edit" + }, + new + { + Id = 236, + Description = "Разрешение просматривать Композитные скважины", + Name = "WellComposite.get" + }, + new + { + Id = 237, + Description = "Разрешение удалять Операции по скважинам", + Name = "WellOperation.delete" + }, + new + { + Id = 238, + Description = "Разрешение редактировать Операции по скважинам", + Name = "WellOperation.edit" + }, + new + { + Id = 239, + Description = "Разрешение просматривать Операции по скважинам", + Name = "WellOperation.get" + }, + new + { + Id = 240, + Description = "Разрешение редактировать Файлы категории 1 (Растворный сервис)", + Name = "File.edit1" + }, + new + { + Id = 241, + Description = "Разрешение редактировать Файлы категории 2 (Цементирование)", + Name = "File.edit2" + }, + new + { + Id = 242, + Description = "Разрешение редактировать Файлы категории 3 (ННБ)", + Name = "File.edit3" + }, + new + { + Id = 243, + Description = "Разрешение редактировать Файлы категории 4 (ГТИ)", + Name = "File.edit4" + }, + new + { + Id = 244, + Description = "Разрешение редактировать Файлы категории 5 (Документы по скважине)", + Name = "File.edit5" + }, + new + { + Id = 245, + Description = "Разрешение редактировать Файлы категории 6 (Супервайзер)", + Name = "File.edit6" + }, + new + { + Id = 246, + Description = "Разрешение редактировать Файлы категории 7 (Мастер)", + Name = "File.edit7" + }, + new + { + Id = 247, + Description = "Разрешение редактировать Файлы категории 8 (Долотный сервис)", + Name = "File.edit8" + }, + new + { + Id = 248, + Description = "Разрешение редактировать Файлы категории 9 (Буровой подрядчик)", + Name = "File.edit9" + }, + new + { + Id = 249, + Description = "Разрешение редактировать Файлы категории 10 (Сервис по заканчиванию скважины)", + Name = "File.edit10" + }, + new + { + Id = 250, + Description = "Разрешение редактировать Файлы категории 11 (Рапорт)", + Name = "File.edit11" + }, + new + { + Id = 251, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit12" + }, + new + { + Id = 252, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit13" + }, + new + { + Id = 253, + Description = "Разрешение редактировать Файлы категории 13", + Name = "File.edit14" + }, + new + { + Id = 254, + Description = "Разрешение редактировать Файлы категории 14", + Name = "File.edit15" + }, + new + { + Id = 255, + Description = "Разрешение редактировать Файлы категории 15", + Name = "File.edit16" + }, + new + { + Id = 256, + Description = "Разрешение редактировать Файлы категории 16", + Name = "File.edit17" + }, + new + { + Id = 257, + Description = "Разрешение редактировать Файлы категории 17", + Name = "File.edit18" + }, + new + { + Id = 258, + Description = "Разрешение редактировать Файлы категории 18", + Name = "File.edit19" + }, + new + { + Id = 259, + Description = "Разрешение редактировать Файлы категории 19", + Name = "File.edit20" + }, + new + { + Id = 260, + Description = "Разрешение редактировать Файлы категории 20", + Name = "File.edit21" + }, + new + { + Id = 261, + Description = "Разрешение редактировать Файлы категории 21", + Name = "File.edit22" + }, + new + { + Id = 262, + Description = "Разрешение редактировать Файлы категории 22", + Name = "File.edit23" + }, + new + { + Id = 263, + Description = "Разрешение редактировать Файлы категории 23", + Name = "File.edit24" + }, + new + { + Id = 264, + Description = "Разрешение редактировать Файлы категории 24", + Name = "File.edit25" + }, + new + { + Id = 265, + Description = "Разрешение редактировать Файлы категории 25", + Name = "File.edit26" + }, + new + { + Id = 266, + Description = "Разрешение редактировать Файлы категории 26", + Name = "File.edit27" + }, + new + { + Id = 267, + Description = "Разрешение редактировать Файлы категории 27", + Name = "File.edit28" + }, + new + { + Id = 268, + Description = "Разрешение редактировать Файлы категории 28", + Name = "File.edit29" + }, + new + { + Id = 269, + Description = "Разрешение редактировать Файлы категории 29", + Name = "File.edit30" + }, + new + { + Id = 380, + Description = "Разрешение просматривать список бурильщиков", + Name = "Driller.get" + }, + new + { + Id = 381, + Description = "Разрешение редактировать бурильщика", + Name = "Driller.edit" + }, + new + { + Id = 382, + Description = "Разрешение удалять бурильщик", + Name = "Driller.delete" + }, + new + { + Id = 383, + Description = "Разрешение просматривать графики бурильщиков", + Name = "Schedule.get" + }, + new + { + Id = 384, + Description = "Разрешение редактировать график бурильщика", + Name = "Schedule.edit" + }, + new + { + Id = 385, + Description = "Разрешение удалять график бурильщика", + Name = "Schedule.delete" + }, + new + { + Id = 386, + Description = "Разрешение просматривать суточный рапорт", + Name = "DailyReport.get" + }, + new + { + Id = 387, + Description = "Разрешение редактировать суточный рапорт", + Name = "DailyReport.edit" + }, + new + { + Id = 388, + Description = "Разрешение просматривать авто. определенные операции", + Name = "DetectedOperation.get" + }, + new + { + Id = 389, + Description = "Разрешение просматривать целевые значения", + Name = "OperationValue.get" + }, + new + { + Id = 390, + Description = "Разрешение редактировать целевые значения", + Name = "OperationValue.edit" + }, + new + { + Id = 391, + Description = "Разрешение удалять целевые значения", + Name = "OperationValue.delete" + }, + new + { + Id = 400, + Description = "Разрешение просматривать инфо по wits параметрам", + Name = "WitsInfo.get" + }, + new + { + Id = 401, + Description = "Разрешение просматривать WITS record 1", + Name = "WitsRecord1.get" + }, + new + { + Id = 407, + Description = "Разрешение просматривать WITS record 7", + Name = "WitsRecord7.get" + }, + new + { + Id = 408, + Description = "Разрешение просматривать WITS record 8", + Name = "WitsRecord8.get" + }, + new + { + Id = 450, + Description = "Разрешение просматривать WITS record 50", + Name = "WitsRecord50.get" + }, + new + { + Id = 460, + Description = "Разрешение просматривать WITS record 60", + Name = "WitsRecord60.get" + }, + new + { + Id = 461, + Description = "Разрешение просматривать WITS record 61", + Name = "WitsRecord61.get" + }, + new + { + Id = 500, + Description = "Разрешение удалять Категорий документов файлов", + Name = "FileCategory.delete" + }, + new + { + Id = 501, + Description = "Разрешение редактировать Категорий документов файлов", + Name = "FileCategory.edit" + }, + new + { + Id = 502, + Description = "Разрешение просматривать Категорий документов файлов", + Name = "FileCategory.get" + }, + new + { + Id = 503, + Description = "Разрешение удалять Дело скважины", + Name = "WellFinalDocuments.delete" + }, + new + { + Id = 504, + Description = "Разрешение редактировать Дело скважины", + Name = "WellFinalDocuments.edit" + }, + new + { + Id = 505, + Description = "Разрешение просматривать Дело скважины", + Name = "WellFinalDocuments.get" + }, + new + { + Id = 506, + Description = "Разрешение редактировать ответственных за загрузку файла Дело скважины", + Name = "WellFinalDocuments.editPublisher" + }, + new + { + Id = 507, + Description = "Разрешение просматривать наработка талевого каната", + Name = "TelemetryWirelineRunOut.get" + }, + new + { + Id = 510, + Description = "Разрешение просматривать плановая траектория", + Name = "PlannedTrajectory.get" + }, + new + { + Id = 511, + Description = "Разрешение редактировать плановая траектория", + Name = "PlannedTrajectory.edit" + }, + new + { + Id = 512, + Description = "Разрешение удалять плановая траектория", + 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 = "Разрешение просматривать статистику вопросов", + Name = "FaqStatistics.get" + }, + new + { + Id = 517, + Description = "Разрешение редактировать вопрос", + Name = "FaqStatistics.edit" + }, + new + { + Id = 518, + Description = "Разрешение удалять вопрос", + Name = "FaqStatistics.delete" + }, + new + { + Id = 519, + Description = "Разрешение просматривать список контактов", + Name = "WellContact.get" + }, + new + { + Id = 520, + Description = "Разрешение редактировать список контактов", + Name = "WellContact.edit" + }, + new + { + Id = 521, + Description = "Разрешить создание справок по страницам", + Name = "HelpPage.edit" + }, + new + { + Id = 522, + Description = "Разрешить удаление всех настроек пользователя", + Name = "UserSettings.delete" + }, + new + { + Id = 523, + Description = "Разрешить редактирование инструкций", + Name = "Manual.edit" + }, + new + { + Id = 524, + Description = "Разрешить просмотр инструкций", + Name = "Manual.view" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AbsoluteMark") + .HasColumnType("double precision") + .HasColumnName("absolute_mark") + .HasComment("Абсолютная отметка"); + + b.Property("AngleIntensity") + .HasColumnType("double precision") + .HasColumnName("angle_intensity") + .HasComment("Интенсивность по углу"); + + b.Property("AzimuthGeo") + .HasColumnType("double precision") + .HasColumnName("azimuth_geo") + .HasComment("Азимут Географ."); + + b.Property("AzimuthIntensity") + .HasColumnType("double precision") + .HasColumnName("azimuth_intensity") + .HasComment("Интенсивность по азимуту"); + + b.Property("AzimuthMagnetic") + .HasColumnType("double precision") + .HasColumnName("azimuth_magnetic") + .HasComment("Азимут Магнитный"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарии"); + + b.Property("EastCartographic") + .HasColumnType("double precision") + .HasColumnName("east_cartographic") + .HasComment("Восток картографический"); + + b.Property("EastOrifice") + .HasColumnType("double precision") + .HasColumnName("east_orifice") + .HasComment("Восток отн-но устья"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("ID пользователя который внес/изменил запись"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("NorthCartographic") + .HasColumnType("double precision") + .HasColumnName("north_cartographic") + .HasComment("Север картографический"); + + b.Property("NorthOrifice") + .HasColumnType("double precision") + .HasColumnName("north_orifice") + .HasComment("Север отн-но устья"); + + b.Property("OrificeOffset") + .HasColumnType("double precision") + .HasColumnName("orifice_offset") + .HasComment("Смещение от устья"); + + b.Property("Radius") + .HasColumnType("double precision") + .HasColumnName("radius") + .HasComment("Радиус цели"); + + b.Property("SpatialIntensity") + .HasColumnType("double precision") + .HasColumnName("spatial_intensity") + .HasComment("Пространственная интенсивность"); + + b.Property("UpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("update_date") + .HasComment("Дата загрузки траектории"); + + b.Property("VerticalDepth") + .HasColumnType("double precision") + .HasColumnName("vertical_depth") + .HasComment("Глубина вертикальная"); + + b.Property("WellboreDepth") + .HasColumnType("double precision") + .HasColumnName("wellbore_depth") + .HasComment("Глубина по стволу"); + + b.Property("ZenithAngle") + .HasColumnType("double precision") + .HasColumnName("zenith_angle") + .HasComment("Угол зенитный"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.ToTable("t_planned_trajectory"); + + b.HasComment("Загрузка плановой траектории"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Нагрузка, допустимый максимум"); + + b.Property("AxialLoadPlan") + .HasColumnType("double precision") + .HasColumnName("axial_load_plan") + .HasComment("Нагрузка, план"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина окончания интервала"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Стартовая глубина"); + + b.Property("FlowLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_limit_max") + .HasComment("Расход, допустимый максимум"); + + b.Property("FlowPlan") + .HasColumnType("double precision") + .HasColumnName("flow_plan") + .HasComment("Расход, план"); + + b.Property("IdMode") + .HasColumnType("integer") + .HasColumnName("id_mode") + .HasComment("Id режима (1- ротор, 2 слайд)"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("well_id") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("PressureLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_limit_max") + .HasComment("Перепад давления, допустимый максимум"); + + b.Property("PressurePlan") + .HasColumnType("double precision") + .HasColumnName("pressure_plan") + .HasComment("Перепад давления, план"); + + b.Property("RopPlan") + .HasColumnType("double precision") + .HasColumnName("rop_plan") + .HasComment("Плановая механическая скорость, м/ч"); + + b.Property("TopDriveSpeedLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_limit_max") + .HasComment("Обороты на ВСП, допустимый максимум"); + + b.Property("TopDriveSpeedPlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_plan") + .HasComment("Обороты на ВСП, план"); + + b.Property("TopDriveTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_limit_max") + .HasComment("Момент на ВСП, допустимый максимум"); + + b.Property("TopDriveTorquePlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_plan") + .HasComment("Момент на ВСП, план"); + + b.Property("UsageSaub") + .HasColumnType("double precision") + .HasColumnName("usage_saub") + .HasComment("Плановый процент использования АКБ"); + + b.Property("UsageSpin") + .HasColumnType("double precision") + .HasColumnName("usage_spin") + .HasComment("Плановый процент использования spin master"); + + b.HasKey("Id"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map"); + + b.HasComment("Операции по скважине – РТК"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => + { + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("IdCompany", "IdWell"); + + b.HasIndex("IdWell"); + + b.ToTable("t_relation_company_well"); + + b.HasComment("отношение скважин и компаний"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.HasKey("IdWell", "IdUser"); + + b.HasIndex("IdUser"); + + b.ToTable("t_relation_contact_well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdDrillingProgramPart") + .HasColumnType("integer") + .HasColumnName("id_drilling_program_part"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_role") + .HasComment("1 - publisher, 2 - approver"); + + b.HasKey("IdUser", "IdDrillingProgramPart") + .HasName("t_relation_user_drilling_program_part_pk"); + + b.HasIndex("IdDrillingProgramPart"); + + b.ToTable("t_relation_user_drilling_program_part"); + + b.HasComment("Отношение пользователей и частей ПБ"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdPermission") + .HasColumnType("integer") + .HasColumnName("id_permission"); + + b.HasKey("IdUserRole", "IdPermission"); + + b.HasIndex("IdPermission"); + + b.ToTable("t_relation_user_role_permission"); + + b.HasComment("Отношение ролей пользователей и разрешений доступа"); + + b.HasData( + new + { + IdUserRole = 1100, + IdPermission = 102 + }, + new + { + IdUserRole = 1100, + IdPermission = 111 + }, + new + { + IdUserRole = 1101, + IdPermission = 101 + }, + new + { + IdUserRole = 1101, + IdPermission = 100 + }, + new + { + IdUserRole = 1102, + IdPermission = 105 + }, + new + { + IdUserRole = 1102, + IdPermission = 108 + }, + new + { + IdUserRole = 1103, + IdPermission = 104 + }, + new + { + IdUserRole = 1103, + IdPermission = 103 + }, + new + { + IdUserRole = 1104, + IdPermission = 108 + }, + new + { + IdUserRole = 1105, + IdPermission = 107 + }, + new + { + IdUserRole = 1105, + IdPermission = 106 + }, + new + { + IdUserRole = 1106, + IdPermission = 111 + }, + new + { + IdUserRole = 1107, + IdPermission = 110 + }, + new + { + IdUserRole = 1107, + IdPermission = 109 + }, + new + { + IdUserRole = 1108, + IdPermission = 114 + }, + new + { + IdUserRole = 1109, + IdPermission = 113 + }, + new + { + IdUserRole = 1109, + IdPermission = 112 + }, + new + { + IdUserRole = 1110, + IdPermission = 123 + }, + new + { + IdUserRole = 1110, + IdPermission = 114 + }, + new + { + IdUserRole = 1111, + IdPermission = 122 + }, + new + { + IdUserRole = 1111, + IdPermission = 121 + }, + new + { + IdUserRole = 1112, + IdPermission = 117 + }, + new + { + IdUserRole = 1113, + IdPermission = 105 + }, + new + { + IdUserRole = 1113, + IdPermission = 123 + }, + new + { + IdUserRole = 1113, + IdPermission = 120 + }, + new + { + IdUserRole = 1114, + IdPermission = 119 + }, + new + { + IdUserRole = 1114, + IdPermission = 118 + }, + new + { + IdUserRole = 1114, + IdPermission = 200 + }, + new + { + IdUserRole = 1115, + IdPermission = 223 + }, + new + { + IdUserRole = 1116, + IdPermission = 105 + }, + new + { + IdUserRole = 1116, + IdPermission = 102 + }, + new + { + IdUserRole = 1116, + IdPermission = 117 + }, + new + { + IdUserRole = 1116, + IdPermission = 126 + }, + new + { + IdUserRole = 1117, + IdPermission = 125 + }, + new + { + IdUserRole = 1117, + IdPermission = 124 + }, + new + { + IdUserRole = 1200, + IdPermission = 203 + }, + new + { + IdUserRole = 1200, + IdPermission = 230 + }, + new + { + IdUserRole = 1201, + IdPermission = 202 + }, + new + { + IdUserRole = 1201, + IdPermission = 203 + }, + new + { + IdUserRole = 1201, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 203 + }, + new + { + IdUserRole = 1202, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 236 + }, + new + { + IdUserRole = 1202, + IdPermission = 212 + }, + new + { + IdUserRole = 1203, + IdPermission = 235 + }, + new + { + IdUserRole = 1204, + IdPermission = 202 + }, + new + { + IdUserRole = 1204, + IdPermission = 203 + }, + new + { + IdUserRole = 1205, + IdPermission = 215 + }, + new + { + IdUserRole = 1206, + IdPermission = 203 + }, + new + { + IdUserRole = 1206, + IdPermission = 206 + }, + new + { + IdUserRole = 1207, + IdPermission = 205 + }, + new + { + IdUserRole = 1208, + IdPermission = 218 + }, + new + { + IdUserRole = 1209, + IdPermission = 217 + }, + new + { + IdUserRole = 1210, + IdPermission = 203 + }, + new + { + IdUserRole = 1210, + IdPermission = 230 + }, + new + { + IdUserRole = 1210, + IdPermission = 219 + }, + new + { + IdUserRole = 1211, + IdPermission = 203 + }, + new + { + IdUserRole = 1211, + IdPermission = 220 + }, + new + { + IdUserRole = 1211, + IdPermission = 239 + }, + new + { + IdUserRole = 1212, + IdPermission = 238 + }, + new + { + IdUserRole = 1212, + IdPermission = 237 + }, + new + { + IdUserRole = 1213, + IdPermission = 203 + }, + new + { + IdUserRole = 1213, + IdPermission = 239 + }, + new + { + IdUserRole = 1213, + IdPermission = 212 + }, + new + { + IdUserRole = 1214, + IdPermission = 211 + }, + new + { + IdUserRole = 1214, + IdPermission = 210 + }, + new + { + IdUserRole = 1215, + IdPermission = 203 + }, + new + { + IdUserRole = 1215, + IdPermission = 222 + }, + new + { + IdUserRole = 1216, + IdPermission = 221 + }, + new + { + IdUserRole = 1217, + IdPermission = 226 + }, + new + { + IdUserRole = 1218, + IdPermission = 225 + }, + new + { + IdUserRole = 1218, + IdPermission = 224 + }, + new + { + IdUserRole = 1219, + IdPermission = 203 + }, + new + { + IdUserRole = 1219, + IdPermission = 206 + }, + new + { + IdUserRole = 1219, + IdPermission = 230 + }, + new + { + IdUserRole = 1219, + IdPermission = 232 + }, + new + { + IdUserRole = 1220, + IdPermission = 203 + }, + new + { + IdUserRole = 1220, + IdPermission = 228 + }, + new + { + IdUserRole = 1221, + IdPermission = 202 + }, + new + { + IdUserRole = 1221, + IdPermission = 203 + }, + new + { + IdUserRole = 1221, + IdPermission = 220 + }, + new + { + IdUserRole = 1221, + IdPermission = 234 + }, + new + { + IdUserRole = 1500, + IdPermission = 507 + }, + new + { + IdUserRole = 1500, + IdPermission = 510 + }, + new + { + IdUserRole = 1501, + IdPermission = 214 + }, + new + { + IdUserRole = 1501, + IdPermission = 213 + }, + new + { + IdUserRole = 1502, + IdPermission = 207 + }, + new + { + IdUserRole = 1502, + IdPermission = 208 + }, + new + { + IdUserRole = 2000, + IdPermission = 205 + }, + new + { + IdUserRole = 2000, + IdPermission = 204 + }, + new + { + IdUserRole = 2000, + IdPermission = 245 + }, + new + { + IdUserRole = 2001, + IdPermission = 244 + }, + new + { + IdUserRole = 2001, + IdPermission = 245 + }, + new + { + IdUserRole = 2002, + IdPermission = 244 + }, + new + { + IdUserRole = 2002, + IdPermission = 246 + }, + new + { + IdUserRole = 2002, + IdPermission = 237 + }, + new + { + IdUserRole = 2002, + IdPermission = 238 + }, + new + { + IdUserRole = 2003, + IdPermission = 240 + }, + new + { + IdUserRole = 2003, + IdPermission = 217 + }, + new + { + IdUserRole = 2003, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 242 + }, + new + { + IdUserRole = 2004, + IdPermission = 217 + }, + new + { + IdUserRole = 2004, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 205 + }, + new + { + IdUserRole = 2004, + IdPermission = 204 + }, + new + { + IdUserRole = 2005, + IdPermission = 247 + }, + new + { + IdUserRole = 2005, + IdPermission = 205 + }, + new + { + IdUserRole = 2005, + IdPermission = 204 + }, + new + { + IdUserRole = 2006, + IdPermission = 243 + }, + new + { + IdUserRole = 2006, + IdPermission = 205 + }, + new + { + IdUserRole = 2006, + IdPermission = 204 + }, + new + { + IdUserRole = 2007, + IdPermission = 241 + }, + new + { + IdUserRole = 2007, + IdPermission = 205 + }, + new + { + IdUserRole = 2007, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 100 + }, + new + { + IdUserRole = 1, + IdPermission = 101 + }, + new + { + IdUserRole = 1, + IdPermission = 102 + }, + new + { + IdUserRole = 1, + IdPermission = 103 + }, + new + { + IdUserRole = 1, + IdPermission = 104 + }, + new + { + IdUserRole = 1, + IdPermission = 105 + }, + new + { + IdUserRole = 1, + IdPermission = 106 + }, + new + { + IdUserRole = 1, + IdPermission = 107 + }, + new + { + IdUserRole = 1, + IdPermission = 108 + }, + new + { + IdUserRole = 1, + IdPermission = 109 + }, + new + { + IdUserRole = 1, + IdPermission = 110 + }, + new + { + IdUserRole = 1, + IdPermission = 111 + }, + new + { + IdUserRole = 1, + IdPermission = 112 + }, + new + { + IdUserRole = 1, + IdPermission = 113 + }, + new + { + IdUserRole = 1, + IdPermission = 114 + }, + new + { + IdUserRole = 1, + IdPermission = 115 + }, + new + { + IdUserRole = 1, + IdPermission = 116 + }, + new + { + IdUserRole = 1, + IdPermission = 117 + }, + new + { + IdUserRole = 1, + IdPermission = 118 + }, + new + { + IdUserRole = 1, + IdPermission = 119 + }, + new + { + IdUserRole = 1, + IdPermission = 120 + }, + new + { + IdUserRole = 1, + IdPermission = 121 + }, + new + { + IdUserRole = 1, + IdPermission = 122 + }, + new + { + IdUserRole = 1, + IdPermission = 123 + }, + new + { + IdUserRole = 1, + IdPermission = 124 + }, + new + { + IdUserRole = 1, + IdPermission = 125 + }, + new + { + IdUserRole = 1, + IdPermission = 126 + }, + new + { + IdUserRole = 1, + IdPermission = 127 + }, + new + { + IdUserRole = 1, + IdPermission = 128 + }, + new + { + IdUserRole = 1, + IdPermission = 129 + }, + new + { + IdUserRole = 1, + IdPermission = 200 + }, + new + { + IdUserRole = 1, + IdPermission = 201 + }, + new + { + IdUserRole = 1, + IdPermission = 202 + }, + new + { + IdUserRole = 1, + IdPermission = 203 + }, + new + { + IdUserRole = 1, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 205 + }, + new + { + IdUserRole = 1, + IdPermission = 206 + }, + new + { + IdUserRole = 1, + IdPermission = 207 + }, + new + { + IdUserRole = 1, + IdPermission = 208 + }, + new + { + IdUserRole = 1, + IdPermission = 209 + }, + new + { + IdUserRole = 1, + IdPermission = 210 + }, + new + { + IdUserRole = 1, + IdPermission = 211 + }, + new + { + IdUserRole = 1, + IdPermission = 212 + }, + new + { + IdUserRole = 1, + IdPermission = 213 + }, + new + { + IdUserRole = 1, + IdPermission = 214 + }, + new + { + IdUserRole = 1, + IdPermission = 215 + }, + new + { + IdUserRole = 1, + IdPermission = 216 + }, + new + { + IdUserRole = 1, + IdPermission = 217 + }, + new + { + IdUserRole = 1, + IdPermission = 218 + }, + new + { + IdUserRole = 1, + IdPermission = 219 + }, + new + { + IdUserRole = 1, + IdPermission = 220 + }, + new + { + IdUserRole = 1, + IdPermission = 221 + }, + new + { + IdUserRole = 1, + IdPermission = 222 + }, + new + { + IdUserRole = 1, + IdPermission = 223 + }, + new + { + IdUserRole = 1, + IdPermission = 224 + }, + new + { + IdUserRole = 1, + IdPermission = 225 + }, + new + { + IdUserRole = 1, + IdPermission = 226 + }, + new + { + IdUserRole = 1, + IdPermission = 227 + }, + new + { + IdUserRole = 1, + IdPermission = 228 + }, + new + { + IdUserRole = 1, + IdPermission = 229 + }, + new + { + IdUserRole = 1, + IdPermission = 230 + }, + new + { + IdUserRole = 1, + IdPermission = 231 + }, + new + { + IdUserRole = 1, + IdPermission = 232 + }, + new + { + IdUserRole = 1, + IdPermission = 233 + }, + new + { + IdUserRole = 1, + IdPermission = 234 + }, + new + { + IdUserRole = 1, + IdPermission = 235 + }, + new + { + IdUserRole = 1, + IdPermission = 236 + }, + new + { + IdUserRole = 1, + IdPermission = 237 + }, + new + { + IdUserRole = 1, + IdPermission = 238 + }, + new + { + IdUserRole = 1, + IdPermission = 239 + }, + new + { + IdUserRole = 1, + IdPermission = 240 + }, + new + { + IdUserRole = 1, + IdPermission = 241 + }, + new + { + IdUserRole = 1, + IdPermission = 242 + }, + new + { + IdUserRole = 1, + IdPermission = 243 + }, + new + { + IdUserRole = 1, + IdPermission = 244 + }, + new + { + IdUserRole = 1, + IdPermission = 245 + }, + new + { + IdUserRole = 1, + IdPermission = 246 + }, + new + { + IdUserRole = 1, + IdPermission = 247 + }, + new + { + IdUserRole = 1, + IdPermission = 248 + }, + new + { + IdUserRole = 1, + IdPermission = 249 + }, + new + { + IdUserRole = 1, + IdPermission = 250 + }, + new + { + IdUserRole = 1, + IdPermission = 251 + }, + new + { + IdUserRole = 1, + IdPermission = 252 + }, + new + { + IdUserRole = 1, + IdPermission = 253 + }, + new + { + IdUserRole = 1, + IdPermission = 254 + }, + new + { + IdUserRole = 1, + IdPermission = 255 + }, + new + { + IdUserRole = 1, + IdPermission = 256 + }, + new + { + IdUserRole = 1, + IdPermission = 257 + }, + new + { + IdUserRole = 1, + IdPermission = 258 + }, + new + { + IdUserRole = 1, + IdPermission = 259 + }, + new + { + IdUserRole = 1, + IdPermission = 260 + }, + new + { + IdUserRole = 1, + IdPermission = 261 + }, + new + { + IdUserRole = 1, + IdPermission = 262 + }, + new + { + IdUserRole = 1, + IdPermission = 263 + }, + new + { + IdUserRole = 1, + IdPermission = 264 + }, + new + { + IdUserRole = 1, + IdPermission = 265 + }, + new + { + IdUserRole = 1, + IdPermission = 266 + }, + new + { + IdUserRole = 1, + IdPermission = 267 + }, + new + { + IdUserRole = 1, + IdPermission = 268 + }, + new + { + IdUserRole = 1, + IdPermission = 269 + }, + new + { + IdUserRole = 1, + IdPermission = 380 + }, + new + { + IdUserRole = 1, + IdPermission = 381 + }, + new + { + IdUserRole = 1, + IdPermission = 382 + }, + new + { + IdUserRole = 1, + IdPermission = 383 + }, + new + { + IdUserRole = 1, + IdPermission = 384 + }, + new + { + IdUserRole = 1, + IdPermission = 385 + }, + new + { + IdUserRole = 1, + IdPermission = 386 + }, + new + { + IdUserRole = 1, + IdPermission = 387 + }, + new + { + IdUserRole = 1, + IdPermission = 388 + }, + new + { + IdUserRole = 1, + IdPermission = 389 + }, + new + { + IdUserRole = 1, + IdPermission = 390 + }, + new + { + IdUserRole = 1, + IdPermission = 391 + }, + new + { + IdUserRole = 1, + IdPermission = 400 + }, + new + { + IdUserRole = 1, + IdPermission = 401 + }, + new + { + IdUserRole = 1, + IdPermission = 407 + }, + new + { + IdUserRole = 1, + IdPermission = 408 + }, + new + { + IdUserRole = 1, + IdPermission = 450 + }, + new + { + IdUserRole = 1, + IdPermission = 460 + }, + new + { + IdUserRole = 1, + IdPermission = 461 + }, + new + { + IdUserRole = 1, + IdPermission = 500 + }, + new + { + IdUserRole = 1, + IdPermission = 501 + }, + new + { + IdUserRole = 1, + IdPermission = 502 + }, + new + { + IdUserRole = 1, + IdPermission = 503 + }, + new + { + IdUserRole = 1, + IdPermission = 504 + }, + new + { + IdUserRole = 1, + IdPermission = 505 + }, + new + { + IdUserRole = 1, + IdPermission = 506 + }, + new + { + IdUserRole = 1, + IdPermission = 507 + }, + new + { + IdUserRole = 1, + IdPermission = 510 + }, + new + { + IdUserRole = 1, + IdPermission = 511 + }, + new + { + IdUserRole = 1, + IdPermission = 512 + }, + new + { + IdUserRole = 1, + IdPermission = 513 + }, + new + { + IdUserRole = 1, + IdPermission = 514 + }, + new + { + IdUserRole = 1, + IdPermission = 515 + }, + new + { + IdUserRole = 1, + IdPermission = 516 + }, + new + { + IdUserRole = 1, + IdPermission = 517 + }, + new + { + IdUserRole = 1, + IdPermission = 518 + }, + new + { + IdUserRole = 1, + IdPermission = 519 + }, + new + { + IdUserRole = 1, + IdPermission = 520 + }, + new + { + IdUserRole = 1, + IdPermission = 521 + }, + new + { + IdUserRole = 1, + IdPermission = 522 + }, + new + { + IdUserRole = 1, + IdPermission = 523 + }, + new + { + IdUserRole = 1, + IdPermission = 524 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdInclude") + .HasColumnType("integer") + .HasColumnName("id_include_user_role"); + + b.HasKey("Id", "IdInclude") + .HasName("t_relation_user_role_user_role_pk"); + + b.HasIndex("IdInclude"); + + b.ToTable("t_relation_user_role_user_role"); + + b.HasComment("Отношение ролей к ролям"); + + b.HasData( + new + { + Id = 1101, + IdInclude = 1100 + }, + new + { + Id = 1103, + IdInclude = 1102 + }, + new + { + Id = 1105, + IdInclude = 1104 + }, + new + { + Id = 1107, + IdInclude = 1106 + }, + new + { + Id = 1109, + IdInclude = 1108 + }, + new + { + Id = 1111, + IdInclude = 1110 + }, + new + { + Id = 1114, + IdInclude = 1113 + }, + new + { + Id = 1117, + IdInclude = 1116 + }, + new + { + Id = 1203, + IdInclude = 1202 + }, + new + { + Id = 1207, + IdInclude = 1206 + }, + new + { + Id = 1209, + IdInclude = 1208 + }, + new + { + Id = 1212, + IdInclude = 1211 + }, + new + { + Id = 1214, + IdInclude = 1213 + }, + new + { + Id = 1216, + IdInclude = 1215 + }, + new + { + Id = 1218, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1200 + }, + new + { + Id = 2000, + IdInclude = 1201 + }, + new + { + Id = 2000, + IdInclude = 1202 + }, + new + { + Id = 2000, + IdInclude = 1204 + }, + new + { + Id = 2000, + IdInclude = 1205 + }, + new + { + Id = 2000, + IdInclude = 1206 + }, + new + { + Id = 2000, + IdInclude = 1208 + }, + new + { + Id = 2000, + IdInclude = 1210 + }, + new + { + Id = 2000, + IdInclude = 1211 + }, + new + { + Id = 2000, + IdInclude = 1213 + }, + new + { + Id = 2000, + IdInclude = 1215 + }, + new + { + Id = 2000, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1219 + }, + new + { + Id = 2000, + IdInclude = 1220 + }, + new + { + Id = 2000, + IdInclude = 1221 + }, + new + { + Id = 2000, + IdInclude = 1500 + }, + new + { + Id = 2000, + IdInclude = 1501 + }, + new + { + Id = 2000, + IdInclude = 1502 + }, + new + { + Id = 2001, + IdInclude = 1500 + }, + new + { + Id = 2001, + IdInclude = 1501 + }, + new + { + Id = 2001, + IdInclude = 1502 + }, + new + { + Id = 2002, + IdInclude = 1500 + }, + new + { + Id = 2002, + IdInclude = 1501 + }, + new + { + Id = 2002, + IdInclude = 1502 + }, + new + { + Id = 2003, + IdInclude = 1500 + }, + new + { + Id = 2003, + IdInclude = 1501 + }, + new + { + Id = 2003, + IdInclude = 1502 + }, + new + { + Id = 2004, + IdInclude = 1500 + }, + new + { + Id = 2004, + IdInclude = 1501 + }, + new + { + Id = 2004, + IdInclude = 1502 + }, + new + { + Id = 2005, + IdInclude = 1500 + }, + new + { + Id = 2005, + IdInclude = 1501 + }, + new + { + Id = 2005, + IdInclude = 1502 + }, + new + { + Id = 2006, + IdInclude = 1500 + }, + new + { + Id = 2006, + IdInclude = 1501 + }, + new + { + Id = 2006, + IdInclude = 1502 + }, + new + { + Id = 2007, + IdInclude = 1500 + }, + new + { + Id = 2007, + IdInclude = 1501 + }, + new + { + Id = 2007, + IdInclude = 1502 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.HasKey("IdUser", "IdUserRole"); + + b.HasIndex("IdUserRole"); + + b.ToTable("t_relation_user_user_role"); + + b.HasComment("Отношение пользователей и ролей"); + + b.HasData( + new + { + IdUser = 1, + IdUserRole = 1 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Begin") + .HasColumnType("timestamp with time zone") + .HasColumnName("begin"); + + b.Property("End") + .HasColumnType("timestamp with time zone") + .HasColumnName("end") + .HasComment("timestamp with time zone"); + + b.Property("Format") + .HasColumnType("integer") + .HasColumnName("format") + .HasComment("Формат отчета"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла-родителя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("Step") + .HasColumnType("integer") + .HasColumnName("step") + .HasComment("размер шага в секундах"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdWell"); + + b.ToTable("t_report_property"); + + b.HasComment("Отчеты с данными по буровым"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DrillEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_end") + .HasComment("Конец вахты"); + + b.Property("DrillStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_start") + .HasComment("Начало вахты"); + + b.Property("IdDriller") + .HasColumnType("integer") + .HasColumnName("id_driller") + .HasComment("Идентификатор бурильщика"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Идентификатор скважины"); + + b.Property("ShiftEnd") + .HasColumnType("time without time zone") + .HasColumnName("shift_end") + .HasComment("Конец смены"); + + b.Property("ShiftStart") + .HasColumnType("time without time zone") + .HasColumnName("shift_start") + .HasComment("Начало смены"); + + b.HasKey("Id"); + + b.HasIndex("IdDriller"); + + b.HasIndex("IdWell"); + + b.ToTable("t_schedule"); + + b.HasComment("График работы бурильщика"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("комментарий для оператора"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("ObsolescenceSec") + .HasColumnType("integer") + .HasColumnName("obsolescence") + .HasComment("сек. до устаревания"); + + b.Property("Setpoints") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("setpoint_set") + .HasComment("Набор уставок"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdWell"); + + b.ToTable("t_setpoints_rquest"); + + b.HasComment("Запросы на изменение уставок панели оператора"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.Subsystem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_subsystem"); + + b.HasComment("Описание подсистем"); + + b.HasData( + new + { + Id = 1, + Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\"", + Name = "АКБ" + }, + new + { + Id = 2, + Description = "Алгоритм поиска оптимальных параметров бурения САУБ", + Name = "MSE" + }, + new + { + Id = 65536, + Description = "Spin master", + Name = "Spin master" + }, + new + { + Id = 65537, + Description = "Torque master", + Name = "Torque master" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("дата/время выключения подсистемы"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("дата/время включения подсистемы"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end") + .HasComment("глубина забоя на момент выключения подсистемы"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start") + .HasComment("глубина забоя на момент включения подсистемы"); + + b.Property("IdSubsystem") + .HasColumnType("integer") + .HasColumnName("id_subsystem"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("ИД телеметрии по которой выдается информация"); + + b.HasKey("Id"); + + b.HasIndex("IdSubsystem"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_subsystem_operation_time"); + + b.HasComment("наработки подсистем"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Информация с панели о скважине"); + + b.Property("RemoteUid") + .IsRequired() + .HasColumnType("text") + .HasColumnName("remote_uid") + .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."); + + b.Property("TimeZone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); + + b.ToTable("t_telemetry"); + + b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("AxialLoad") + .HasColumnType("real") + .HasColumnName("axial_load") + .HasComment("Осевая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("real") + .HasColumnName("axial_load_limit_max") + .HasComment("Осевая нагрузка. Аварийная макс."); + + b.Property("AxialLoadSp") + .HasColumnType("real") + .HasColumnName("axial_load_sp") + .HasComment("Осевая нагрузка. Задание"); + + b.Property("BitDepth") + .HasColumnType("real") + .HasColumnName("bit_depth") + .HasComment("Положение инструмента"); + + b.Property("BlockPosition") + .HasColumnType("real") + .HasColumnName("block_position") + .HasComment("Высота талевого блока"); + + b.Property("BlockPositionMax") + .HasColumnType("real") + .HasColumnName("block_position_max") + .HasComment("Талевый блок. Макс положение"); + + b.Property("BlockPositionMin") + .HasColumnType("real") + .HasColumnName("block_position_min") + .HasComment("Талевый блок. Мин положение"); + + b.Property("BlockSpeed") + .HasColumnType("real") + .HasColumnName("block_speed") + .HasComment("Скорость талевого блока"); + + b.Property("BlockSpeedSp") + .HasColumnType("real") + .HasColumnName("block_speed_sp") + .HasComment("Скорости талевого блока. Задание"); + + b.Property("BlockSpeedSpDevelop") + .HasColumnType("real") + .HasColumnName("block_speed_sp_develop") + .HasComment("Талевый блок. Задание скорости для проработки"); + + b.Property("BlockSpeedSpRotor") + .HasColumnType("real") + .HasColumnName("block_speed_sp_rotor") + .HasComment("Талевый блок. Задание скорости для роторного бурения"); + + b.Property("BlockSpeedSpSlide") + .HasColumnType("real") + .HasColumnName("block_speed_sp_slide") + .HasComment("Талевый блок. Задание скорости для режима слайда"); + + b.Property("Flow") + .HasColumnType("real") + .HasColumnName("flow") + .HasComment("Расход"); + + b.Property("FlowDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("flow_delta_limit_max") + .HasComment("Расход. Аварийный макс."); + + b.Property("FlowIdle") + .HasColumnType("real") + .HasColumnName("flow_idle") + .HasComment("Расход. Холостой ход"); + + b.Property("HookWeight") + .HasColumnType("real") + .HasColumnName("hook_weight") + .HasComment("Вес на крюке"); + + b.Property("HookWeightIdle") + .HasColumnType("real") + .HasColumnName("hook_weight_idle") + .HasComment("Вес на крюке. Холостой ход"); + + b.Property("HookWeightLimitMax") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_max") + .HasComment("Вес на крюке. Затяжка"); + + b.Property("HookWeightLimitMin") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_min") + .HasComment("Вес на крюке. Посадка"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator") + .HasComment("Текущий критерий бурения"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Пользователь САУБ"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Режим САУБ"); + + b.Property("Mse") + .HasColumnType("real") + .HasColumnName("mse") + .HasComment("MSE"); + + b.Property("MseState") + .HasColumnType("smallint") + .HasColumnName("mse_state") + .HasComment("Текущее состояние работы MSE"); + + b.Property("Pressure") + .HasColumnType("real") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("pressure_delta_limit_max") + .HasComment("Давление дифф. Аварийное макс."); + + b.Property("PressureIdle") + .HasColumnType("real") + .HasColumnName("pressure_idle") + .HasComment("Давление. Холостой ход"); + + b.Property("PressureSp") + .HasColumnType("real") + .HasColumnName("pressure_sp") + .HasComment("Давление. Задание"); + + b.Property("PressureSpDevelop") + .HasColumnType("real") + .HasColumnName("pressure_sp_develop") + .HasComment("Давление. Задание для проработки"); + + b.Property("PressureSpRotor") + .HasColumnType("real") + .HasColumnName("pressure_sp_rotor") + .HasComment("Давление. Задание для роторного бурения"); + + b.Property("PressureSpSlide") + .HasColumnType("real") + .HasColumnName("pressure_sp_slide") + .HasComment("Давление. Задание для режима слайда"); + + b.Property("Pump0Flow") + .HasColumnType("real") + .HasColumnName("pump0_flow") + .HasComment("Расход. Буровой насос 1"); + + b.Property("Pump1Flow") + .HasColumnType("real") + .HasColumnName("pump1_flow") + .HasComment("Расход. Буровой насос 2"); + + b.Property("Pump2Flow") + .HasColumnType("real") + .HasColumnName("pump2_flow") + .HasComment("Расход. Буровой насос 3"); + + b.Property("RotorSpeed") + .HasColumnType("real") + .HasColumnName("rotor_speed") + .HasComment("Обороты ротора"); + + b.Property("RotorTorque") + .HasColumnType("real") + .HasColumnName("rotor_torque") + .HasComment("Момент на роторе"); + + b.Property("RotorTorqueIdle") + .HasColumnType("real") + .HasColumnName("rotor_torque_idle") + .HasComment("Момент на роторе. Холостой ход"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("real") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Момент на роторе. Аварийный макс."); + + b.Property("RotorTorqueSp") + .HasColumnType("real") + .HasColumnName("rotor_torque_sp") + .HasComment("Момент на роторе. Задание"); + + b.Property("WellDepth") + .HasColumnType("real") + .HasColumnName("well_depth") + .HasComment("Глубина забоя"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_saub"); + + b.HasComment("набор основных данных по SAUB"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaubStat", b => + { + b.Property("Count") + .HasColumnType("bigint") + .HasColumnName("count_items"); + + b.Property("DateMax") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_max"); + + b.Property("DateMin") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_min"); + + b.Property("DepthMax") + .HasColumnType("real") + .HasColumnName("depth_max"); + + b.Property("DepthMin") + .HasColumnType("real") + .HasColumnName("depth_min"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.ToView("mw_telemetry_datas_saub_stat"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Выбранный режим управления"); + + b.Property("PositionRight") + .HasColumnType("real") + .HasColumnName("position_right") + .HasComment("Крайний правый угол осцилляции"); + + b.Property("PositionZero") + .HasColumnType("real") + .HasColumnName("position_zero") + .HasComment("Нулевая позиция осцилляции"); + + b.Property("RevolsLeftLimit") + .HasColumnType("real") + .HasColumnName("revols_left_limit") + .HasComment("Ограничение числа оборотов влево"); + + b.Property("RevolsLeftTotal") + .HasColumnType("real") + .HasColumnName("revols_left_total") + .HasComment("Суммарное количество оборотов влево"); + + b.Property("RevolsRightLimit") + .HasColumnType("real") + .HasColumnName("revols_right_limit") + .HasComment("Ограничение числа оборотов вправо"); + + b.Property("RevolsRightTotal") + .HasColumnType("real") + .HasColumnName("revols_right_total") + .HasComment("Суммарное количество оборотов вправо"); + + b.Property("SpeedLeftSp") + .HasColumnType("real") + .HasColumnName("speed_left_sp") + .HasComment("Заданная скорость вращения влево"); + + b.Property("SpeedRightSp") + .HasColumnType("real") + .HasColumnName("speed_right_sp") + .HasComment("Заданная скорость вращения вправо"); + + b.Property("State") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("Переменная этапа"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_spin"); + + b.HasComment("набор основных данных по SpinMaster"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.Property("MessageTemplate") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message_template"); + + b.HasKey("IdTelemetry", "IdEvent"); + + b.ToTable("t_telemetry_event"); + + b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Arg0") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg0") + .HasComment("Аргумент №0 для вставки в шаблон сообщения"); + + b.Property("Arg1") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg1"); + + b.Property("Arg2") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg2"); + + b.Property("Arg3") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg3"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdTelemetryUser") + .HasColumnType("integer") + .HasColumnName("id_telemetry_user") + .HasComment("Пользователь панели отправляющей телеметрию. не пользователь облака."); + + b.Property("WellDepth") + .HasColumnType("double precision") + .HasColumnName("well_depth"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_message"); + + b.HasComment("Сообщения на буровых"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname"); + + b.HasKey("IdTelemetry", "IdUser"); + + b.ToTable("t_telemetry_user"); + + b.HasComment("Пользователи панели САУБ. Для сообщений."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryWirelineRunOut", b => + { + b.Property("IdTelemetry") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Идентификатор телеметрии"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("IdTelemetry")); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_time") + .HasComment("Отметка времени"); + + b.Property("Hauling") + .HasColumnType("real") + .HasColumnName("hauling") + .HasComment("Наработка талевого каната с момента перетяжки каната, т*км"); + + b.Property("HaulingWarnSp") + .HasColumnType("real") + .HasColumnName("hauling_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости перетяжки, т*км"); + + b.Property("Replace") + .HasColumnType("real") + .HasColumnName("replace") + .HasComment("Наработка талевого каната с момента замены каната, т*км"); + + b.Property("ReplaceWarnSp") + .HasColumnType("real") + .HasColumnName("replace_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости замены, т*км"); + + b.HasKey("IdTelemetry"); + + b.ToTable("t_telemetry_wireline_run_out"); + + b.HasComment("Наработка талевого каната"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("должность"); + + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdState") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("состояние:\n0 - не активен, \n1 - активен, \n2 - заблокирован"); + + b.Property("Login") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("login"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("имя"); + + b.Property("PasswordHash") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("password_hash") + .HasComment("соленый хэш пароля.\nпервые 5 символов - соль"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("отчество"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("phone") + .HasComment("номер телефона"); + + b.Property("Position") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("position") + .HasComment("email"); + + b.Property("Surname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("фамилия"); + + b.HasKey("Id"); + + b.HasIndex("IdCompany"); + + b.HasIndex("Login") + .IsUnique(); + + b.ToTable("t_user"); + + b.HasComment("Пользователи облака"); + + b.HasData( + new + { + Id = 1, + Email = "", + IdCompany = 1, + IdState = (short)1, + Login = "dev", + Name = "Разработчик", + PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя"); + + b.HasKey("Id"); + + b.ToTable("t_user_role"); + + b.HasComment("Роли пользователей в системе"); + + b.HasData( + new + { + Id = 1, + Caption = "root", + IdType = 1 + }, + new + { + Id = 1100, + Caption = "admin_cluster.view", + IdType = 1 + }, + new + { + Id = 1101, + Caption = "admin_cluster.edit", + IdType = 1 + }, + new + { + Id = 1102, + Caption = "admin_company.view", + IdType = 1 + }, + new + { + Id = 1103, + Caption = "admin_company.edit", + IdType = 1 + }, + new + { + Id = 1104, + Caption = "admin_company_type.view", + IdType = 1 + }, + new + { + Id = 1105, + Caption = "admin_company_type.edit", + IdType = 1 + }, + new + { + Id = 1106, + Caption = "admin_deposit.view", + IdType = 1 + }, + new + { + Id = 1107, + Caption = "admin_deposit.edit", + IdType = 1 + }, + new + { + Id = 1108, + Caption = "admin_permission.view", + IdType = 1 + }, + new + { + Id = 1109, + Caption = "admin_permission.edit", + IdType = 1 + }, + new + { + Id = 1110, + Caption = "admin_role.view", + IdType = 1 + }, + new + { + Id = 1111, + Caption = "admin_role.edit", + IdType = 1 + }, + new + { + Id = 1112, + Caption = "admin_telemetry.view", + IdType = 1 + }, + new + { + Id = 1113, + Caption = "admin_user.view", + IdType = 1 + }, + new + { + Id = 1114, + Caption = "admin_user.edit", + IdType = 1 + }, + new + { + Id = 1115, + Caption = "admin_visit_log.view", + IdType = 1 + }, + new + { + Id = 1116, + Caption = "admin_well.view", + IdType = 1 + }, + new + { + Id = 1117, + Caption = "admin_well.edit", + IdType = 1 + }, + new + { + Id = 1200, + Caption = "archive.view", + IdType = 1 + }, + new + { + Id = 1201, + Caption = "cluster.view", + IdType = 1 + }, + new + { + Id = 1202, + Caption = "composite.view", + IdType = 1 + }, + new + { + Id = 1203, + Caption = "composite.edit", + IdType = 1 + }, + new + { + Id = 1204, + Caption = "deposit.view", + IdType = 1 + }, + new + { + Id = 1205, + Caption = "document.view", + IdType = 1 + }, + new + { + Id = 1206, + Caption = "drillProcessFlow.view", + IdType = 1 + }, + new + { + Id = 1207, + Caption = "drillProcessFlow.edit", + IdType = 1 + }, + new + { + Id = 1208, + Caption = "measure.view", + IdType = 1 + }, + new + { + Id = 1209, + Caption = "measure.edit", + IdType = 1 + }, + new + { + Id = 1210, + Caption = "message.view", + IdType = 1 + }, + new + { + Id = 1211, + Caption = "operations.view", + IdType = 1 + }, + new + { + Id = 1212, + Caption = "operations.edit", + IdType = 1 + }, + new + { + Id = 1213, + Caption = "params.view", + IdType = 1 + }, + new + { + Id = 1214, + Caption = "params.edit", + IdType = 1 + }, + new + { + Id = 1215, + Caption = "report.view", + IdType = 1 + }, + new + { + Id = 1216, + Caption = "report.edit", + IdType = 1 + }, + new + { + Id = 1217, + Caption = "setpoints.view", + IdType = 1 + }, + new + { + Id = 1218, + Caption = "setpoints.edit", + IdType = 1 + }, + new + { + Id = 1219, + Caption = "telemetry.view", + IdType = 1 + }, + new + { + Id = 1220, + Caption = "telemetryAnalysis.view", + IdType = 1 + }, + new + { + Id = 1221, + Caption = "well.view", + IdType = 1 + }, + new + { + Id = 1500, + Caption = "Просмотр всего", + IdType = 1 + }, + new + { + Id = 1501, + Caption = "file.edit", + IdType = 1 + }, + new + { + Id = 1502, + Caption = "drillingProgram.edit", + IdType = 1 + }, + new + { + Id = 2000, + Caption = "Заказчик", + IdType = 0 + }, + new + { + Id = 2001, + Caption = "Супервайзер", + IdType = 0 + }, + new + { + Id = 2002, + Caption = "Буровой подрядчик", + IdType = 0 + }, + new + { + Id = 2003, + Caption = "Растворщик", + IdType = 0 + }, + new + { + Id = 2004, + Caption = "Телеметрист", + IdType = 0 + }, + new + { + Id = 2005, + Caption = "Долотный сервис", + IdType = 0 + }, + new + { + Id = 2006, + Caption = "ГТИ", + IdType = 0 + }, + new + { + Id = 2007, + Caption = "Цементирование", + IdType = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Key") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("key") + .HasComment("Ключ настроек пользователя"); + + b.Property("Value") + .HasColumnType("jsonb") + .HasColumnName("setting_value") + .HasComment("Значение настроек пользователя"); + + b.HasKey("IdUser", "Key"); + + b.ToTable("t_user_settings"); + + b.HasComment("настройки интерфейса пользователя"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCluster") + .HasColumnType("integer") + .HasColumnName("id_cluster"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("0 - неизвестно, 1 - в работе, 2 - завершена"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdWellType") + .HasColumnType("integer") + .HasColumnName("id_well_type"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdCluster"); + + b.HasIndex("IdTelemetry") + .IsUnique(); + + b.HasIndex("IdWellType"); + + b.ToTable("t_well"); + + b.HasComment("скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины получателя"); + + b.Property("IdWellSrc") + .HasColumnType("integer") + .HasColumnName("id_well_src") + .HasComment("Id скважины композита"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции композита"); + + b.HasKey("IdWell", "IdWellSrc", "IdWellSectionType"); + + b.HasIndex("IdWellSectionType"); + + b.HasIndex("IdWellSrc"); + + b.ToTable("t_well_composite"); + + b.HasComment("Композитная скважина"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.HasKey("IdWell", "IdUser", "IdCategory") + .HasName("t_well_final_documents_pk"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_well_final_documents"); + + b.HasComment("Дело скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryInfo") + .HasColumnType("text") + .HasColumnName("category_info") + .HasComment("Доп. информация к выбраной категории"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("DurationHours") + .HasColumnType("double precision") + .HasColumnName("duration_hours") + .HasComment("Продолжительность, часы"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdPlan") + .HasColumnType("integer") + .HasColumnName("id_plan") + .HasComment("Id плановой операции"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0 = План или 1 = Факт"); + + b.Property("IdUser") + .HasColumnType("integer"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции скважины"); + + b.Property("LastUpdateDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("DateStart"); + + b.HasIndex("DepthEnd"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdPlan"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_well_operation"); + + b.HasComment("Данные по операциям на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("id родительской категории"); + + b.Property("KeyValueName") + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("key_value_name") + .HasComment("Название ключевого показателя операции"); + + b.Property("KeyValueUnits") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("key_value_units") + .HasComment("Единицы измерения ключевого показателя операции"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории операции"); + + b.HasKey("Id"); + + b.HasIndex("IdParent"); + + b.ToTable("t_well_operation_category"); + + b.HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "БУРЕНИЕ" + }, + new + { + Id = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КРЕПЛЕНИЕ" + }, + new + { + Id = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГФР" + }, + new + { + Id = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные операции" + }, + new + { + Id = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Непроизводительное время (НПВ)" + }, + new + { + Id = 4000, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КНБК" + }, + new + { + Id = 4001, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "Механическое. бурение" + }, + new + { + Id = 4002, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Статический замер" + }, + new + { + Id = 4003, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Нормализация диаметра скважины" + }, + new + { + Id = 4004, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 4005, + IdParent = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4006, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск обсадной колонны" + }, + new + { + Id = 4007, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 4008, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы при креплении" + }, + new + { + Id = 4009, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка/разборка приборов ГИС" + }, + new + { + Id = 4010, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4011, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГИС" + }, + new + { + Id = 4012, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка, ОБР" + }, + new + { + Id = 4013, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы" + }, + new + { + Id = 4014, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт оборудования" + }, + new + { + Id = 4015, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Аварийные работы" + }, + new + { + Id = 4016, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Осложнение" + }, + new + { + Id = 4017, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Незаложенные в ГГД операции" + }, + new + { + Id = 5000, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка КНБК" + }, + new + { + Id = 5001, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка КНБК" + }, + new + { + Id = 5002, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение слайдом" + }, + new + { + Id = 5003, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение ротором" + }, + new + { + Id = 5004, + IdParent = 4002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Замер ЗТС (запись MWD)" + }, + new + { + Id = 5005, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка перед наращиванием" + }, + new + { + Id = 5006, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка во время бурения" + }, + new + { + Id = 5007, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка перед наращиванием" + }, + new + { + Id = 5008, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка во время бурения" + }, + new + { + Id = 5009, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка перед наращиванием" + }, + new + { + Id = 5010, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 5011, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Удержание в клиньях" + }, + new + { + Id = 5012, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем инструмента" + }, + new + { + Id = 5013, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем КНБК" + }, + new + { + Id = 5014, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента" + }, + new + { + Id = 5015, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КНБК" + }, + new + { + Id = 5016, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка при спуске ОК" + }, + new + { + Id = 5017, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск ОК" + }, + new + { + Id = 5018, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ОЗЦ" + }, + new + { + Id = 5019, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 5020, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка БИ" + }, + new + { + Id = 5021, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ОК" + }, + new + { + Id = 5022, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при спуске ОК" + }, + new + { + Id = 5023, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при цементировании" + }, + new + { + Id = 5024, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка комплекса приборов ГИС" + }, + new + { + Id = 5025, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка комплекса приборов ГИС" + }, + new + { + Id = 5026, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем приборов ГИС (на трубах)" + }, + new + { + Id = 5027, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск приборов ГИС (на трубах)" + }, + new + { + Id = 5028, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на жестком кабеле" + }, + new + { + Id = 5029, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на кабеле" + }, + new + { + Id = 5030, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на трубах" + }, + new + { + Id = 5031, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Закачка/прокачка пачки" + }, + new + { + Id = 5032, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка БР" + }, + new + { + Id = 5033, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование ТС при бурении" + }, + new + { + Id = 5034, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перезапись гаммы-каротажа" + }, + new + { + Id = 5035, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Приготовление БР" + }, + new + { + Id = 5036, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка" + }, + new + { + Id = 5037, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 5038, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента с проработкой" + }, + new + { + Id = 5039, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ВМР" + }, + new + { + Id = 5040, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Демонтаж ПВО" + }, + new + { + Id = 5041, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Долив затруба при подъёме" + }, + new + { + Id = 5042, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж ПВО" + }, + new + { + Id = 5043, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наработка жёлоба" + }, + new + { + Id = 5044, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обвязка устья с циркуляционной системой" + }, + new + { + Id = 5045, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Оборудование устья" + }, + new + { + Id = 5046, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ПВО" + }, + new + { + Id = 5047, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перемонтаж ПВО " + }, + new + { + Id = 5048, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перетяжка талевого каната" + }, + new + { + Id = 5049, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при сборке КНБК" + }, + new + { + Id = 5050, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Полная замена талевого каната" + }, + new + { + Id = 5051, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПР перед забуркой направления" + }, + new + { + Id = 5052, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Продувка манифольда" + }, + new + { + Id = 5053, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Срезка" + }, + new + { + Id = 5054, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тайм-дриллинг" + }, + new + { + Id = 5055, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тех.отстой" + }, + new + { + Id = 5056, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Учебная тревога \"Выброс\"" + }, + new + { + Id = 5057, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Чистка ЦСГО/емкостного блока" + }, + new + { + Id = 5058, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт бурового оборудования" + }, + new + { + Id = 5059, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ловильные работы" + }, + new + { + Id = 5060, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ожидание" + }, + new + { + Id = 5061, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Определение места прихвата и ЛМ" + }, + new + { + Id = 5062, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа яссом" + }, + new + { + Id = 5063, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расхаживание" + }, + new + { + Id = 5064, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - колокол" + }, + new + { + Id = 5065, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - метчик" + }, + new + { + Id = 5066, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - овершот" + }, + new + { + Id = 5067, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - труболовка" + }, + new + { + Id = 5068, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (встряхивание)" + }, + new + { + Id = 5069, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (отстрел)" + }, + new + { + Id = 5070, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Установка ванн" + }, + new + { + Id = 5071, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Фрезеровка" + }, + new + { + Id = 5072, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Контролируемое ГНВП" + }, + new + { + Id = 5073, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Поглощение" + }, + new + { + Id = 5074, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сальникообразование" + }, + new + { + Id = 5075, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Утяжеление БР" + }, + new + { + Id = 5076, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "НПВ / прочее" + }, + new + { + Id = 5077, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка раствора (несоответствие параметров)" + }, + new + { + Id = 5078, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "подъем ОК" + }, + new + { + Id = 5079, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ревизия КНБК/инструмента/ЗТС" + }, + new + { + Id = 5082, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка устройства ориентирования КО" + }, + new + { + Id = 5083, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка принудительная" + }, + new + { + Id = 5084, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка подъем БИ, продувка" + }, + new + { + Id = 5085, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск бурильного инструмента со сборкой с мостков" + }, + new + { + Id = 5086, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем БИ с выбросом на мостки" + }, + new + { + Id = 5087, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск БИ со сборкой с мостков" + }, + new + { + Id = 5088, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка и спуск ТБТ" + }, + new + { + Id = 5089, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КО на транспотрной колонне" + }, + new + { + Id = 5090, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Отворот допускной трубы" + }, + new + { + Id = 5091, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески, опрессовка" + }, + new + { + Id = 5092, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж, опрессовка ФА" + }, + new + { + Id = 5093, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка хвостовика 114мм (согласно схеме)" + }, + new + { + Id = 5094, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР к спуску УЭЦН" + }, + new + { + Id = 5095, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески (потайной колонны, хвостовика)" + }, + new + { + Id = 5096, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование перед спуском" + }, + new + { + Id = 5097, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка - перевод скважины на новый раствор" + }, + new + { + Id = 5098, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка БИ с мостков на подсвечник" + }, + new + { + Id = 5099, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО." + }, + new + { + Id = 5100, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Смена рабочего переводника ВСП" + }, + new + { + Id = 5101, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("Order") + .HasColumnType("real") + .HasColumnName("order") + .HasComment("Порядок"); + + b.HasKey("Id"); + + b.ToTable("t_well_section_type"); + + b.HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол", + Order = 4f + }, + new + { + Id = 2, + Caption = "Направление", + Order = 0f + }, + new + { + Id = 3, + Caption = "Кондуктор", + Order = 1f + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна", + Order = 3f + }, + new + { + Id = 5, + Caption = "Транспортный ствол", + Order = 5f + }, + new + { + Id = 6, + Caption = "Хвостовик", + Order = 6f + }, + new + { + Id = 7, + Caption = "Пилотный ствол 2", + Order = 4.1f + }, + new + { + Id = 8, + Caption = "Направление 2", + Order = 0.1f + }, + new + { + Id = 9, + Caption = "Кондуктор 2", + Order = 1.1f + }, + new + { + Id = 10, + Caption = "Эксплуатационная колонна 2", + Order = 3.1f + }, + new + { + Id = 11, + Caption = "Транспортный ствол 2", + Order = 5.1f + }, + new + { + Id = 12, + Caption = "Хвостовик 2", + Order = 6.1f + }, + new + { + Id = 13, + Caption = "Пилотный ствол 3", + Order = 4.2f + }, + new + { + Id = 14, + Caption = "Направление 3", + Order = 0.2f + }, + new + { + Id = 15, + Caption = "Кондуктор 3", + Order = 1.2f + }, + new + { + Id = 16, + Caption = "Эксплуатационная колонна 3", + Order = 3.2f + }, + new + { + Id = 17, + Caption = "Транспортный ствол 3", + Order = 5.2f + }, + new + { + Id = 18, + Caption = "Хвостовик 3", + Order = 6.2f + }, + new + { + Id = 19, + Caption = "Пилотный ствол 4", + Order = 4.3f + }, + new + { + Id = 20, + Caption = "Направление 4", + Order = 0.3f + }, + new + { + Id = 21, + Caption = "Кондуктор 4", + Order = 1.3f + }, + new + { + Id = 22, + Caption = "Эксплуатационная колонна 4", + Order = 3.3f + }, + new + { + Id = 23, + Caption = "Транспортный ствол 4", + Order = 5.3f + }, + new + { + Id = 24, + Caption = "Хвостовик 4", + Order = 6.3f + }, + new + { + Id = 25, + Caption = "Пилотный ствол 5", + Order = 4.4f + }, + new + { + Id = 26, + Caption = "Направление 5", + Order = 0.4f + }, + new + { + Id = 27, + Caption = "Кондуктор 5", + Order = 1.4f + }, + new + { + Id = 28, + Caption = "Эксплуатационная колонна 5", + Order = 3.4f + }, + new + { + Id = 29, + Caption = "Транспортный ствол 5", + Order = 5.4f + }, + new + { + Id = 30, + Caption = "Хвостовик 5", + Order = 6.4f + }, + new + { + Id = 31, + Caption = "Техническая колонна", + Order = 2f + }, + new + { + Id = 32, + Caption = "Техническая колонна 2", + Order = 2.1f + }, + new + { + Id = 33, + Caption = "Техническая колонна 3", + Order = 2.2f + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_well_type"); + + b.HasComment("конструкция скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Наклонно-направленная" + }, + new + { + Id = 2, + Caption = "Горизонтальная" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.RecordBase", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Actcod") + .HasColumnType("smallint") + .HasColumnName("ACTCOD"); + + b.Property("Date") + .HasColumnType("integer") + .HasColumnName("DATE"); + + b.Property("Recid") + .HasColumnType("smallint") + .HasColumnName("RECID"); + + b.Property("Seqid") + .HasColumnType("integer") + .HasColumnName("SEQID"); + + b.Property("Stknum") + .HasColumnType("smallint") + .HasColumnName("STKNUM"); + + b.Property("Time") + .HasColumnType("integer") + .HasColumnName("TIME"); + + b.Property("Wellid") + .HasColumnType("text") + .HasColumnName("WELLID"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_wits_base"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Blkpos") + .HasColumnType("real") + .HasColumnName("BLKPOS"); + + b.Property("Chkp") + .HasColumnType("real") + .HasColumnName("CHKP"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptretm") + .HasColumnType("real") + .HasColumnName("DEPTRETM"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Gasa") + .HasColumnType("real") + .HasColumnName("GASA"); + + b.Property("Hkla") + .HasColumnType("real") + .HasColumnName("HKLA"); + + b.Property("Hklx") + .HasColumnType("real") + .HasColumnName("HKLX"); + + b.Property("Lagstks") + .HasColumnType("smallint") + .HasColumnName("LAGSTKS"); + + b.Property("Mcia") + .HasColumnType("real") + .HasColumnName("MCIA"); + + b.Property("Mcoa") + .HasColumnType("real") + .HasColumnName("MCOA"); + + b.Property("Mdia") + .HasColumnType("real") + .HasColumnName("MDIA"); + + b.Property("Mdoa") + .HasColumnType("real") + .HasColumnName("MDOA"); + + b.Property("Mfia") + .HasColumnType("real") + .HasColumnName("MFIA"); + + b.Property("Mfoa") + .HasColumnType("real") + .HasColumnName("MFOA"); + + b.Property("Mfop") + .HasColumnType("smallint") + .HasColumnName("MFOP"); + + b.Property("Mtia") + .HasColumnType("real") + .HasColumnName("MTIA"); + + b.Property("Mtoa") + .HasColumnType("real") + .HasColumnName("MTOA"); + + b.Property("Ropa") + .HasColumnType("real") + .HasColumnName("ROPA"); + + b.Property("Rpma") + .HasColumnType("smallint") + .HasColumnName("RPMA"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spm1") + .HasColumnType("smallint") + .HasColumnName("SPM1"); + + b.Property("Spm2") + .HasColumnType("smallint") + .HasColumnName("SPM2"); + + b.Property("Spm3") + .HasColumnType("smallint") + .HasColumnName("SPM3"); + + b.Property("Sppa") + .HasColumnType("real") + .HasColumnName("SPPA"); + + b.Property("Stkc") + .HasColumnType("integer") + .HasColumnName("STKC"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.Property("Torqa") + .HasColumnType("real") + .HasColumnName("TORQA"); + + b.Property("Torqx") + .HasColumnType("real") + .HasColumnName("TORQX"); + + b.Property("Tvolact") + .HasColumnType("real") + .HasColumnName("TVOLACT"); + + b.Property("Tvolcact") + .HasColumnType("real") + .HasColumnName("TVOLCACT"); + + b.Property("Woba") + .HasColumnType("real") + .HasColumnName("WOBA"); + + b.Property("Wobx") + .HasColumnType("real") + .HasColumnName("WOBX"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_1"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("DeptmeasGdpMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_GDP_mc"); + + b.Property("DeptmeasMcrstat") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_MCRSTAT"); + + b.Property("DeptmeasRa33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33_mc"); + + b.Property("DeptmeasRa33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F2_mc"); + + b.Property("DeptmeasRa33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F4_mc"); + + b.Property("DeptmeasRp33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33_mc"); + + b.Property("DeptmeasRp33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F2_mc"); + + b.Property("DeptmeasRp33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F4_mc"); + + b.Property("DeptmeasSlvlMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_SLVL_mc"); + + b.Property("GdpMc") + .HasColumnType("real") + .HasColumnName("GDP_mc"); + + b.Property("Mcrstat") + .HasColumnType("real") + .HasColumnName("MCRSTAT"); + + b.Property("Ra33Mc") + .HasColumnType("real") + .HasColumnName("RA33_mc"); + + b.Property("Ra33f2Mc") + .HasColumnType("real") + .HasColumnName("RA33F2_mc"); + + b.Property("Ra33f4Mc") + .HasColumnType("real") + .HasColumnName("RA33F4_mc"); + + b.Property("Rp33Mc") + .HasColumnType("real") + .HasColumnName("RP33_mc"); + + b.Property("Rp33f2Mc") + .HasColumnType("real") + .HasColumnName("RP33F2_mc"); + + b.Property("Rp33f4Mc") + .HasColumnType("real") + .HasColumnName("RP33F4_mc"); + + b.Property("SlvlMc") + .HasColumnType("real") + .HasColumnName("SLVL_mc"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_50"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Btot") + .HasColumnType("real") + .HasColumnName("Btot"); + + b.Property("Bx") + .HasColumnType("real") + .HasColumnName("Bx"); + + b.Property("By") + .HasColumnType("real") + .HasColumnName("By"); + + b.Property("Bz") + .HasColumnType("real") + .HasColumnName("Bz"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Gtot") + .HasColumnType("real") + .HasColumnName("Gtot"); + + b.Property("Gx") + .HasColumnType("real") + .HasColumnName("Gx"); + + b.Property("Gy") + .HasColumnType("real") + .HasColumnName("Gy"); + + b.Property("Gz") + .HasColumnType("real") + .HasColumnName("Gz"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_60"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Att06h") + .HasColumnType("real") + .HasColumnName("ATT06H"); + + b.Property("Att06l") + .HasColumnType("real") + .HasColumnName("ATT06L"); + + b.Property("Att10h") + .HasColumnType("real") + .HasColumnName("ATT10H"); + + b.Property("Att10l") + .HasColumnType("real") + .HasColumnName("ATT10L"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Phl1f1") + .HasColumnType("real") + .HasColumnName("PHL1F1"); + + b.Property("Phl1f2") + .HasColumnType("real") + .HasColumnName("PHL1F2"); + + b.Property("Phl2f1") + .HasColumnType("real") + .HasColumnName("PHL2F1"); + + b.Property("Phl2f2") + .HasColumnType("real") + .HasColumnName("PHL2F2"); + + b.Property("Status") + .HasColumnType("real") + .HasColumnName("Status"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_61"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptsvym") + .HasColumnType("real") + .HasColumnName("DEPTSVYM"); + + b.Property("Deptsvyv") + .HasColumnType("real") + .HasColumnName("DEPTSVYV"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Svyazc") + .HasColumnType("real") + .HasColumnName("SVYAZC"); + + b.Property("Svyazu") + .HasColumnType("real") + .HasColumnName("SVYAZU"); + + b.Property("Svydls") + .HasColumnType("real") + .HasColumnName("SVYDLS"); + + b.Property("Svyew") + .HasColumnType("real") + .HasColumnName("SVYEW"); + + b.Property("Svygtf") + .HasColumnType("real") + .HasColumnName("SVYGTF"); + + b.Property("Svyinc") + .HasColumnType("real") + .HasColumnName("SVYINC"); + + b.Property("Svymtf") + .HasColumnType("real") + .HasColumnName("SVYMTF"); + + b.Property("Svyns") + .HasColumnType("real") + .HasColumnName("SVYNS"); + + b.Property("Svytype") + .HasColumnType("text") + .HasColumnName("SVYTYPE"); + + b.Property("Svywalk") + .HasColumnType("real") + .HasColumnName("SVYWALK"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_7"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptcalm") + .HasColumnType("real") + .HasColumnName("DEPTCALM"); + + b.Property("Deptcalv") + .HasColumnType("real") + .HasColumnName("DEPTCALV"); + + b.Property("Deptfdm") + .HasColumnType("real") + .HasColumnName("DEPTFDM"); + + b.Property("Deptfdv") + .HasColumnType("real") + .HasColumnName("DEPTFDV"); + + b.Property("Deptgr1m") + .HasColumnType("real") + .HasColumnName("DEPTGR1M"); + + b.Property("Deptgr1v") + .HasColumnType("real") + .HasColumnName("DEPTGR1V"); + + b.Property("Deptgr2m") + .HasColumnType("real") + .HasColumnName("DEPTGR2M"); + + b.Property("Deptgr2v") + .HasColumnType("real") + .HasColumnName("DEPTGR2V"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptp1m") + .HasColumnType("real") + .HasColumnName("DEPTP1M"); + + b.Property("Deptp1v") + .HasColumnType("real") + .HasColumnName("DEPTP1V"); + + b.Property("Deptp2m") + .HasColumnType("real") + .HasColumnName("DEPTP2M"); + + b.Property("Deptp2v") + .HasColumnType("real") + .HasColumnName("DEPTP2V"); + + b.Property("Deptrs1m") + .HasColumnType("real") + .HasColumnName("DEPTRS1M"); + + b.Property("Deptrs1v") + .HasColumnType("real") + .HasColumnName("DEPTRS1V"); + + b.Property("Deptrs2m") + .HasColumnType("real") + .HasColumnName("DEPTRS2M"); + + b.Property("Deptrs2v") + .HasColumnType("real") + .HasColumnName("DEPTRS2V"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Mclp") + .HasColumnType("real") + .HasColumnName("MCLP"); + + b.Property("Mfd") + .HasColumnType("real") + .HasColumnName("MFD"); + + b.Property("Mffp") + .HasColumnType("real") + .HasColumnName("MFFP"); + + b.Property("Mfpp") + .HasColumnType("real") + .HasColumnName("MFPP"); + + b.Property("Mfrann") + .HasColumnType("real") + .HasColumnName("MFRANN"); + + b.Property("Mfrpipe") + .HasColumnType("real") + .HasColumnName("MFRPIPE"); + + b.Property("Mftann") + .HasColumnType("real") + .HasColumnName("MFTANN"); + + b.Property("Mftpipe") + .HasColumnType("real") + .HasColumnName("MFTPIPE"); + + b.Property("Mg1") + .HasColumnType("real") + .HasColumnName("MG1"); + + b.Property("Mg1c") + .HasColumnType("real") + .HasColumnName("MG1C"); + + b.Property("Mg2") + .HasColumnType("real") + .HasColumnName("MG2"); + + b.Property("Mg2c") + .HasColumnType("real") + .HasColumnName("MG2C"); + + b.Property("Mpo1") + .HasColumnType("real") + .HasColumnName("MPO1"); + + b.Property("Mpo2") + .HasColumnType("real") + .HasColumnName("MPO2"); + + b.Property("Mr1") + .HasColumnType("real") + .HasColumnName("MR1"); + + b.Property("Mr1c") + .HasColumnType("real") + .HasColumnName("MR1C"); + + b.Property("Mr2") + .HasColumnType("real") + .HasColumnName("MR2"); + + b.Property("Mr2c") + .HasColumnType("real") + .HasColumnName("MR2C"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spare6") + .HasColumnType("real") + .HasColumnName("SPARE6"); + + b.Property("Spare7") + .HasColumnType("real") + .HasColumnName("SPARE7"); + + b.Property("Spare8") + .HasColumnType("real") + .HasColumnName("SPARE8"); + + b.Property("Spare9") + .HasColumnType("real") + .HasColumnName("SPARE9"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_8"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") + .WithMany("Clusters") + .HasForeignKey("IdDeposit") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_cluster_t_deposit_id_fk"); + + b.Navigation("Deposit"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType") + .WithMany("Companies") + .HasForeignKey("IdCompanyType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CompanyType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdFileCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("DrillingProgramParts") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer") + .WithMany() + .HasForeignKey("IdAuthorAnswer"); + + b.HasOne("AsbCloudDb.Model.User", "AuthorQuestion") + .WithMany() + .HasForeignKey("IdAuthorQuestion") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AuthorAnswer"); + + b.Navigation("AuthorQuestion"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany("Files") + .HasForeignKey("IdAuthor"); + + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "FileInfo") + .WithMany("FileMarks") + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_file_mark_t_file_info_fk"); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("FileMarks") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_user_t_file_mark_fk"); + + b.Navigation("FileInfo"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory"); + + b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Folder") + .WithMany("Manuals") + .HasForeignKey("IdFolder") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Category"); + + b.Navigation("Folder"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Parent") + .WithMany("Children") + .HasForeignKey("IdParent") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Category"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category") + .WithMany("Measures") + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.HasOne("AsbCloudDb.Model.NotificationCategory", "NotificationCategory") + .WithMany("Notifications") + .HasForeignKey("IdNotificationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NotificationCategory"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdOperationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", 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.Navigation("User"); + + 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.RelationCompanyWell", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_company_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_well_id_fk"); + + b.Navigation("Company"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationContactsWells") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.DrillingProgramPart", "DrillingProgramPart") + .WithMany("RelatedUsers") + .HasForeignKey("IdDrillingProgramPart") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrillingProgramPart"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.HasOne("AsbCloudDb.Model.Permission", "Permission") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdPermission") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.HasOne("AsbCloudDb.Model.UserRole", "Role") + .WithMany("RelationUserRoleUserRoles") + .HasForeignKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "IncludeRole") + .WithMany() + .HasForeignKey("IdInclude") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IncludeRole"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "File") + .WithMany() + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.HasOne("AsbCloudDb.Model.Driller", "Driller") + .WithMany("Schedule") + .HasForeignKey("IdDriller") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_schedule_t_driller_id_driller"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Driller"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b => + { + b.HasOne("AsbCloudDb.Model.Subsystems.Subsystem", "Subsystem") + .WithMany() + .HasForeignKey("IdSubsystem") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subsystem"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSaub") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSpin") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Events") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_event_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Messages") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_messages_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Users") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_user_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("Users") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("t_user_t_company_id_fk"); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") + .WithMany("Wells") + .HasForeignKey("IdCluster") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_t_cluster_id_fk"); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithOne("Well") + .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("t_well_t_telemetry_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellType", "WellType") + .WithMany("Wells") + .HasForeignKey("IdWellType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("Telemetry"); + + b.Navigation("WellType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellComposites") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellComposites") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_section_type_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "WellSrc") + .WithMany("WellCompositeSrcs") + .HasForeignKey("IdWellSrc") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_src_t_well_id_fk"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + + b.Navigation("WellSrc"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Navigation("Category"); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellOperation", "OperationPlan") + .WithMany() + .HasForeignKey("IdPlan"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellOperations") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellOperations") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("OperationPlan"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Parent") + .WithMany() + .HasForeignKey("IdParent"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record1", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record50", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record60", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record61", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record7", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record8", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Navigation("Wells"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Navigation("RelationCompaniesWells"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Navigation("Companies"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Navigation("Clusters"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Navigation("Schedule"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Navigation("RelatedUsers"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Navigation("FileMarks"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + { + b.Navigation("Children"); + + b.Navigation("Manuals"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Navigation("Measures"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Navigation("RelationUserRolePermissions"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Navigation("DataSaub"); + + b.Navigation("DataSpin"); + + b.Navigation("Events"); + + b.Navigation("Messages"); + + b.Navigation("Users"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Navigation("FileMarks"); + + b.Navigation("Files"); + + b.Navigation("RelationContactsWells"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Navigation("RelationUserRolePermissions"); + + b.Navigation("RelationUserRoleUserRoles"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Navigation("DrillingProgramParts"); + + b.Navigation("ProcessMaps"); + + b.Navigation("RelationCompaniesWells"); + + b.Navigation("WellCompositeSrcs"); + + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Navigation("Wells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs b/AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs new file mode 100644 index 00000000..0b384ab6 --- /dev/null +++ b/AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs @@ -0,0 +1,167 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + public partial class Add_Manuals : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "type", + table: "t_file_category", + type: "integer", + nullable: true, + comment: "0 = Инструкции"); + + migrationBuilder.CreateTable( + name: "t_manual_folder", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "text", nullable: false, comment: "Название папки"), + id_parent = table.Column(type: "integer", nullable: true, comment: "Родительская папки"), + id_category = table.Column(type: "integer", nullable: false, comment: "Категория") + }, + constraints: table => + { + table.PrimaryKey("PK_t_manual_folder", x => x.id); + table.ForeignKey( + name: "FK_t_manual_folder_t_file_category_id_category", + column: x => x.id_category, + principalTable: "t_file_category", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_t_manual_folder_t_manual_folder_id_parent", + column: x => x.id_parent, + principalTable: "t_manual_folder", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }, + comment: "Папка для инструкций"); + + migrationBuilder.CreateTable( + name: "t_manual", + columns: table => new + { + id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + name = table.Column(type: "text", nullable: false, comment: "Название файла"), + date_download = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата загрузки файла"), + id_category = table.Column(type: "integer", nullable: true, comment: "Категория"), + id_folder = table.Column(type: "integer", nullable: true, comment: "Id папки инструкций") + }, + constraints: table => + { + table.PrimaryKey("PK_t_manual", x => x.id); + table.ForeignKey( + name: "FK_t_manual_t_file_category_id_category", + column: x => x.id_category, + principalTable: "t_file_category", + principalColumn: "id"); + table.ForeignKey( + name: "FK_t_manual_t_manual_folder_id_folder", + column: x => x.id_folder, + principalTable: "t_manual_folder", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }, + comment: "Инструкции"); + + migrationBuilder.InsertData( + table: "t_file_category", + columns: new[] { "id", "type", "name", "short_name" }, + values: new object[,] + { + { 30000, 0, "АСУ ТП", null }, + { 30001, 0, "Технология бурения", null } + }); + + migrationBuilder.InsertData( + table: "t_permission", + columns: new[] { "id", "description", "name" }, + values: new object[,] + { + { 523, "Разрешить редактирование инструкций", "Manual.edit" }, + { 524, "Разрешить просмотр инструкций", "Manual.view" } + }); + + migrationBuilder.InsertData( + table: "t_relation_user_role_permission", + columns: new[] { "id_permission", "id_user_role" }, + values: new object[,] + { + { 523, 1 }, + { 524, 1 } + }); + + migrationBuilder.CreateIndex( + name: "IX_t_manual_id_category", + table: "t_manual", + column: "id_category"); + + migrationBuilder.CreateIndex( + name: "IX_t_manual_id_folder", + table: "t_manual", + column: "id_folder"); + + migrationBuilder.CreateIndex( + name: "IX_t_manual_folder_id_category", + table: "t_manual_folder", + column: "id_category"); + + migrationBuilder.CreateIndex( + name: "IX_t_manual_folder_id_parent", + table: "t_manual_folder", + column: "id_parent"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "t_manual"); + + migrationBuilder.DropTable( + name: "t_manual_folder"); + + migrationBuilder.DeleteData( + table: "t_file_category", + keyColumn: "id", + keyValue: 30000); + + migrationBuilder.DeleteData( + table: "t_file_category", + keyColumn: "id", + keyValue: 30001); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 523, 1 }); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 524, 1 }); + + migrationBuilder.DeleteData( + table: "t_permission", + keyColumn: "id", + keyValue: 523); + + migrationBuilder.DeleteData( + table: "t_permission", + keyColumn: "id", + keyValue: 524); + + migrationBuilder.DropColumn( + name: "type", + table: "t_file_category"); + } + } +} diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index e55bff40..8e4119cc 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -432,6 +432,11 @@ namespace AsbCloudDb.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("type") + .HasComment("0 = Инструкции"); + b.Property("Name") .IsRequired() .HasColumnType("text") @@ -785,6 +790,18 @@ namespace AsbCloudDb.Migrations { Id = 20000, Name = "Справки по страницам" + }, + new + { + Id = 30000, + IdType = 0, + Name = "АСУ ТП" + }, + new + { + Id = 30001, + IdType = 0, + Name = "Технология бурения" }); }); @@ -1066,6 +1083,83 @@ namespace AsbCloudDb.Migrations b.HasComment("Ограничения по параметрам телеметрии"); }); + modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateDownload") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_download") + .HasComment("Дата загрузки файла"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Категория"); + + b.Property("IdFolder") + .HasColumnType("integer") + .HasColumnName("id_folder") + .HasComment("Id папки инструкций"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdFolder"); + + b.ToTable("t_manual"); + + b.HasComment("Инструкции"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Категория"); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("Родительская папки"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название папки"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdParent"); + + b.ToTable("t_manual_folder"); + + b.HasComment("Папка для инструкций"); + }); + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => { b.Property("Id") @@ -2163,6 +2257,18 @@ namespace AsbCloudDb.Migrations Id = 522, Description = "Разрешить удаление всех настроек пользователя", Name = "UserSettings.delete" + }, + new + { + Id = 523, + Description = "Разрешить редактирование инструкций", + Name = "Manual.edit" + }, + new + { + Id = 524, + Description = "Разрешить просмотр инструкций", + Name = "Manual.view" }); }); @@ -3750,6 +3856,16 @@ namespace AsbCloudDb.Migrations { IdUserRole = 1, IdPermission = 522 + }, + new + { + IdUserRole = 1, + IdPermission = 523 + }, + new + { + IdUserRole = 1, + IdPermission = 524 }); }); @@ -7682,6 +7798,40 @@ namespace AsbCloudDb.Migrations b.Navigation("Telemetry"); }); + modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory"); + + b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Folder") + .WithMany("Manuals") + .HasForeignKey("IdFolder") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Category"); + + b.Navigation("Folder"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Parent") + .WithMany("Children") + .HasForeignKey("IdParent") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Category"); + + b.Navigation("Parent"); + }); + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => { b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category") @@ -8307,6 +8457,13 @@ namespace AsbCloudDb.Migrations b.Navigation("FileMarks"); }); + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + { + b.Navigation("Children"); + + b.Navigation("Manuals"); + }); + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => { b.Navigation("Measures"); diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index ea865336..d221a750 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -3,6 +3,7 @@ using AsbCloudDb.Model.Subsystems; using Microsoft.EntityFrameworkCore; using System.Threading; using System.Threading.Tasks; +using AsbCloudDb.Model.Manuals; namespace AsbCloudDb.Model { @@ -77,6 +78,9 @@ namespace AsbCloudDb.Model public DbSet HelpPages => Set(); public DbSet Notifications => Set(); public DbSet NotificationCategories => Set(); + public DbSet Manuals => Set(); + public DbSet ManualFolders => Set(); + public AsbCloudDbContext() : base() { @@ -388,6 +392,18 @@ namespace AsbCloudDb.Model entity.HasKey(x => new { x.IdWell, x.IdUser }); }); + modelBuilder.Entity() + .HasOne(mf => mf.Parent) + .WithMany(mf => mf.Children) + .HasForeignKey(mf => mf.IdParent) + .OnDelete(DeleteBehavior.Cascade); + + modelBuilder.Entity() + .HasOne(m => m.Folder) + .WithMany(f => f.Manuals) + .HasForeignKey(m => m.IdFolder) + .OnDelete(DeleteBehavior.Cascade); + DefaultData.DefaultContextData.Fill(modelBuilder); } diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs b/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs index 62012bf2..00e56c06 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs @@ -73,7 +73,10 @@ new () {Id = 10042, Name = "Паспорт скважины (заполняется геологами)"}, new () {Id = 10043, Name = "Фактические данные бурения (вставляются в паспорт скважины)"}, - new () {Id = 20000, Name = "Справки по страницам"} + new () {Id = 20000, Name = "Справки по страницам"}, + + new() { Id = 30000, Name = "АСУ ТП", IdType = FileCategory.IdFileCategoryTypeManuals}, + new() { Id = 30001, Name = "Технология бурения", IdType = FileCategory.IdFileCategoryTypeManuals} }; } } diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs index 611ea0c2..9d12d3b4 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs @@ -156,6 +156,9 @@ new() { Id = 521, Name = "HelpPage.edit", Description = "Разрешить создание справок по страницам"}, new() { Id = 522, Name = "UserSettings.delete", Description = "Разрешить удаление всех настроек пользователя"}, + + new() { Id = 523, Name = "Manual.edit", Description = "Разрешить редактирование инструкций" }, + new() { Id = 524, Name = "Manual.view", Description = "Разрешить просмотр инструкций"} }; } } diff --git a/AsbCloudDb/Model/FileCategory.cs b/AsbCloudDb/Model/FileCategory.cs index ca47394c..5aba28d6 100644 --- a/AsbCloudDb/Model/FileCategory.cs +++ b/AsbCloudDb/Model/FileCategory.cs @@ -7,6 +7,8 @@ namespace AsbCloudDb.Model [Table("t_file_category"), Comment("Категории файлов")] public class FileCategory : IId { + public const int IdFileCategoryTypeManuals = 0; + [Key] [Column("id")] public int Id { get; set; } @@ -16,5 +18,8 @@ namespace AsbCloudDb.Model [Column("short_name"), Comment("Короткое название категории")] public string? ShortName { get; set; } + + [Column("type"), Comment("0 = Инструкции")] + public int? IdType { get; set; } } } \ No newline at end of file diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index 90fc7582..5a23ec89 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using System; using System.Threading; using System.Threading.Tasks; +using AsbCloudDb.Model.Manuals; namespace AsbCloudDb.Model { @@ -70,6 +71,8 @@ namespace AsbCloudDb.Model DbSet HelpPages { get; } DbSet Notifications { get; } DbSet NotificationCategories { get; } + DbSet Manuals { get; } + DbSet ManualFolders { get; } DatabaseFacade Database { get; } Task RefreshMaterializedViewAsync(string mwName, CancellationToken token); diff --git a/AsbCloudDb/Model/Manuals/Manual.cs b/AsbCloudDb/Model/Manuals/Manual.cs new file mode 100644 index 00000000..29bc1371 --- /dev/null +++ b/AsbCloudDb/Model/Manuals/Manual.cs @@ -0,0 +1,32 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudDb.Model.Manuals; + +[Table("t_manual"), Comment("Инструкции")] +public class Manual : IId +{ + [Key] + [Column("id")] + public int Id { get; set; } + + [Column("name"), Comment("Название файла")] + public string Name { get; set; } = null!; + + [Column("date_download"), Comment("Дата загрузки файла")] + public DateTime DateDownload { get; set; } + + [Column("id_category"), Comment("Категория")] + public int? IdCategory { get; set; } + + [ForeignKey(nameof(IdCategory))] + public virtual FileCategory? Category { get; set; } + + [Column("id_folder"), Comment("Id папки инструкций")] + public int? IdFolder { get; set; } + + [ForeignKey(nameof(IdFolder))] + public virtual ManualFolder? Folder { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/Manuals/ManualFolder.cs b/AsbCloudDb/Model/Manuals/ManualFolder.cs new file mode 100644 index 00000000..a3ea9647 --- /dev/null +++ b/AsbCloudDb/Model/Manuals/ManualFolder.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudDb.Model.Manuals; + +[Table("t_manual_folder"), Comment("Папка для инструкций")] +public class ManualFolder : IId +{ + [Key] + [Column("id")] + public int Id { get; set; } + + [Column("name"), Comment("Название папки")] + public string Name { get; set; } = null!; + + [Column("id_parent"), Comment("Родительская папки")] + public int? IdParent { get; set; } + + [ForeignKey(nameof(IdParent))] + public virtual ManualFolder? Parent { get; set; } + + [Column("id_category"), Comment("Категория")] + public int IdCategory { get; set; } + + [ForeignKey(nameof(IdCategory))] + public virtual FileCategory Category { get; set; } = null!; + + public virtual ICollection? Children { get; set; } + + public virtual ICollection? Manuals { get; set; } +} \ No newline at end of file From e56530a10f8915901051f57f1d5809132f24e78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 10 Aug 2023 11:45:05 +0500 Subject: [PATCH 02/25] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B8?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=86=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Добавил сервисы и репозитории для инфструкций 2. Добавил контроллеры 3. Обновил конфиг --- .../Data/Manuals/CatalogItemManualDto.cs | 25 +++ AsbCloudApp/Data/Manuals/ManualDto.cs | 32 +++ AsbCloudApp/Data/Manuals/ManualFolderDto.cs | 38 ++++ .../Repositories/IFileCategoryRepository.cs | 21 ++ .../Repositories/IFileStorageRepository.cs | 6 + .../Repositories/IManualFolderRepository.cs | 31 +++ AsbCloudApp/Repositories/IManualRepository.cs | 21 ++ AsbCloudApp/Services/IManualCatalogService.cs | 76 +++++++ AsbCloudInfrastructure/DependencyInjection.cs | 5 + .../Repository/FileCategoryRepository.cs | 32 +++ .../Repository/FileStorageRepository.cs | 15 ++ .../Repository/ManualFolderRepository.cs | 62 ++++++ .../Repository/ManualRepository.cs | 33 +++ .../Services/ManualCatalogService.cs | 202 ++++++++++++++++++ .../Controllers/ManualController.cs | 120 +++++++++++ .../Controllers/ManualFolderController.cs | 94 ++++++++ AsbCloudWebApi/appsettings.json | 1 + 17 files changed, 814 insertions(+) create mode 100644 AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs create mode 100644 AsbCloudApp/Data/Manuals/ManualDto.cs create mode 100644 AsbCloudApp/Data/Manuals/ManualFolderDto.cs create mode 100644 AsbCloudApp/Repositories/IFileCategoryRepository.cs create mode 100644 AsbCloudApp/Repositories/IManualFolderRepository.cs create mode 100644 AsbCloudApp/Repositories/IManualRepository.cs create mode 100644 AsbCloudApp/Services/IManualCatalogService.cs create mode 100644 AsbCloudInfrastructure/Repository/FileCategoryRepository.cs create mode 100644 AsbCloudInfrastructure/Repository/ManualFolderRepository.cs create mode 100644 AsbCloudInfrastructure/Repository/ManualRepository.cs create mode 100644 AsbCloudInfrastructure/Services/ManualCatalogService.cs create mode 100644 AsbCloudWebApi/Controllers/ManualController.cs create mode 100644 AsbCloudWebApi/Controllers/ManualFolderController.cs diff --git a/AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs b/AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs new file mode 100644 index 00000000..d4a766d1 --- /dev/null +++ b/AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Linq; + +namespace AsbCloudApp.Data.Manuals; + +/// +/// Элемент каталога инструкций +/// +public class CatalogItemManualDto +{ + /// + /// DTO категории + /// + public FileCategoryDto Category { get; set; } = null!; + + /// + /// DTO инструкций хранящиеся без папки + /// + public IEnumerable ManualsWithoutFolder { get; set; } = Enumerable.Empty(); + + /// + /// DTO папок с инструкциями + /// + public IEnumerable Folders { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/AsbCloudApp/Data/Manuals/ManualDto.cs b/AsbCloudApp/Data/Manuals/ManualDto.cs new file mode 100644 index 00000000..8c01f66c --- /dev/null +++ b/AsbCloudApp/Data/Manuals/ManualDto.cs @@ -0,0 +1,32 @@ +using System; + +namespace AsbCloudApp.Data.Manuals; + +/// +/// DTO инструкции +/// +public class ManualDto : IId +{ + /// + public int Id { get; set; } + + /// + /// Название + /// + public string Name { get; set; } = null!; + + /// + /// Дата загрузки + /// + public DateTime DateDownload { get; set; } + + /// + /// Id папки + /// + public int? IdFolder { get; set; } + + /// + /// Id категории файла + /// + public int? IdCategory { get; set; } +} \ No newline at end of file diff --git a/AsbCloudApp/Data/Manuals/ManualFolderDto.cs b/AsbCloudApp/Data/Manuals/ManualFolderDto.cs new file mode 100644 index 00000000..8eef923d --- /dev/null +++ b/AsbCloudApp/Data/Manuals/ManualFolderDto.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; + +namespace AsbCloudApp.Data.Manuals; + +/// +/// DTO папки для хранения инструкций +/// +public class ManualFolderDto : IId +{ + /// + public int Id { get; set; } + + /// + /// Название + /// + public string Name { get; set; } = null!; + + /// + /// Id родительской папки + /// + public int? IdParent { get; set; } + + /// + /// Id категории + /// + public int IdCategory { get; set; } + + /// + /// Вложенные папки + /// + public IEnumerable Children { get; set; } = Enumerable.Empty(); + + /// + /// Хранимые инструкции + /// + public IEnumerable Manuals { get; set; } = Enumerable.Empty(); +} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IFileCategoryRepository.cs b/AsbCloudApp/Repositories/IFileCategoryRepository.cs new file mode 100644 index 00000000..7e64b024 --- /dev/null +++ b/AsbCloudApp/Repositories/IFileCategoryRepository.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Services; + +namespace AsbCloudApp.Repositories; + +/// +/// Репозиторий для работы с категориями файлов +/// +public interface IFileCategoryRepository : ICrudRepository +{ + /// + /// Получение всех записей по идентификатору типа + /// + /// + /// + /// + Task> GetAllAsync(int idType, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IFileStorageRepository.cs b/AsbCloudApp/Repositories/IFileStorageRepository.cs index b8b7b482..37ebb125 100644 --- a/AsbCloudApp/Repositories/IFileStorageRepository.cs +++ b/AsbCloudApp/Repositories/IFileStorageRepository.cs @@ -47,6 +47,12 @@ namespace AsbCloudApp.Repositories /// void DeleteFile(string fileName); + /// + /// Удаление директории + /// + /// + void DeleteDirectory(string path); + /// /// Удаление всех файлов с диска о которых нет информации в базе /// diff --git a/AsbCloudApp/Repositories/IManualFolderRepository.cs b/AsbCloudApp/Repositories/IManualFolderRepository.cs new file mode 100644 index 00000000..d7b86182 --- /dev/null +++ b/AsbCloudApp/Repositories/IManualFolderRepository.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Services; + +namespace AsbCloudApp.Repositories; + +/// +/// Репозиторий для работы с папки хранящими инструкциями +/// +public interface IManualFolderRepository : ICrudRepository +{ + /// + /// Получение дерева каталога папок + /// + /// + /// + /// + Task> GetTreeAsync(int idCategory, CancellationToken cancellationToken); + + /// + /// Получение одной папки по параметрам + /// + /// + /// + /// + /// + /// + Task GetOrDefaultAsync(string name, int? idParent, int idCategory, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IManualRepository.cs b/AsbCloudApp/Repositories/IManualRepository.cs new file mode 100644 index 00000000..d5d98c04 --- /dev/null +++ b/AsbCloudApp/Repositories/IManualRepository.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Services; + +namespace AsbCloudApp.Repositories; + +/// +/// Репозиторий для инструкций +/// +public interface IManualRepository : ICrudRepository +{ + /// + /// Получение инструкций, которые не добавлены в папку + /// + /// + /// + /// + Task> GetManualsWithoutFolderAsync(int idCategory, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Services/IManualCatalogService.cs b/AsbCloudApp/Services/IManualCatalogService.cs new file mode 100644 index 00000000..598de63e --- /dev/null +++ b/AsbCloudApp/Services/IManualCatalogService.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; + +namespace AsbCloudApp.Services; + +/// +/// Сервис для работы c каталогом инструкций +/// +public interface IManualCatalogService +{ + /// + /// Сохранение файла + /// + /// + /// + /// + /// + /// + /// + Task SaveFileAsync(int? idCategory, int? idFolder, string name, Stream stream, + CancellationToken cancellationToken); + + /// + /// Добавление новой папки + /// + /// + /// + /// + /// + /// + Task AddFolderAsync(string name, int? idParent, int idCategory, + CancellationToken cancellationToken); + + /// + /// Обновление папки + /// + /// + /// + /// + /// + Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken); + + /// + /// Удаление папки + /// + /// + /// + /// + Task DeleteFolderAsync(int id, CancellationToken cancellationToken); + + /// + /// Удаление файла + /// + /// + /// + /// + Task DeleteFileAsync(int id, CancellationToken cancellationToken); + + /// + /// Получение файла + /// + /// + /// + /// + Task<(Stream stream, string fileName)?> GetFileAsync(int id, CancellationToken cancellationToken); + + /// + /// Получение каталога + /// + /// + /// + Task> GetCatalogAsync(CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 601d05e7..6d2a43be 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -221,6 +221,11 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); + + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); return services; } diff --git a/AsbCloudInfrastructure/Repository/FileCategoryRepository.cs b/AsbCloudInfrastructure/Repository/FileCategoryRepository.cs new file mode 100644 index 00000000..703817e4 --- /dev/null +++ b/AsbCloudInfrastructure/Repository/FileCategoryRepository.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data; +using AsbCloudApp.Repositories; +using AsbCloudDb.Model; +using Mapster; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Caching.Memory; + +namespace AsbCloudInfrastructure.Repository; + +public class FileCategoryRepository : CrudCacheRepositoryBase, IFileCategoryRepository +{ + public FileCategoryRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache) : base(dbContext, memoryCache) + { + } + + public FileCategoryRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache, + Func, IQueryable> makeQuery) : base(dbContext, memoryCache, makeQuery) + { + } + + public async Task> GetAllAsync(int idType, CancellationToken cancellationToken) + { + return await dbContext.FileCategories.Where(f => f.IdType == idType) + .Select(f => f.Adapt()) + .ToArrayAsync(cancellationToken); + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs index 4af6aa09..ea6268eb 100644 --- a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs +++ b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs @@ -33,6 +33,21 @@ public class FileStorageRepository : IFileStorageRepository DeleteFile(fileName); } } + + public void DeleteDirectory(string path) + { + var fullPath = Path.Combine(RootPath, path); + + if (!Directory.Exists(fullPath)) + return; + + foreach (var file in Directory.GetFiles(fullPath)) + { + File.Delete(file); + } + + Directory.Delete(fullPath, true); + } public void DeleteFile(string fileName) { diff --git a/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs b/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs new file mode 100644 index 00000000..a567195d --- /dev/null +++ b/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Repositories; +using AsbCloudDb.Model; +using AsbCloudDb.Model.Manuals; +using Mapster; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudInfrastructure.Repository; + +public class ManualFolderRepository : CrudRepositoryBase, IManualFolderRepository +{ + public ManualFolderRepository(IAsbCloudDbContext context) : base(context) + { + } + + public async Task> GetTreeAsync(int idCategory, + CancellationToken cancellationToken) + { + var folders = await dbContext.ManualFolders + .Where(m => m.IdCategory == idCategory) + .AsNoTracking() + .Include(m => m.Manuals) + .Include(m => m.Parent) + .ToArrayAsync(cancellationToken); + + return BuildTree(folders).Select(x => x.Adapt()); + } + + public async Task GetOrDefaultAsync(string name, int? idParent, int idCategory, + CancellationToken cancellationToken) + { + var entity = await dbContext.ManualFolders + .FirstOrDefaultAsync(m => m.Name == name && + m.IdCategory == idCategory && + m.IdParent == idParent, cancellationToken); + + if (entity is null) + return null; + + return Convert(entity); + } + + private IEnumerable BuildTree(IEnumerable folders) + { + var folderDict = folders.ToDictionary(f => f.Id); + + foreach (var folder in folders) + { + if (folder.IdParent.HasValue && folderDict.TryGetValue(folder.IdParent.Value, out var parent)) + { + parent.Children ??= new List(); + parent.Children.Add(folder); + } + } + + return folders.Where(f => f.IdParent == null); + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/ManualRepository.cs b/AsbCloudInfrastructure/Repository/ManualRepository.cs new file mode 100644 index 00000000..a23d8714 --- /dev/null +++ b/AsbCloudInfrastructure/Repository/ManualRepository.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Repositories; +using AsbCloudDb.Model; +using AsbCloudDb.Model.Manuals; +using Mapster; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudInfrastructure.Repository; + +public class ManualRepository : CrudRepositoryBase, IManualRepository +{ + public ManualRepository(IAsbCloudDbContext context) : base(context) + { + } + + public ManualRepository(IAsbCloudDbContext context, Func, IQueryable> makeQuery) + : base(context, makeQuery) + { + } + + public async Task> GetManualsWithoutFolderAsync(int idCategory, CancellationToken cancellationToken) + { + return await dbContext.Manuals.Where(m => m.IdCategory == idCategory && + m.IdFolder == null) + .Select(m => m.Adapt()) + .ToArrayAsync(cancellationToken); + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ManualCatalogService.cs b/AsbCloudInfrastructure/Services/ManualCatalogService.cs new file mode 100644 index 00000000..545a114e --- /dev/null +++ b/AsbCloudInfrastructure/Services/ManualCatalogService.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Exceptions; +using AsbCloudApp.Repositories; +using AsbCloudApp.Services; +using AsbCloudDb.Model; +using Microsoft.Extensions.Configuration; + +namespace AsbCloudInfrastructure.Services; + +public class ManualCatalogService : IManualCatalogService +{ + private readonly IEnumerable validExtensions = new[] + { + ".pdf", + ".mp4" + }; + + private readonly string directoryFiles; + private readonly IFileStorageRepository fileStorageRepository; + private readonly IManualFolderRepository manualFolderRepository; + private readonly IManualRepository manualRepository; + private readonly IFileCategoryRepository fileCategoryRepository; + + public ManualCatalogService(IFileStorageRepository fileStorageRepository, + IManualFolderRepository manualFolderRepository, + IManualRepository manualRepository, + IFileCategoryRepository fileCategoryRepository, + IConfiguration configuration) + { + this.fileStorageRepository = fileStorageRepository; + this.manualFolderRepository = manualFolderRepository; + this.manualRepository = manualRepository; + this.fileCategoryRepository = fileCategoryRepository; + directoryFiles = configuration.GetValue("DirectoryManualFiles"); + + if (string.IsNullOrWhiteSpace(directoryFiles)) + directoryFiles = "manuals"; + } + + public async Task SaveFileAsync(int? idCategory, int? idFolder, string name, Stream stream, + CancellationToken cancellationToken) + { + var extension = Path.GetExtension(name); + + if (!validExtensions.Contains(extension)) + throw new ArgumentInvalidException( + $"Невозможно загрузить файл с расширением '{extension}'. Допустимые форматы файлов: {string.Join(", ", validExtensions)}", + extension); + + var path = await BuildFilePathAsync(idCategory, idFolder, name, cancellationToken); + + await fileStorageRepository.SaveFileAsync(path, + stream, + cancellationToken); + + var manual = new ManualDto + { + Name = name, + DateDownload = DateTime.UtcNow, + IdFolder = idFolder, + IdCategory = idCategory + }; + + return await manualRepository.InsertAsync(manual, cancellationToken); + } + + public async Task AddFolderAsync(string name, int? idParent, int idCategory, + CancellationToken cancellationToken) + { + if (idParent.HasValue) + { + var parent = await manualFolderRepository.GetOrDefaultAsync(idParent.Value, cancellationToken) + ?? throw new ArgumentInvalidException("Родительской папки не существует", nameof(idParent)); + + if (parent.IdCategory != idCategory) + throw new ArgumentInvalidException("Категория родительской папки не соответствует текущей категории", + nameof(idCategory)); + } + + var manualFolder = new ManualFolderDto + { + Name = name, + IdParent = idParent, + IdCategory = idCategory, + }; + + if (await IsExistFolderAsync(manualFolder, cancellationToken)) + throw new ArgumentInvalidException("Папка с таким названием уже существует", name); + + return await manualFolderRepository.InsertAsync(manualFolder, cancellationToken); + } + + public async Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken) + { + var folder = await manualFolderRepository.GetOrDefaultAsync(id, cancellationToken) + ?? throw new ArgumentInvalidException($"Папки с Id: {id} не сущесвует", nameof(id)); + + folder.Name = name; + + if (await IsExistFolderAsync(folder, cancellationToken)) + throw new ArgumentInvalidException("Папка с таким названием уже существует", name); + + await manualFolderRepository.UpdateAsync(folder, cancellationToken); + } + + + public async Task DeleteFolderAsync(int id, CancellationToken cancellationToken) + { + var folder = await manualFolderRepository.GetOrDefaultAsync(id, cancellationToken); + + if (folder is null) + return 0; + + var path = Path.Combine(directoryFiles, folder.IdCategory.ToString(), folder.Id.ToString()); + fileStorageRepository.DeleteDirectory(path); + + return await manualFolderRepository.DeleteAsync(folder.Id, cancellationToken); + } + + public async Task DeleteFileAsync(int id, CancellationToken cancellationToken) + { + var manual = await manualRepository.GetOrDefaultAsync(id, cancellationToken); + + if (manual is null) + return 0; + + var filePath = await BuildFilePathAsync(manual.IdCategory, manual.IdFolder, manual.Name, + cancellationToken); + + fileStorageRepository.DeleteFile(filePath); + + return await manualRepository.DeleteAsync(manual.Id, cancellationToken); + } + + public async Task<(Stream stream, string fileName)?> GetFileAsync(int id, CancellationToken cancellationToken) + { + var manual = await manualRepository.GetOrDefaultAsync(id, cancellationToken); + + if (manual is null) + return null; + + var path = await BuildFilePathAsync(manual.IdCategory, manual.IdFolder, manual.Name, cancellationToken); + + var fileStream = new FileStream(Path.GetFullPath(path), FileMode.Open); + + return (fileStream, manual.Name); + } + + public async Task> GetCatalogAsync(CancellationToken cancellationToken) + { + var catalogItems = new List(); + + var categories = await fileCategoryRepository.GetAllAsync(FileCategory.IdFileCategoryTypeManuals, + cancellationToken); + + foreach (var category in categories) + { + catalogItems.Add(new CatalogItemManualDto() + { + Category = category, + ManualsWithoutFolder = await manualRepository.GetManualsWithoutFolderAsync(category.Id, cancellationToken), + Folders = await manualFolderRepository.GetTreeAsync(category.Id, cancellationToken) + }); + } + + return catalogItems; + } + + private async Task IsExistFolderAsync(ManualFolderDto folder, CancellationToken cancellationToken) + { + var existingFolder = await manualFolderRepository.GetOrDefaultAsync(folder.Name, folder.IdParent, + folder.IdCategory, + cancellationToken); + + return existingFolder is not null && folder.Id != existingFolder.Id; + } + + private async Task BuildFilePathAsync(int? idCategory, int? idFolder, string name, + CancellationToken cancellationToken) + { + if (idFolder.HasValue) + { + var folder = await manualFolderRepository.GetOrDefaultAsync(idFolder.Value, cancellationToken) + ?? throw new ArgumentInvalidException($"Папки с Id: {idFolder} не сущесвует", nameof(idFolder)); + + return fileStorageRepository.MakeFilePath(directoryFiles, Path.Combine(folder.IdCategory.ToString(), + folder.IdParent.ToString() ?? string.Empty, + folder.Id.ToString()), name); + } + + if (!idCategory.HasValue) + throw new ArgumentInvalidException("Не указан идентификатор категории", nameof(idCategory)); + + return fileStorageRepository.MakeFilePath(directoryFiles, idCategory.Value.ToString(), name); + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ManualController.cs b/AsbCloudWebApi/Controllers/ManualController.cs new file mode 100644 index 00000000..1a05655d --- /dev/null +++ b/AsbCloudWebApi/Controllers/ManualController.cs @@ -0,0 +1,120 @@ +using System.ComponentModel.DataAnnotations; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Repositories; +using AsbCloudApp.Services; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace AsbCloudWebApi.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class ManualController : ControllerBase +{ + private readonly IManualCatalogService manualCatalogService; + private readonly IUserRepository userRepository; + + public ManualController(IManualCatalogService manualCatalogService, + IUserRepository userRepository) + { + this.manualCatalogService = manualCatalogService; + this.userRepository = userRepository; + } + + /// + /// Сохранение файла + /// + /// Необязательный параметр. 30000 - АСУ ТП, 30001 - Технология бурения + /// Необязательный параметр. Id папки + /// Загружаемый файл + /// + /// + [HttpPost] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task SaveFileAsync( + [Range(minimum: 30000, maximum: 30001, ErrorMessage = "Категория файла недопустима. Допустимые: 30000, 30001")] + int? idCategory, + int? idFolder, + [Required] IFormFile file, + CancellationToken cancellationToken) + { + if(!CanUserAccess("Manual.edit")) + return Forbid(); + + using var fileStream = file.OpenReadStream(); + + var id = await manualCatalogService.SaveFileAsync(idCategory, idFolder, file.FileName, fileStream, cancellationToken); + + return Ok(id); + } + + /// + /// Получение файла + /// + /// Id инструкции + /// + /// + [HttpGet("{id:int}")] + [Permission] + [ProducesResponseType(typeof(PhysicalFileResult), StatusCodes.Status200OK, "application/octet-stream")] + [ProducesResponseType(StatusCodes.Status204NoContent)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task GetFileAsync(int id, CancellationToken cancellationToken) + { + if(!CanUserAccess("Manual.view")) + return Forbid(); + + var file = await manualCatalogService.GetFileAsync(id, cancellationToken); + + if (!file.HasValue) + return NoContent(); + + return File(file.Value.stream, "application/octet-stream", file.Value.fileName); + } + + /// + /// Удаление файла + /// + /// Id инструкции + /// + /// + [HttpDelete] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task DeleteFileAsync(int id, CancellationToken cancellationToken) + { + if(!CanUserAccess("Manual.edit")) + return Forbid(); + + return Ok(await manualCatalogService.DeleteFileAsync(id, cancellationToken)); + } + + /// + /// Получение каталога с инструкциями + /// + /// + /// + [HttpGet] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task GetCatalogAsync(CancellationToken cancellationToken) + { + if(!CanUserAccess("Manual.view")) + return Forbid(); + + return Ok(await manualCatalogService.GetCatalogAsync(cancellationToken)); + } + + private bool CanUserAccess(string permission) + { + var idUser = User.GetUserId(); + + return idUser.HasValue && userRepository.HasPermission(idUser.Value, permission); + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ManualFolderController.cs b/AsbCloudWebApi/Controllers/ManualFolderController.cs new file mode 100644 index 00000000..076abe3c --- /dev/null +++ b/AsbCloudWebApi/Controllers/ManualFolderController.cs @@ -0,0 +1,94 @@ +using System.ComponentModel.DataAnnotations; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Repositories; +using AsbCloudApp.Services; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +namespace AsbCloudWebApi.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class ManualFolderController : ControllerBase +{ + private readonly IManualCatalogService manualCatalogService; + private readonly IUserRepository userRepository; + + public ManualFolderController(IManualCatalogService manualCatalogService, + IUserRepository userRepository) + { + this.manualCatalogService = manualCatalogService; + this.userRepository = userRepository; + } + + /// + /// Создание папки + /// + /// Название + /// Необязательный параметр. Id родительской папки + /// Id категории. 30000 - АСУ ТП, 30001 - Технология бурения + /// + /// + [HttpPost] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task AddFolderAsync(string name, int? idParent, + [Required(ErrorMessage = "Обязательный параметр")] + [Range(minimum: 30000, maximum: 30001, ErrorMessage = "Категория файла недопустима. Допустимые: 30000, 30001")] + int idCategory, + CancellationToken cancellationToken) + { + if (!CanUserAccess()) + Forbid(); + + return Ok(await manualCatalogService.AddFolderAsync(name, idParent, idCategory, cancellationToken)); + } + + /// + /// Обновление папки + /// + /// + /// Новое название папки + /// + /// + [HttpPut] + [Permission] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken) + { + if (!CanUserAccess()) + Forbid(); + + await manualCatalogService.UpdateFolderAsync(id, name, cancellationToken); + + return Ok(); + } + + /// + /// Удаление папки + /// + /// + /// + /// + [HttpDelete] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task DeleteFolderAsync(int id, CancellationToken cancellationToken) + { + if (!CanUserAccess()) + Forbid(); + + return Ok(await manualCatalogService.DeleteFolderAsync(id, cancellationToken)); + } + + private bool CanUserAccess() + { + var idUser = User.GetUserId(); + + return idUser.HasValue && userRepository.HasPermission(idUser.Value, "Manual.edit"); + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/appsettings.json b/AsbCloudWebApi/appsettings.json index 683f7929..6801ff38 100644 --- a/AsbCloudWebApi/appsettings.json +++ b/AsbCloudWebApi/appsettings.json @@ -27,6 +27,7 @@ "supportMail": "support@digitaldrilling.ru" }, "DirectoryNameHelpPageFiles": "helpPages", + "DirectoryManualFiles": "manuals", "Urls": "http://0.0.0.0:5000" //;https://0.0.0.0:5001" //, // See https man: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0 //"Kestrel": { From 836aaa20f089863e32159236a2ff14f731a4d453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 10 Aug 2023 15:28:17 +0500 Subject: [PATCH 03/25] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20ProducesRespon?= =?UTF-8?q?seType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/Controllers/ManualController.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AsbCloudWebApi/Controllers/ManualController.cs b/AsbCloudWebApi/Controllers/ManualController.cs index 1a05655d..e43f973a 100644 --- a/AsbCloudWebApi/Controllers/ManualController.cs +++ b/AsbCloudWebApi/Controllers/ManualController.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; using AsbCloudApp.Repositories; using AsbCloudApp.Services; using Microsoft.AspNetCore.Http; @@ -101,7 +103,7 @@ public class ManualController : ControllerBase /// [HttpGet] [Permission] - [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetCatalogAsync(CancellationToken cancellationToken) { From 20aad0eb116c4167254d56c883174932f270e635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Thu, 10 Aug 2023 15:28:17 +0500 Subject: [PATCH 04/25] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudWebApi/Controllers/ManualController.cs | 4 +++- AsbCloudWebApi/Controllers/ManualFolderController.cs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AsbCloudWebApi/Controllers/ManualController.cs b/AsbCloudWebApi/Controllers/ManualController.cs index 1a05655d..e43f973a 100644 --- a/AsbCloudWebApi/Controllers/ManualController.cs +++ b/AsbCloudWebApi/Controllers/ManualController.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; using AsbCloudApp.Repositories; using AsbCloudApp.Services; using Microsoft.AspNetCore.Http; @@ -101,7 +103,7 @@ public class ManualController : ControllerBase /// [HttpGet] [Permission] - [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetCatalogAsync(CancellationToken cancellationToken) { diff --git a/AsbCloudWebApi/Controllers/ManualFolderController.cs b/AsbCloudWebApi/Controllers/ManualFolderController.cs index 076abe3c..fa97aef7 100644 --- a/AsbCloudWebApi/Controllers/ManualFolderController.cs +++ b/AsbCloudWebApi/Controllers/ManualFolderController.cs @@ -41,7 +41,7 @@ public class ManualFolderController : ControllerBase CancellationToken cancellationToken) { if (!CanUserAccess()) - Forbid(); + return Forbid(); return Ok(await manualCatalogService.AddFolderAsync(name, idParent, idCategory, cancellationToken)); } @@ -60,7 +60,7 @@ public class ManualFolderController : ControllerBase public async Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken) { if (!CanUserAccess()) - Forbid(); + return Forbid(); await manualCatalogService.UpdateFolderAsync(id, name, cancellationToken); @@ -80,7 +80,7 @@ public class ManualFolderController : ControllerBase public async Task DeleteFolderAsync(int id, CancellationToken cancellationToken) { if (!CanUserAccess()) - Forbid(); + return Forbid(); return Ok(await manualCatalogService.DeleteFolderAsync(id, cancellationToken)); } From c6f56040c01ce98dab482d6979175deeba09362f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Tue, 15 Aug 2023 17:06:10 +0500 Subject: [PATCH 05/25] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B8=D0=BB=20=D0=BE=D1=82=D1=81=D0=BB=D0=B5=D0=B6=D0=B8=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B2=D0=BE=D0=BC=20=D0=B8=D0=B7=D0=B2=D0=BB=D0=B5=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure/Repository/ManualFolderRepository.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs b/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs index a567195d..456dca13 100644 --- a/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs +++ b/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs @@ -34,6 +34,7 @@ public class ManualFolderRepository : CrudRepositoryBase m.Name == name && m.IdCategory == idCategory && m.IdParent == idParent, cancellationToken); From 5897315b5acfc21bd3a546596c6e0904d223f4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 21 Aug 2023 12:11:32 +0500 Subject: [PATCH 06/25] =?UTF-8?q?=D0=A0=D0=9A=D0=A2=20=D0=BE=D1=82=D1=87?= =?UTF-8?q?=D1=91=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Фикс бага с выгрузкой файла. Добавил contentType 2. Обновил шаблон --- .../ProcessMapReportMakerService.cs | 2 +- .../ProcessMap/ProcessMapReportTemplate.xlsx | Bin 7850 -> 11880 bytes .../Controllers/ProcessMapController.cs | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs index b44d7255..4c69aac3 100644 --- a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs @@ -13,7 +13,7 @@ namespace AsbCloudInfrastructure.Services.ProcessMap public class ProcessMapReportMakerService : IProcessMapReportMakerService { const int firstColumn = 2; - const int lastColumn = 49; + const int lastColumn = 42; const int headerRowsCount = 5; diff --git a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportTemplate.xlsx b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportTemplate.xlsx index dfdc742266c743218af4f156f99285faa9d0f09d..dff707eb4b1baac2a92f67696cc47ea5fa4d4c0f 100644 GIT binary patch literal 11880 zcmeHtg;!k3_H{#o1&79iOK>N+ThQRao#2hT28RxkCb$Q82;KwsH-;)~%|2N=|JRg-4Hp07L*X005u_n10W&GK2#F;vNG4xBz5$ zJxK?Us|Co_NW;s~!o`5q)83Ba!(({*YykYj`~SQC54S+s`$6SSb}Z?O7q^mYEb?<7 z#gKXSgL-ioRYlsn;(JQW^fIlj?=vHBuq1NuYhE6qZsbz8bGGZ${e38J_jG107 z?8TlYv=ZGS{=V7IOUhac*n9)U<5;VsxDz(k3_gY@t1NPl!BjqT`0j@JDwNvl45n&L z&eur_tuFM9TrguZ_yzW`xE750;YGyeR$ekCZsL!{QKu!kJ#n^7ZNB=x-fi?T;8T@r z=yNH2seqP2P|H8ihM!xo!`({slK?S2oYmcQb?}6vo+t8DC39SBhN*cfL{iVKb zL7%;^>w3Z8j}o^7IPVYvfcyJL0F}SFWt}EF_2~oG6d$|}^}#KToGt8J*jRu5|IZ!& z5BuO>s$K?BdfCa27IyIBHoWfwHXny2q2M9@qM1^|KTvKCvo1Q9hGf3&*;6bH;^0TJ z0WJQw1GDo&(K~&V=PTT0U>u+zb-hP*>V@QJM0X0o+2ynMep7c z%UIf2l%vqUNG&sdBvp+y!upCB1vmd`7`|}I8{Hlyodwg&3OJaA`hIy>RReGKPW(t( zz*J(vHo9m8zvA9l3SOU!spWKqZ=W6I*%h&-x)r~5m1(B40F{@Kxn28-R9YME4__AL z^gcBzZk$Wb5!qha?6UyfTJEF446iO;l+Mz=!~P&JdC|hd4E0YZc_Z>Z>ExkBpbt($ z3_ynSv}60-Pdpr)ZA~2_k>-wvJ?+Xy zwWqm@iQHeyFiS_t<$tX9a0wWQ&AMoV{cr$13?6b zp_8FU$fo<{WI?hBxHx+|yQTZ67^yC}O(Kv!=1d^p#w9&1QFv|vmDFj|SQxj>FuNP4 zjmuZkfd|eE)~*F!hp6wB2h}z-P^2=vUcYaWoIOX(3i2W!Jt0Do6GHa_jBZU(GF^U_ zK1V+Obo*M#YuNU4?ls!_(^3Vp5*}gSFjtE3K3Vbr28hf0hm>Z`gJoBVn*oNl*<8UT1#E=bOP4b!=)6*{q?^%Qu~|y_KmQ`t+r!Q?@b&QNoHf{$z%IAdE={YiL-^dx~sD_$kOHKU>Blkpg^LE<;Qj^s?Q1> zgFx#|86aht`TOxIMf*1pJ04^A@p;Xe24dTM`XWvGi02VM;A~TuY+O$WHtupWo0_GE z<|mRu=dJ{}T!!;FZ;G2}wB{)6E)6wBQj*_yoZ0xdEVF2=H($Mq%~HUYiFxIb=sQwA zFan~t+`qYCG$BOk@;1?Al~J|r`Peb@Vb-++rET52%J(q10C(B4$~d&V-EC+2!>-H_ z?e6y48dvEyw-AHP-A4k=_0wA5pyBH3#~Ui2TF!xp?-m?!re{tqog;-~SRzrA?LHe~K z&dMWP+3HnH%!YmGawPw=w{yl5+!yEh)pDW$y`D>TS%)Ibimr)4*`r|pu~vH6qEOe< zWKufYn57sZQ#Z@$0iI>=FI*})=qm|^)Vg)ib;ko7Y;@uDLr$Tn0^S-bD}-TbHB2p* zn=7Ha*a3qzrh=tk{8ao=54i(4&n3|9%yq}|XPCiAh@T$KOSJYV3Zy!3?aJGKBvV6X z?hJiiY->)~tz@u~dhO3bscd3`tkOrwGCwar9Rk9~_ht?3hsRgh44n2xpb?8heGV6= zF+wxikxzMAks=J5X-me=RuY``^%g{Pi(^->n|XdM>G&B%KDq%HogwV}Oq%F5q_tDY zZ|KyzaUIGtx)vVjKmr_M&bcc};@?)LBo;a5G8rshzFdt82UV@elRO#sP<&g^vJf3O zEa*GT?r|<`NqgtBGG4+PVPVQeg4-~6+#o@`yIT2hQb!TP!A%|VRP1J~Sf|H}VNN(y7?u6>qA$LZ zZJ}GYYS4RLVZH0Crve7eO!L-cy$-K=v^(SY;`*DR(Uyby7R`zx_o?+qmfF?OuTvxE zmPj>)HP32-Eisp_7;f*i2Qb{DB!ZMuUgFvkj6%^3FjrbwTL^g*ob-x&Hu;#D1{i&qBMUzHVjhxG5n-;{OB|IXZn-vp zph_SyOW}uQTKa67869x~{mMNyndT5QGpI?(lzyQ)!%%`HeP5VGeI#p`Q`bnU4o7^p9bMAd$+e`aQEXsWi2 zq|J3AAdM|c{nP{$>2QS66E-?eCv~!mzx|8@96kqCDx;&4Nph8YsgS2=6&!+I~@}}tXC2K({30p3TY>u1-L8yk?CEd!K{=R+du~$y^J(OeA zie{z4?Qc`eD`?pbX}4Yl>VGj={4lN}OP9Wv>j+`rLXSxoHvBT93OTg^C&z*=h zYnG_3r4;(p%<_eGT@j%ZHUAg%^Bd|>yeaxaT=cJkF}Mfp!{@-P4c@B&vP}{cbYA(m z_tlW(05Q)h(rgaqE3k8}fT;_N`gOD!q9EKfv&ZOVGN>slIYjS>Vty1KYm#L`{2URp)Kxwb@7mG!q~xt|*nJ1^ zdMed!VV@;9GsPMkf z!^hmEdf`%E0TaHcH`0ve^B>!9KU%jJdF{AWg6c!9YJBeo6K>H!9bw2zfhk67O2N3} zw|AM2qcnA}VP*2gdLU};9=AG#De(`)rCkh~7ib9L94xzvTuR!X% z$-zdzQAE1%Lma|8h3f)W5g|IZ50)yvM}x24}6 z@gQhc=Fl+vUhI%H9w;phltRF^fQK8SDl*7^6{Rl^j?;gmPpcM{?$alFO76Xvb8mdF zYMHpwIaaaH2VxS;$Dp$0tIU|r7=25})}T|;@=RJz=lk|#O0g|XthVAwe&M|@(Wwkn z>zF;Z^Zk0)xJTZEk#gHTNbT4_o>eQv5nX#Nzp#?eC>A~UtriXHAXhydzcG%MIc0dS zsrCEapb)1>DIJ?rB^N7m%AvEUPCoGWP8w9ON17X(>9oL_tGN1rM^I9Q#pvZ3r=@h` z3vpOE4{~m5gD0P9)@YG2t->Wy6_+;TYs6FAZQ=^J^n&=1^-mL2_5DqSn1MX?t zRy4KWR}BXlEk0dRK-^KYo_J>=Qo*diB1eB7TXYX7Fc9wUcwfcItwdtPzl9G_e1^r9 z4)g+G&fMKOH-uUBQ+{G{>GtvX)WY160rU9&Qsv|Oo}%utgRqXkLIlHO zmljote)yB0X^asUgpU#PyzPz0k5Dir>F_hMPGiRwYBZKcLsD;9{2GpDB_Jo)VKVdt zs=v%@X{#^Z!@sw(O;fN8SvQHA%`4ba>v)4`nN)a!mo9v^fX17?d?!t1-nQw#*(`yS z(~(gblvI#)& z4yZkHU8UZS8*=55v6f8eIev&CZ)_yqQ%COY>Nd}0%eOElVDn0w)?4ExN4o5z0#lW< z`HB+d^s0mWANy3*Mi|e($T7R>v7QKZ{J1X4fpLbd<;L1I7*3^c1Yaw%Qs3W#KY2%2 z7IN0qz?KEM$d>Zc;t+704X&)Yao|1aRjQ|urtlA|P5ZuWuVQ3DcI+bfbD zR0y$dzm6Z^#{9y>`|%m`K}`)x^P?MqZ5qZPr0eab*FEtS3wM<;jDU4l$Pc+!c_U^? z^VZ!b#hqkZRq?E4CEXZL!{XTUhNz6^tfqq6M{MUB^!aI zT&~O1i?byLrn41Hv7Y0#_DzV-^_|ha%kapsA~h9%3T!mw_ejt zD;UUpLS0k1LRVARp>a-#bk&Cy40@sX)y7}F0}H*iPDxz&$JEI*s)s+>sSmZw^Br`% zl~aAo=Lh_c0-k3fRZR2#c$wk!;}zO&ch-~aHhc6Qizn1SOtaE2`p-XvdUE%XZ39xKH|RXuhc{oycpun7Rr;1*VgiiKgAfU^kb7^jV&Q|N9@oVw$4+5BZJ7V@ z1^x+U@c_A^d%x+O_;v1_KY%Y9jBOuTQ*}M}z10tTBa#}O*^&aww9*L1?P`|0o$b5cno>{5FeLK_kIpyIgZm>)p9|}AYo|1tCTZf=;7q@? z%@a^*9pOCPxMy|Za6A!Azi^s+809r@dAE?l3e&W;fHnW_u3ovdQ0BC}B<~Fw>Gs)~ z=lj#~(RuEab$Pi&#g+6+Hc;=0bdJ5iHJRHu-;FEpz4d$L&AgRWPtM^s`TTkwQa7W; zFJsJid^uhL)*dUWIePE~{sLqc+f*&XQ!fk@u-9D{?Dy+mjNdK5l3!CK&JRF#GxzJ8 zzb{Qp*XiB(I7fCkIkyFVOz0(VF^9Z8UW;-csBg{Ro*?NCnm?y&N3CANr3E&hawv(S zSX36z3ZM(cT1K9Ar;Y3TxcAn#?oe&_jbC{=XOPq3?gX@2=pE6M2Pm@^%Z}V7Z+Hoi z#yEgnta17KD{4;lIOEf4c{oUO+AQN4=QXxf1Y#pDRw|u4G=S>mZtB6vINeJnxeDg4 zvW$12-Z0AfH|pq&aA%+dg}3XbO|ki-hOZ|zok^g3ND^S zYGXhgDk6pB!bV%JXI|n{bH3C);IUM%BF)EDQ@+<7uRi4Bth@x@`cwiPP+P#arQeiF zNatCs%E97wh_IyqJbUtII|NCjfQ*X&Hdbj~l z-u>)7r2w~sa&khSW^GR03`?{H)%EfpNnvq=bu}zZbFE>jHDG5SB8=zn>l*dh z+0~?PB)M7riviHz)3q?U`Q%fRVE3H#a<44g#)8+v+|LK`*w&h+`jdIBS%w0(C%WQ3 zlKVf@Gqs?)>$dwW*yx$3BORRr31HPeoypR}GUYl+Db?X4hN$iySNGBs7E-%-W#j?8 zNz&xhw_poGENrb%AtK8gC$fVBi|rO^e#6IR^4PAXRvxoz;b_@0XxUL9BF(IbB3+XG z9dMnhF@6_D2rKpg1LpZ2g2lkd&8|=Rh$$Km|~ zo%iXDguL~)v;vlQeEPTV-$lavN-}TveLc^3Q;bY2k$^_q9T=`S_6jHJsdO4O9sg^{D@ErI zJnGzRyf%d!rxx+1Me20?W)K%TBKCfS_)jJf1v;-m8cDjN@FBI@}=oOu1L!g13#jZqb4daC=BrweCg}xKviMAI7XXXwTXJ zc$EfNzhZ2HjY0GXLvJQjX#-#_`7s z9(mP`pV@ik-Sn4ItviO|jZS~sd8GgkGSS{mXto-3e(QhsEl&wdoB(n!VfdQmEEL`y zUm$a~rK+8s6B$Zajv|RhfF~0{Dbv6yp@<}j2CplP%z|TtRG6V(s>?| zU0x5#Gt9*C7H#E=A!lgP;C8ElvPWZjMMHW;TRNyJ9n_c(s!jjiyzaWlR(K=MlM}#1 zUeqhwkfS7wPsUwa+$+4V*rR<$SkZzK>y9Bf%aWB?DvZ%$olEwz4s(T}z4&C*(7M*- zNdL%7E%toyd5FM%IQ^J^IMu$TJsQkL2xu)T@$Q@iYF$pnQqG!=i2c=Dyhuij36Mh! zH&jek(k+X?r2*z5wUES1fq4MDEMUGhm6*ZDt5PFjA-DJ&q9GrVEXW7o-b>QUezd!l zr`6L#vCQdRLlYGVQ#sGxljIL{MqYoBh(5eRy}~%Dv&F%GpwTS+HQ&J z16Y5<)I4BDN*$w@Ft9!U{8-YH9n_+eGWl3a#$fR!%0ukO$P$m=!PB{YDPhYVc3~9m z2kZcZ%8vfbFMi19Vr(J$HNWT~|D@QzpSJZnzFgAz?9ciMZ2VS>_nF_@OI8n5|1@?6 zGgm*7DssQ1#a8Lf%GX}~qrY}a`wK8e3TWVWE_Z>p|7}@6p6T~w86P!!?Mlev>2f ziNHRA%J}n%ulwe*%f|B$#PmhBT(?UplQ0Dht~+|yv00w@McY!iiSgLX>LrXu7JlXJ zrx*tH)P(Zn@b<2J{(e5}j?^|DXJona&cTed#U=4zgEwRUSaj#Z0tYW_Zj9tI#Q8;T z{Vw-VKqaJr_R?F^0SV1F0Pbo z?_%qAp5++AC2@Lq9CsIEyq)=2<*1~5rpeRwM}*h}IwmgF9-kxLcUJWp_O+Q}Hd300 zqSNF^;dnlt^r!p4rPfchjcGy;pyfa_ZZC+~4qCCa4>Dc>6UeX2Te}Ke35_?++tx$W zowP)yg;8UBS63RD?bq%Y?wYP{Ti)v03VPGR9VyEtx)KL^TwW!=JUYC=?BmYgq#!T{ zywhJIVF?CTyo4pSPT`aogs4yuboXgtS$q{)uTv^YlQJBpFr8TwJ|~_C$0ZoBnq9s} zU8Q;?v~%>xaR$Ht>1I-twYp1oiQS_##bynEW>No{1?q*kf?{iRTqx}Up*@ko58~$5 zCeayA+AmFYQ;~zIwQli|2Shp?V}{slfh(sJdv|g7xR~MBvlYoag#%IzMhOq>;EsfqYRutolO!AxFR7l_!M{X%!`D-~kd z+OP^!8nQIbnoO0CZH1qN2*k2Wl#zj_K4fiT_WQ6gx1d7xiG67ehOf%x`@H0Jnn%?3 z$1Pt^twyw!2djTyMm1cm$_)D|hbSWHV zVl6CGx8&>E!B;wuF<5SP(zVo#(L(Pv#%7I4zO>rYTFLZMfCtOOL_9+UGr0sn)ACQy z2}Y3|LNMC5oZ2hI^4=y%T(#?jgE44yvk=ah3WT0bXCTMTCFS87q69mErASg+Ct0&M z*QC=l%5urXzRb9Phz0*XM#I6gJZJ*`UDNwVKmKw57lp5i!ru-2U48fm z@aH}0!CC&IMf?@`cSY7;fj7^8u&F*|EGa6yx%|Jzj6Ctp}$6z{)7sW{I}}=h%xq wpEdvhRyqLSAJg`)@V}3Ze}!Mu{{{Y^ky1qg;h}c{fF}>Xz@G{grk_v$4=zteQ~&?~ literal 7850 zcmbVRWmH_tvc_Epm*CFeE+M!>aCdhN!6CT2yABM52?T;WB)CIxPtcH%;1C8LoO9Pr zZr;1+$E#Vp_w2QHRqw8l1x7|~PzUBWLVx&g>S68V$-(|OLQ;EG z`#CWpkNsm=F8S8PQA#S>mF3&1c`176T*w+@%HD^aTu9>qFcRwf6WxP??<_#;$}Yfl zP6j2D7;XI+xK0Mkz{>ZdckaF%{NtrT1Gs{68m>|-9!bv?&&IYSM#}wPBrBrrpQ(ZoAzZ_Cj zE(@p>>;Pa|N22+zTL-p|ZXBm$kzjDjtKeo)?|vI1oNZ2|hNh1mWM|{GweEVjS)3t_ zcL2gUZD07S&<4sYe=8z*!ego!XHa-Mx{If#gp3lA%bWY{K?xIZFfeNWRZZ9rZ}>QI zc)NNyTDZD8vimqYC1@(StZ?G2UE;%CHi_NM@hc-&IZ?yjgcUG2Dw68gFl$g9EUHe+ z_$Qc@56ZjD;aY>3mt}}j1u46HU2S-~1$Fw`k)2yo)5D>!e5iObJX=AZXH{nMa3=K_ zJQ>mv6jjZJK5T!yEk0w{cG%krv}a<5Ky15Q>j5k_H`PcnDUt`V`n>1!0*y$Sd4L|B zzNApIBi(qV8Je-Pdoyt9CJ9ixsaAZMP&&+va49c!AriQYNaVJHcA{t8ZA&ndm@^dJ z?Nb3&_h%k``BS*pNfC_!qj*Z=iCB3NbptpWRiYzbAEmOlPU#w6Qh)3{_r4Q(Gdb3- zcL&##?TndQ35C)346}+TiZ$y+uc_5X8-iu{RmxoS9EA6NB#s(AVd}*#Fv-XM<}>JN zxD7KHHe7dV47-t;nW`X|5N)g9=0Ykn%+%wExG>O0gB4Md>fhs+5D|Jy6uUasR?BEC zMHwu57jScN_S9*y^r!IPwu?4U_PBMcN_@s|fUCInbSUJdJXo+F*A1QY)Uq*ah{nmz zo@u>`oO<3o-e)g<54GScJ<4dZ{WFx%I*G`#K*yS&g_jCUqW6uOp_Qb|Y#!(`9i6-B z0lrTY2Yy(QpO=ohO`-RH1Yg>4lAot)r<(oTwiZ?C+V&8dBN20d-J_QfJVF{fj*1*m zZsj#5ZX~QKR?+AxH-1cL`2+pYlj6>1KVUw1kr(_wc@pN|p5*z$*U8%R(T~0wOef|E z;sab zJJ}ia$uZBWBOq`n<`nSm=#+vngRHMH?F60<$Mx-GaYUQA0VrakO)So)qTdM z0c*iRaQD$CD-Y_Gyag@%ySRmw~%0FAzuFOO}}7j_#?P zxLngKGNe>h-sIE3(mlaF#D{VdX~`xoP=0A4C000u=U;Jvz26+?qr<43l%3o}u_sQZ zGYW?mB4|8HR@v3{l(4>{io8Ww`Qx`|2DaoBjI-BJSbADPZD4)N%G2ZZ?%?(=b#s1r zIk1@at?JnE_&m}R8%KLl3;saj`YPH)$WnFMQ7`7Fs(g<;vHZ}1&*j86@scN1(LIEz zfROpK#6VDjdn274s}*TtLxC{54impJO6F)BQd#u=P?oh@wY?ae1!Ls_!`c*+C$>uN z(3FFPwyC^2Kzc|H@ygL(V<1f$Yo+})48-NL1qdI);Z=TvM2IN#CI^k?isEBrvvykH z0cJ1B_;m3W@&tmSbR(0_?neMWX2FwBS9ur^Bs(1rNe4^S zV|c07wQJtyt1B~-B8o8T`LM-amsxOVzjeeNBSUOJfUvKgpDZvPPfN!Df0468!Yb?eh*Oy$UpW-rz}N868|O7*n~N zcEu(srbla|)f<*;)N}D&(U?EX2AbR5#htx`1U5dgg#QGtN+R2CMO02f|CtAyUke%D zH~4J_6FX{i>{9QB{P#89fZ>M2Hh9HPH<`A1iyeb@`$EpJtzX`ni#~_uJRPwewX`(r zXKG(+s1r-tW2>Rq;gM@FC)A0r&wKi|QmjeTMwtowG%d2^7&$~my;IJ1U+60Vsb6T% zsnfL6Dt=#T;$JDw)6UxZg(t^f zH?GGR^}%q|<4_*3HmQpP^y9+>~2E3tU zu(&I>6=>KGuDiFZKa;e|ARmi&_BAg{)6c17(X6y8HhA_70_lVIdYZN*Cj-)ACIoky zMcQvr64cs4DY0V_Cl{QhnzL1sVkhTV?^f?LzofKobP#}oVBr?m)!lb~sx}y15VE$- zcLF@Yn3?pR3vJk0-vXCBjjG9diyO5WG88*I=2hB>W$oI2zBd~MwH6yUE!I?hjgl~O zI1rn<)T#LNVY)EBbDQMN9g1ecbve^ZDJ8&j^#~tF&n@mGHt0+!gw|mjh&>u5avI<< zd{3xQ)vHCRY{CpcHsrX-*)j0$cFw1yZh~j^vNfo(Wmvc|0pMz+;)J2(M@nN^%sv09&RdRWfLah$hp zLKZD4iCuteaqvi+J$wlz_L|~>-gqH+7mMces5MBu4$E#z=1Ueme8;*y?($hdfSHBk zin&tsBGLo*vIJL&)PvKTM12LAF!u9=9Z$66#8$35nE0evep5AcN$#l1eYMeTJT^kY z)l2;Cg^w0nB9>ncB%950NE_#NtT{VO>u+MZB>(1|v$MuQNIdPiQ*#7~+TqK;onPMw&Gt=|M#B=|>hHUsdtvI@Y;>XL7RFe~>3=oUq%v8A zs1Wmvj)tMc|2Ba5O>&QFHm%yLcm;zKdwU|$HLmW)ut7oMFR(XLZ{Cey2N=^NsUE2( zzH&hUS5c3AOD^1(c=`0ERL*O`lFARF29yixS^+MD_GiS|X{UE!TIoJ)w2{*gl|11sq2w*0<}IP+EurTvVSM*O^JriB z9J4^3^%%&lE&Vzy#D%YI#j-dmL<|XuSP(VD&mb!~vtWQdhRSS{99{~;$ZQh;Pm2-H z4axrvU{WwA*JpUXfs2seY9{HC1HE^W%M58U+%1L3o@czCIU zZR(L7{7kr{qdI6-pgEME{wvLef~+yxki7Un%UUBVY!1qhmbeX^2OE_D9QSi-5kPSl zHS9+g(ag?T6tErw=alwa6tm)_5LhHt$>J1t8b24o1Y-bhPmd5%Byme}xdb+4md_Xp zyd{Q_xfzW@SQCVqf~UWS56Oj-Gpk&}aDzy6mler{tJogS1E>%#FqO#3au^qO#?(=H zVNnFh4j(eVp~iPcUZ%QO8i}*QCw!x6t~Dp2NdHt>jXVdBFndc(Rs9mAEiWz$$DOIH z@*#-;a0L^}V&;UPQ9+r>CAw zRO`hd0A(=vROPlqg-glW=|*DyrEAzbvG4rYnW{P1he93iea+{uc zgle)z5PZCLC*x>!J#Mz8;^YPy(wn`xE?DYv@dAI<6gY>zMn1gRmE=wDr+q@y=I<(L z!79kC&di5(b(yxRCbF$mBqVn$s+Pc;N{Isz*$tZ-0>0k#8Q||p<$C62teTkSlpk6q zGFOnhVShCt?qfnD2*n}iiRoUVG-lY?;UM&hP9giuwOIDlP~9J)0TJSya}7XWK((P8+23~TJ@5r z=`stV;!bo^j$C1#=uS~>cjw*Louq{gle;H32;cTbHyM2(jUy|`qJHv6_epmr zNekT_cQ+?LM=3e({h(h)k0W{nv1Vk140g^8daOP4YM_*l)tfDcnSl=~42&E9KUHt| z|2kIMnR{4UX}<8Vcd`BJblIpgt%|3P6L`t$!arSH1q4$gt(=(6F#_?y$fa%JrU85psQ88L5RI5oS+|_$`$bT2UWvs*{cZ9J zz!4FtIpo`1n;mYwJl;+)SHZ}6ev9Lq!HL%OMt`&dSk#53eGSlXZbf2lvtwRvjmveF zt?etvFg>67ZfhFb#p`px2j489jE-`Y@fHS&x}!}Ks-g~VM*KW2IPL6#2B?DG4 z$FBYh|0A+d8r?C*k)0|5A9l~5qgDRe5M7}=&n+gHJ$~giBo{-u7h`Mm)nE8-tnLc)qiRSFakuwPR%KMh zv)%U#tN8k7$FV4?mub^y=DlS=3oGvnkF`ySF#DStL{wiwr!Gm$)T9Pijw`<&)m;TH z4@7id{nh>{+Rbsad1(ExWBk)TCH;G!{@rr@y`A`X`!z+y@vrtPltA|Kg95T;ykKX% zL@o3Rc0hf5>OFtzeB*r(JDDMx_0d$?)WT_({P`ho!eR7#DGa3QQiO=!4=+(VL!jTj zZjtDWm#%Nx(I?eW0$z9EExsaB;4o-771U?9=t~wcE+1A@ty&mv3;U|hF?ymfn-4oq zpb0UAf9Jxg*6!JNUuU_1iDg>mU&J|ti8}5Lbmtk(lSSH* z+OQ%Ges9!|rZyDEe(0{KD-gAyqg%Sulja;5NbUMs0Ni5)d;a~}Z{}g$^#9mm#eI0g z%GFZM!`01`!_w8m`tjfysG;)wK_Q)|tktXSbOpqk@4Nt1s>)Q02-}1j-U!QdiXFAV z&zB)Pj@vffmnTkxg<~(hGMsvloyXI^!_uM>TcbPcXx1C8mRqJGq*o+o@Nv@nqgZ7Y zsifnL__bWlhsa@4$H+3E>{NWloJLg)^9wVGl+enS&zxTXSRU%mDV$U5it`M}zC%in zkX9h;pF2W8m z0lFArz!`T*_qsr2)Z$IRn~dh(%291Tp#j@ z(4$+GG80lBl?&D3-V`;FtSV_)l}p0YTd)aye^=z0U9UdEPIzlnr|fp;JTXxWIWjNH z3mdy`fh_N-te8V@u+Xr1&K2U-EfJAh(C>}x?@%8tXB|<$?+*(D^Wz^ahx5DT%-!4` z4OfuzFCalwhQQr8%?8A#nTv|*E*UCCvRa)iXsDJatwOxAlICo&l9TUrKYzJ`W%zA? zdZiCPzJZO!Bb2*thS_p~&F@R04d#d>zD`W9zTGqhoWTj%g|HB|CNECCbX|!|9x)W| z6O{mGY%=2#gG{?UJ{M?~R0NU`F2~p{SBI-9$%4_2q7#yP&4W`A9p`+@p(W&-%~8|V z`CN2Dm>5b$;}*$bzE?^t%mc?^mlN(eLeW7PkI%Ih{w!}2)g+OjWnwgc_jJYEGUF#I zR8I3;JIA>3%szo58F!Kltr%U!UK`K&OFa|ml6*Bj2;YhgpZZeKF0ytUYvT2+?e}eV z#)BthcMce)-zI`#AN5I`a&QKC&}YZP_20n;yx;X{>E-#t)%h=#PP|3y)6N-ZY~KFWx}{w!d63qD71zhK&PKISN(cJAf7^HZik=EZJ#gTr~>aHFy&z`f`r8 zVbg@QKB_N8;9b)M2wnd;{bHb6igvJgT;{+fAl zoI|IkP5(|SK~Mk3Sf{Oxg-G5TuZ)@=Wb5(l`2A!$v+#@&e9IH=VENkN7u-X;WXROL zMtB3|@zZOZgwm+F$PQ14<3GKu1U%GLpd3j^;yyGiJalzD=mbwNLDzJ^jz_#=<+wgRXi zdJgGRo1$(cim$+|%Qae_)`{PxR<&?$Dg-Km_d9SA=7D8}af>&UdE&!QhxYb=e)r?yTnX+K80-Fq4Hq&=Au#7{94eZ@mPu_8 z$luj?jY?@%;|pRedbHEzI!%}DgYV5DKH3Qu4j<+hD)>7P_J|7pC;f&I{>k_|?(v9| z{UXMPss2FC{$&2WH~9#S{37>8NL3n=-M_4mT~v3dE6&`|z8@BeCL{wd}6wEb8_ z|DvIXjP&>cf0opLO87m!J*M|xNq*!06^;HB@VjgMrvRr1rTib;UQG!R>2Vgchu^D* K{DM#Z`1C(XPNk{< diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index b2d97a71..bd9e824f 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -110,7 +110,7 @@ namespace AsbCloudWebApi.Controllers return NoContent(); var fileName = $"РТК по скважине {well.Caption} куст {well.Cluster}.xlsx"; - return File(stream, fileName); + return File(stream, "application/octet-stream", fileName); } return NoContent(); From 2b265bf47f6ed7f7c90cd78f07aad2c464754ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 21 Aug 2023 14:51:46 +0500 Subject: [PATCH 07/25] =?UTF-8?q?=D0=9F=D0=BB=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D1=82=D1=80=D0=B0=D0=B5=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Поправил шаблон 2. Поправил импорт/экспорт траекторий --- .../PlannedTrajectoryImportService.cs | 45 +++--------------- .../Trajectory/PlannedTrajectoryTemplate.xlsx | Bin 7576 -> 11387 bytes 2 files changed, 7 insertions(+), 38 deletions(-) diff --git a/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs b/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs index d319492f..802de787 100644 --- a/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs +++ b/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryImportService.cs @@ -30,16 +30,8 @@ namespace AsbCloudInfrastructure.Services.Trajectory private const int ColumnAzimuthGeo = 3; private const int ColumnAzimuthMagnetic = 4; private const int ColumnVerticalDepth = 5; - private const int ColumnAbsoluteMark = 6; - private const int ColumnNorthOrifice = 7; - private const int ColumnEastOrifice = 8; - private const int ColumnEastCartographic = 9; - private const int ColumnNorthCartographic = 10; - private const int ColumnSpatialIntensity = 11; - private const int ColumnAngleIntensity = 12; - private const int ColumnAzimuthIntensity = 13; - private const int ColumnOrificeOffset = 14; - private const int ColumnComment = 15; + private const int ColumnRadius = 6; + private const int ColumnComment = 7; public PlannedTrajectoryImportService(IWellService wellService, ITrajectoryPlanRepository plannedTrajectoryService) { @@ -107,15 +99,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory row.Cell(ColumnAzimuthGeo).Value = trajectory.AzimuthGeo; row.Cell(ColumnAzimuthMagnetic).Value = trajectory.AzimuthMagnetic; row.Cell(ColumnVerticalDepth).Value = trajectory.VerticalDepth; - row.Cell(ColumnAbsoluteMark).Value = trajectory.AbsoluteMark; - row.Cell(ColumnNorthOrifice).Value = trajectory.NorthOrifice; - row.Cell(ColumnEastOrifice).Value = trajectory.EastOrifice; - row.Cell(ColumnEastCartographic).Value = trajectory.EastCartographic; - row.Cell(ColumnNorthCartographic).Value = trajectory.NorthCartographic; - row.Cell(ColumnSpatialIntensity).Value = trajectory.SpatialIntensity; - row.Cell(ColumnAngleIntensity).Value = trajectory.AngleIntensity; - row.Cell(ColumnAzimuthIntensity).Value = trajectory.AzimuthIntensity; - row.Cell(ColumnOrificeOffset).Value = trajectory.OrificeOffset; + row.Cell(ColumnRadius).Value = trajectory.Radius; row.Cell(ColumnComment).Value = trajectory.Comment; } @@ -158,7 +142,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory private IEnumerable ParseSheet(IXLWorksheet sheet) { - if (sheet.RangeUsed().RangeAddress.LastAddress.ColumnNumber < 15) + if (sheet.RangeUsed().RangeAddress.LastAddress.ColumnNumber < 7) throw new FileFormatException($"Лист {sheet.Name} содержит меньшее количество столбцов."); var count = sheet.RowsUsed().Count() - headerRowsCount; @@ -194,15 +178,7 @@ namespace AsbCloudInfrastructure.Services.Trajectory var _azimuthGeo = row.Cell(ColumnAzimuthGeo).Value; var _azimuthMagnetic = row.Cell(ColumnAzimuthMagnetic).Value; var _verticalDepth = row.Cell(ColumnVerticalDepth).Value; - var _absoluteMark = row.Cell(ColumnAbsoluteMark).Value; - var _northOrifice = row.Cell(ColumnNorthOrifice).Value; - var _eastOrifice = row.Cell(ColumnEastOrifice).Value; - var _eastCartographic = row.Cell(ColumnEastCartographic).Value; - var _northCartographic = row.Cell(ColumnNorthCartographic).Value; - var _spatialIntensity = row.Cell(ColumnSpatialIntensity).Value; - var _angleIntensity = row.Cell(ColumnAngleIntensity).Value; - var _azimuthIntensity = row.Cell(ColumnAzimuthIntensity).Value; - var _orificeOffset = row.Cell(ColumnOrificeOffset).Value; + var _radius = row.Cell(ColumnRadius).Value; var _comment = row.Cell(ColumnComment).Value; var trajectoryRow = new TrajectoryGeoPlanDto(); @@ -219,15 +195,8 @@ namespace AsbCloudInfrastructure.Services.Trajectory trajectoryRow.AzimuthGeo = getDoubleValue(_azimuthGeo, "Азимут географический", row); trajectoryRow.AzimuthMagnetic = getDoubleValue(_azimuthMagnetic, "Азимут магнитный", row); trajectoryRow.VerticalDepth = getDoubleValue(_verticalDepth, "Глубина вертикальная", row); - trajectoryRow.AbsoluteMark = getDoubleValue(_absoluteMark, "Абсолютная отметка", row); - trajectoryRow.NorthOrifice = getDoubleValue(_northOrifice, "Север относительно устья", row); - trajectoryRow.EastOrifice = getDoubleValue(_eastOrifice, "Восток относительно устья", row); - trajectoryRow.EastCartographic = getDoubleValue(_eastCartographic, "Восток картографический", row); - trajectoryRow.NorthCartographic = getDoubleValue(_northCartographic, "Север картографический", row); - trajectoryRow.SpatialIntensity = getDoubleValue(_spatialIntensity, "Простр. интенсивность", row); - trajectoryRow.AngleIntensity = getDoubleValue(_angleIntensity, "Интенсивность по углу", row); - trajectoryRow.AzimuthIntensity = getDoubleValue(_azimuthIntensity, "Интенсивность по азимуту", row); - trajectoryRow.OrificeOffset = getDoubleValue(_orificeOffset, "Смещение от устья", row); + trajectoryRow.Radius = getDoubleValue(_radius, "Радиус цели", row); + if (_comment is not null) trajectoryRow.Comment = _comment.ToString(); return trajectoryRow; diff --git a/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryTemplate.xlsx b/AsbCloudInfrastructure/Services/Trajectory/PlannedTrajectoryTemplate.xlsx index 68fd9cc258bfb718bd4056d4082261bca07d75ee..20080ac44fcb3671ec2fd39dfd03c44dc8014f38 100644 GIT binary patch literal 11387 zcmeHt1zTLnwszz0jk^SQ35~nE27*f?!5xB2a0?I|g1fsr2~HqDkl-F5XpmsHN6yU* zGvD_I?%DlxZ|n6|)!s{L)w@&`U|@j&cmN^*0H6ej@di!WLjeG=Z~y=f01;YG!ol7Z zZ0~BM>E#G^F<|wyv!%#`g{IE|Ktulj-|heK6R6M}w(n!d?0oS}M6ydeA~&q843VUb zM2}_&O%MA7P0r4n(d?>?YSU9rY)38e^2=m`dkU zp?lf)Qb7e3+A;O#!vL&RZEg5TF86I@ z8kl2HYemQ}K`v@t0aaqhNsh`DiiBCq0X(Cy41i~&UTzy{;Y99V^z<=4kRfQx+N^4F zGrAK9nu?Fs%2AoE^Jsmw6^C-3=5l_>Jycj3!7}m^e5ibd^x#PV_W9w!TyTybIJrlW z%@Kd<)fs~55{hZP3|MJ9!nz=Fsf6A`I=#^5#XrHnO+t^I0fFK&7Xc|ACiriw_FQG4I<%yB6C7+@bKS1p4@eu}~`ZqIe)MBT;fasng?`~viSup0?5as0tcSRI7P=LD0qcSw*r;{53Bdv3?v{S|U0G9jg zkJ-yK8F?>y_s%%R@|KcZh2d3d>CdNZQ4Uv|H6`ysDX|^*zm6wsZ zZO^%6MmNsA4~ufDOdT9-ev4-Ru^A{xNQ0pK-`*i`3BxPf7bmXgcwVwIS&%|K^PfepqX)a!Wsqx%&P`UVWnk6xyd zNNm{GIJUEw+^;6s-8f&ld?Foz=*(!tR>02?jl;^IhUR99bOwv<$5x4@OZfLeUgT5fgh+CN zXkLJ+y%|cT>t3l##Iue&3ni}!o8J7NsM{pv3S?zGLO!9c6k$U$BG!^WZ*fE#! z_ef#Clj@!o$C~gt0*QH4fq~~so)Q|=QD{2v}hw&}d+#j0Wgust^fn5Ga5p-y~qhqY*fB z`#jjzsQ-MOJJT2pn1-dPeSXkhWr9>NLsEiDlRY3`JhP$AW{_x|^HvUE%c$SIaM;GM zoiKywdk;j#{g~MsVd{lEJx4(V+nCxV=V{??#o&#sFaN_WnAvKE?QtzSSn5s{Zq0hgmrxV@u}69I>YfujiUnk<5m9#jy%7PkzjA)k zXltlq+RYHNc<$LADmUYqiNL$s4@G;K3;O*Xf`fWvclw`sdn%?gZm8||gijxP(81sg z{X-1{1-r-P`t=;mhi75$ZkF$z4=So#qGuQ>Kr$IJmu1dIr$e+uGR?F7=ZjYm-%<;; z?-jOJ@5;e6ND{AHzcJ_Qs=>qWY1YVJm!NoBdTsa>S0wUw!^Nq&)2)ejDQ@pt-Dhb9 zcxC0kyt09qqQT1|B|);hYqe*+rPcUdl@J#dSCbV?K^sgpL!X3$nY{6SQ@Z^QYVPt~ z?QEp}SwM&X)Q@(P>I2@pw_jd)uC#mx**6Nr4103+*7YTxIG&lvyj4Z4;S~*H3yh=%L_s$Fz`Byi%!ggmR`r94I z7x;%xyI7exgUvNuovrOHU4HX|K59w|{i44cKKR%@Kd6LeU+e^bPfjqz+zw`#)}lGD z*)JR)4$fgi>;z+=sn_Z=@^^MP?TjT{gY!utrLN41mFI}1B3iF0_69%($ zIS&xCET&OhU&!Ogn2y%DOCG+7rjk9y1z)>W$tIMA;==T$j|BXN) zalMg!>_Dk2m>4+MwTTnc-X2oOmy?bc@x3zI_EEu?WVSd}i%Rhf!9RkN6m`gNsu8Mvdm4pxS2OgK%HooYvMRsGO=a)$T=0`U_2mw0a0f1hj-_pq6{iv%I z*bdD0`|t0=KGa>dCzb+s$!w5ndmsOF@UW9{WAwJ;{Zvp%)LfEc=6#rD;r?Zjkgl;z zUh8!PtT=E04coCF4w|YlJmZ4&t0f}vl==rQh|9*?asx?Dff08`Qr_LN+hu2r&$5e4 z1fOjgt+X);M|z{g9-j?piz0LHDVnFY+_iADRn{~Jii8jUfK|1mF?OhMaNOmBRe1^s zn}@y$ugq;Dbrd!n-PI*e$7;unbAnwBb;71XuO6lsk^Mxrhi2WSN$+`s`F5y@3K+Dw zz+3;`BCH@ZE!{(b$UnVat5$cQU>FR?mG1hJv?jChU z(A^`&gOt)#aBT3W+RzLzHac0mM(v`gKCDYDvks99bo+6{&FzRMy{9N2a@(5Jw`XOa zXBZYvRC8D;-E4{dqVp{UF!I9bNPfx2TfrAQ;HNKv*Q=OOobVyiNJdx=BbO%{Xl+8L^Fcd3#24>?&V20P@-}By zn}Q9!+u!MW{H!$2(5$&VyI8NdzA^@>jdP%>#I`XEfFguuUxt2EFHEKq0kqYS=Qo6{$6!RKHEKbrag5z1FUn#5_fJ5}k@z z?~3!vCdxUV z-_&K6+9JjbUI1!=*<s9R5_tz!?@xFxANfWNrBktE9yzZ&1v9O z^nGhOD4>I@85Rd(NM=q;1WUO}IZp6Q)A1#i5dxy3q~OipRw3!BkYp1Wq`$HZZ?FhS zuy4bXCxW*M*j*?ktIV{lu+f#}IS*mNtEc43SNA2Y#Vc@*CblZzgo~-@Y&&{q08%~3 zcUmUvlLH8bnhlZC&h>`Jt_@U9Cc5@@BiBdce9#MrEA4-_Uto)g9g7o{P-7pp&Q>2N zogh(QH;9edM{J{yX0@%vg&tIeK!_36GC5nr#M1Y9pNZXP1ouO=`rT}=IA^wKOLK5< z_H2IQ7JLxUg-L3?2g<~eLQ}DmkHT@Im8OpQF&4Lo@2E^BmNRVHUGgJT`U~K@F^v|Q zsY1RpyM35#J7EjQy)qPUYBl3Ww^^Z1O_WK7g0xx17%jmjc{MY@`%a@7__cX;lwyt4iveRbUNhwgX(uH+pKq6C{zX4v(}oyG3>85w3tMO zNGD&aQQ#dYrd^*kNp_BhdwT>3zI0?2%*`BD?OT=%GM-Aw<}Pl4(%52sUyZdsoK90< zzsl5t_K~gCuS(TziLdw&=&aSOHo>FctZ&;sC|<7HhVkYNg2|MU!z+GAVX5NtTcU+7 zXGlN+|2B>K$6`#2u9Vs$Bw=udL^`xTf}M-2mo51Bnbm;Kxc%mH%r5*r z0mL?e1ZF)O!esmi94HjqK)3|x&S`8gPOhXxUi~GW&{fUxCy%|_ur7%+=`2b+g@|EL z#(k+z&CvRo&w2lPcw%!#f`CVZeQF6dFX-GLOgn8zw^8=1k;C-LkQ`YAKR^HHMz!Wkoa&@ugda zt5?+3G!@Q`Ax>$XlCpB&mVT6_L^w;)WN=MvX%9PRaT0gyY39+opsVus2AF#OXHCKQq;^sYrnC`uI9taIY5tuo(07v+9Mu&TXb_KpgPq(zS>i~D`1 zK%WV%W9L2%j{b~tXDXe2`p<8@`;keSY#CS+J3RfvK}pdLKU|GC*yNT2-Zu(no?=FP z_&l}c@1W$O>RWT5qgR&gVDSaXZgnhbBn{0o(P<^3Dmzt~Vw9$`99S~({obNI=&sCI zV$T?`zx7Q@sY%TL+BsC(G1-it#bSAD|GkVKNq*{$nK*15ttaVFDid3v<~v)i3yqFi{UG*Zp-!%nxcq#?XSswz_2KD+#U1J8(es}^)2;)Rv9nn%I6liX$859-zq|mV@fxn*Jz6js@u5~Mk@#(ONo28xla=d(iKVySp6}}AP+C68j z5e`@M?N=uO^TrLmibR6EWkk=#sWd5onNsmeLx-*V4uY0HV*)Pg?kDVcbD ziIZvq^4!AGnr=@5_$rs##8F}wZaMCR{bphxRZ--)N-=zgBIlY7P-eP7oW^czZY@Lh zrSg*+CfD7lw=ZjIP7O21CwHnBj;n(Z(oSJ`^>`_3O44y&;*!zxWWByDNhkf55Gl)IEJE<)u!O1Bv8|- zF>Cro!z!}ON`&ck+WB~sLLYnVIN|ZFiIp^FpIOnGeS^l>Yt?iXWLbeGg!50fkX{~5 z3DVjQnMoh@e_V6{CJMbwA0|_py7W|;pjKJt=;?)xIlYDN@?Bfi{le_z-`(bkV`Nx( zzcSQK@B^Nb^m1c;5bOX-HPAOKs$IRZ^mnzF@7lcqzI5Qu z>LdW;`?U;%H(+^??27u)hv2%C`yzOSf+~N79yzSjmEeLczjtt!oz%Ss!zfJXq?6)P ziW;IHD7m5_Q|orcbXCpOGPg8folDyDR@Usxo=lHG29?M6;PH!XXb$#a_DsFt)W4Ng8 zizt{(l%fD0du9IZx7fvbIe%#~QRLK@=8|=!aPU@h>O73q*F|^T% z{jfW}tGdso`aGNhzZN?U=uU*@L48jzR2AGE-?6|Ev~xf+O$|hDAKb5TI0kjrblUSa zH%9_Gu|De>-q<2Jdy3)^A@K*e)m0)y7b0NE?J41|!|I^SDOZkAn#q*ik`Xi+=XC59 z!Bf2rk1JKcVZVBAY;ue%(Jw>L)JoF)(<_&fe(sdV9&ImP5of(_YuuCKgKzti&XSc| z=4E=P)h%&`LGh^-vncQr)yvM_2$^%lIaEoW9s=oT9q8}tv+`z*HxxTteyfII))Ze_ zL29EldoL~n7=S`+_jzG3St&)@+~aTxY_9x+G@~3*rLQI9k60!w@D2qD1Si86KPqE< zWjM;RHzVCjQBKDB*?H3=ne?7?yTlQJ%sKqw)ZM1s3zag4mD#=aO}<{sd|suV=X_qi z-u1kxRx@JFV5mKoY1H@WJfuK9>FP?E<1<_%Nm;@xJ5K{?tMPEmCLLa?3vra=H+T;y zZm?_(hzd~~O|#I`r8t;i)TPRnXES7rJb^aQldxS#&^RHuIdTS-)LMi#>PlMC zh_w;*ceS*$uvJKrk{U-F8F+z6eaN2*%Gju1B$q|=l+rpXt)=zwiWvvhKy#O7xD_y( zDU~7V<9O1ZC}E~jQ~;F9V2ntr$maT9;zWfiE{7u7C_0jYt%BJSpNg#D%a>09oVhc9$&ya}=JvHsGZ zIwNAR$lu$&jR^na>RPl_uE7rvcjU=;$eEnYB!~cE0<#3`x2ivp8)lEKLj9~4 z%n-@!=JKCRC_bz8q3LEYBoFR$*z(^tL(vyXToW%9%J2vITMbul(NUah`k~Rr_1tmY z6y7QOLE2-T>}423uFz&~QBCxu>VEGJIJTU-GkViTzOC}AMe0~%59xdoq`5G7Jb-}L z#4H__MRs=>9MjQRIDuY-=GLC4?oi(**9xp(K`>d_6YTN~cN;E`kf|M~Lv0m3` zKWBSjU5+X_tz)r1R0G`(8M_?e2nQh~zx!n3^c=cd(9_Fv`c;o*FQ=Pn9aO||JQ8R^ zM?YqrIi`=gWLC!|vkK<5z`>Eb4en1=LcvWoyP%JmMCSpK))rvcY%_#YnEBNcDH3(4 z%n9IRS63DXD<}ev24)R|fSbk;PeMpbD0sa?b-?lRf_S}?Ksn=jB}WjfONMU$Nd9k8 zd?S=HBLI@*tV1{uEC^+0?qH_s?BM9aX6E1w{0_FlASrBiBJpw(7b3U?RJ#j6mZvRfB=)nu`h8fR7|(K^4aGn%YhZjhe&B$dO}QK zpeY)D8RI8sj;N3Hb+L@f2hw7Jm&Q{K9bF@76FO#V!`wvCIL6e~1-2ht1Lr38QO!o@ zC`w5^L(kUAI1>1c(vfXOx~$+p&&)%ffksO6TX3V@s>9I}GJhnzHv2}=Ll{a#LvQKC zDSHxe&?9@h8yt|yQRwJ>WXV4-^kt_4#{04vSIDV(3C+FVxc^q=Wa;koSu_#K?Dt40 zMwbarI(;;7tjY`j`iwXg<0_l0HwdXv--td#`L08uCllsosg%I55ebK-zvR7oTM2v8 z?km>{Wc=72_?!zyZ_2_T7ABvqbG0UW0{&zOBh&4GkE*)=Hf#{}ot*_o+Q6`tm@M9e zx4_omtvi%~1X<>Nc`CXYXY6NlFy$JcRY|m6K#5 zJ4CpkSb;0IRyd_-j3BaZ11BaMnzg^1twFLz);j&pdu?WTht0-Mj0==>`J!vFdo;Gm z(k`$R*vCVHIOg<*1vOqwowZmobah;(R{Oo9gKk(rpqrrW{5ytRrD&zZjrj(v?>(%! zTFIszIBwj-Za$O(r$KB>AVdF_m@+Iq9uh%A;l~1_8%=$t8tsSXZdVv`U#*=nEh+>* z&!SeXSG{_Qky8VFL{?@P0#?)H={ZtEA6UV}A&VvWOficgFSoEPq#6SmE}di|v*qz` z-fDs@zGBSBdl)$KI=&V{eK$6sPn|56dq$rU(HC$U@6my&KbGjJwxv@hK^jbtt4rYk z``VtMjbwrz!t%u(ij8joH(;gZJ26!wF=(>q0H9FlU(PPs3aY}U~}hh()J%P ziyHFdJ{Pob^)W|b;3lC)g7AGkd&ZlK6cRAKxdu z1U*yi@pd)q&#iXb4&EHU+Nru;WWv9BFwqM-JP+t)8%F5$K8D77Sdv*dcAP>syZE^;&}0Z?%J1XdE!#! z-Y`w&pS)s<9}4iW;Ny&3VnwsCQ4+2^d`Q~A_qTmF{W&)dk?eLTqoz4#)E zIlg-qaI|?N-u+e`@JAL51Ypi?<`gd3V3labjru|Ew Z{&f7R3UCk|1OQMWA6keSi!l6l_CL@X#@zq_ literal 7576 zcmaJ`1z1#FwfMmC7e`~I9K$vEJl0swgzl-KYM*=tx=pEW0Cg|L`F(5pGOHd#rOn;DuT4 zf{G)@0uQsY$uk|$Gqh%AbN~E~{tIVsZh^t9fG$EIc}<86y9-QB>D$1PR9}v-TbvU1 z*8^4MQPef_O$(F)cFIf85_b=`w;FII>D5w&?qFdeWxiwxJOLv~ozn+vt+)%&j z;$-#>W3Y)RjK|u|SCzqEL1jCGl;pkXNuvNBw>ql z1Lw1dGCC~EY?*PkH zlJqf_=R2E5Sz-mW855LIQD=ggS-x0j$7mNS^t}u{3ddKlQsH$orm~LHnoj^=MdxU) zeEh7zX>81z`D_S9WoSNe4LO&_CxwqCgOs?df~ZhktQN#7^zOl0?g#_P4n z3IUca4{?8HrHc{Y^w-5bgbkruu9=|b?LM;d7ipLs1;}y=B7TkwJqrzfM2K92hhu4y z!ZI_hP}V%LuleBJ#3WqIY5OD5>K&44zI&+ar=ho;abt!G!g z<7Pxy$Q(=5<^ZCU0W8x$yaL;AIRl9&nD(8Xzpi{gA1K{DwSRh1<0pAKdr_hpqBlgu zXf@UIdC)!&)S(ea!G~K=nPZ7FsZ&PD8~c=8J&C5TS~4O)79@3|#Eiu&Rb_tW?9qKd zQun6d&ANBG=~CNd)5op=SZWv3r$7fv>*pcu0W&%bLk8tReqIaq$hLse2^-ZjkM<+$ z`7WqO{%q3lsw)^Qgok+mtMjVvm#}eCHK8EFA%yGCLpZnF(OG}WLFD~k1+j!@xZiz>1u@=QH!PKsEul@ z_<20LxsWpz71!$9tbIW%eOiPMG+7T*e_%3=3O?8PsVwPbMjAonJ6Z;tbf>;>hKh+f zW3F=q$~_t3$w9M+y-Gly5{*Y+O;Wo_y+R+pr8ev?tk}5ItkN7u5Mom@A9SJkpw=-qW)O9(m3XHzcVG$3=M0ag>`mvV7nbn9N6$L+bx^$j*W zk`LuuI6}1sYu@b&*wui?kTL9@i#gA}6*KE1!-<$$6IxI|G$N(QO$ld;)mY4R=L;_X8EX^1ShwqhkE*3tSjON1I{C=Eu9nXpuR9|}Y%Bad%w*!uIq}$_q z5uT_`eT<49a%dLZ85ep3>mQ0l!M|x_!ZpYZmu@N-cJ%2v-gvS@bNr&pkx6TG%!yTP z;Y$@=J>A<74+Eb@cQv-l%<-?9ukF(P-!!b2XsWKCiCc6D^4;PigB4RI|KFk9qY^^b z%*K)}Ri2C+HRz=P&N5Z$+TdD5nzdBM!nlmPb|&)&8vR=0Pj+hZBwjd}J$JB3+$wyJ zG4qge@+gzyq&RDy>LKN&!YIcgRiNCPb?vFbN-4!eR`grOofQ2+BsfoVZlA^8b7~g3 z2XX>54?VJ&P&3jS-)IAY6+(=?ABv-PmWa?}=1mdn8+jq&H3#wTjU#yTu@k|ZN%g1L zHTbsjwG)Zzib*X8k5GAsT|ZXQ%u}JF-TiPpeEA*_E}uDq^$9x|Q~}{Vl27Ut9?&RR zC){2L^Nj(Jc;h^arS&;oqqSAD;xWxDHi(|wqH6C8nZ3L0M>T!&%_w~Og_hqX2B(9TU#C&E}rysYkve?nIdoBj+kJ)o0kf^D*ZMLYyZfnSiJ~ zo9A7!MkM|U8n>mQMFiLGsxKDY%i;QXT-t!r91~3duL^T#Q#Ap6%8q*|+dkm!!CqBF0l)mMtzOZQ1=jU7 z&~v=L;sAjZJiOBVGT%Cv*Vz{vxL}eM0xlL$uXf@9=QYKY1cD7-k4LbLuEn8TsTYYH zN0muamcU%Vmu}`!fT;P3X#9znw}fwM`nYL<8MNbys%|wa?|i0iFmGLtIrVA zxpy?)Y~(U1%{5Chrt}MXWve|fTR1upKdsyqZJ%s9v`aQqosxTN_(q1o7W#V&F-zB; zcqkoBRyW2mSgwSZ1}zcF&C zUtUu$n7%xcnzFG08f3u*D za;S1Mn09o#ra;r5l>U9Z!kloWhFebL25D+c-c-P18awHZAn7_M4l{-0`}9{`1^Kw8 zNDg8#oE;`-VX^f);4SJq)SKT9J;`k0vgJt%!Zhv>=;AcYi+7bzIdF1$#$1nMWe@4~ zsY}#`tF&?Ka-DbBR^yUnMm1ZJ4k2h?6$nb0u@NXs#)}uS`a*eHEJ`Iyv-@QKB${Zi zl~FvLdXgVLV`8+_(lcWJZDt^9YQx2IVPzZ7zt7ijR>?SV)h87eRS^9McCcyCw=tc! z!OY*kvBK@^*VD)o%j{?J)T)3-piVMiK1-DM_3>8bE+}A(t1lSTJE@AtAHeX0e?9?eg~&Ps}@7?ZQF{pB55sBcA|0{l zKu8D{oh{zgoi`o?3&dR0&oXbe%2t}>J$Qc6_pEliL|^nE!N;Qcutz~^XC5fc{%(Of zYo0o5QT*1IL*T(7aN`hodI(%Q1Rg~I`6ilYWzJ@0LT0;(1n5MOYbL&3NCB}gK1d;t z4T5u@0RFOCl$RlLQu&Y7dD!%;3{&NVNQ|(l0U6Sgbl_H{Nl$?^Bvs1Q>5feScpW0u zn)7(n(Sc$~-HFYM#19)a+{s#X(o--EX`FI({#&E6VE>+zg^0=)J=mAW$?n+ffS8a+ zt(lKC%UGvL?qG8PU?FOBnZTOIOdF?^Lnq>cB7mQRA^~IL173y5x8?)Yv5uxJ&L6jf zBr-wynVKW4UrBJWnE}uc)z&wkHFsIRlb~TQwWbu&I0|h%y}v=C{hvW=l(GGsn3z$# zySHzxQfP5yoP|2m-`b3IGqJU`fp`xwc_meVI2{(^HFm1WT%V{qfSo-OBP;YaEpsHm zEL4b=D-shPdV}_fp>AQ>dS^)!&fiU(^_86fG^FkWsX9=2r8t0;9jMMyVn7;3l$$H= z_D{UWp-;$l+iCyU$D1Zc2M&mjGe?`U0JbSU5RFI4g4cm>Y!Q=U4do~-N#$Ff5w7+V{)jk>oQ-k=(W@z z;gq(V{{))(_6ZbReJ>I_EBGrdM&wPi;AvX?NE~?ZcUn}1f+9oFyQwCkcgs95{tU)T zcYABgaeHgPQQ^2%1oqh~`tXVT&tPaj-kNjRf~GkL4fV}9PM@6nWqe^|kJ{i^ zTNj&t5b4!69N5_&)j6~%PATtQF~^%0jgttCDeBCU<5dRr>K4rSY*?OSa@;z#TgyM# z>-1CEk+UTdH0<)0;_f!Hwt7naBJ2KO$xiO*_tq@q#5FURGcq4xiTv{I%ewq{_XHH- z`}QR2(i`N@xp%}}xRaNmy{OBbyACNN8;8BydABw}FhMZBs2a$ibGgEuv4 z323_v;8ML*hi#`K3`ghBHd)RFGKNboi)M)XcM^M5wpnt4;%PJpI=F%G#^>`hTES<5CtH0cYd; z%D-viT(voNYU?Q3Ew6LH95nF&fnOOnr5BEAhO4bjyxm*PS3+`|WOBb7_8Jvm3v4O6 zU~{<)YmY|^pN(h*e6B<+9?0-O7qo5Li~=t;!O4O5NDUkp19gJ84`a8Z&=h@k6d-!+ zR_71FpD)*=CUAFI>WVK*L((euQ_2NBGMY?Cw~?_`4cKx!taZ8Ap7_?6^ZIx~URoMh zB>CO(V&t!ua*p+>D-^^+s?HSN>x)}TuYix;`3ClvH3Yb_wJpuX^9_g5jrMk8a$uMZ zgZJ(QB$)1Uld%3eqpO`KX`z6YE~;@ ziz;A<_RFHTAT@$3eY`$xw^Y*Pd*w1=;ZYVzF^dLb&C^Par>C+OiYe6Lxdy;FXgEq5 z4my<)z(3a6PflPtqu*#scVh;btZHcP2j^>Cw$3}BE%30tT7exDAit?*1RB1ZQ4llI z84zbTRGeVGdHIe+Ce_-N?Hv3f643)kq!itDN6Qf+$Mx#!&V9bzSy2dh>Re>X8AvSp zU(8( zFtjH09)tvRMfzw`DNK|jF+Wh{d|jPlZduvIGM|u=#whJcEeO6S;!-(}))pMzF-jeg zMsxK`qp!|?W|c-~^_&t^U=0Z2*;F(2RKQc&GJ0cB>xN%?iPfgHeAAyFhgd?Y(%7h1 zMaxuV>HY4uMvAXC74)mgJCk4zd|QmVUZ#eN1Fmn*Nzps4p8T;xQx++F5yuH>TwFxa z2eIc3TD7;oXoptOQE_DPF|6aOcn)GOYJHK`t!mFTi?|fqLBC%6csONh11bs%FW_%$ zPw~&%|3f$aN~QfnJw8{p|3N*Tlgb@+Dq@;P3pGbem7ae`?b3jcbO^kdtiB3Fl!n-r znyNW}dZL}Z5yF2=j88{w^;9$3x6=i6ILD z29*awATG1EI8o!AUZqEGr+OPgw=}r>_Z7#}PzOo1iVe}L9Pg?(y0%@GnNQ*2n`ZlF z@buu_9CV?6es5G0X7>3mHy`FVhvSt8D-!fn(+qv3p&6P2o;N2dzb9EPplPkA5#KrRZqsw2@SS^%? z#Q#Vyu0u`sYXZmAj4#ClatIxJ|l~_V}C1$QS zlNpJZxQk>N`xkoHD6?_B>#~iEtQ=HHGCDSMl&}6-5@V6(ZVvm+KBtjbQlbXI=+8kgfh?l>zhqb0NYOp7MpxOaj{4>1LNTBoU6lh9!C= z%d&@3UaPEfsN^e9YkF<%tAWOx>{;F74Vc>FJczAZkwYC@CIP`}hObJ?kMLFRI_GG2 z<-)UnT`1tM3-!dw>3W@BKUY=z;kai}?C=I=+bM#)`@}@>up3YL>U2PGM=1v){wLte zbTIMk(07Z|>U6>K85arsUVP@#Vq2iR4wdviN zp0%J-kqT9#Z~czpAmfA+-8|RE>PKNo{Bq$@Hdc9>!1Q5r;;zNY5f=03=s2Qw@gR*% zt8KK0)^Ibj3mhF?>cus^tyWoTYtCp#AgWONR8_SUZZUPRmh^#`(kl#KH^&jpusYI< ztSREAbgX^h!ukNF= z3lG~cV+}^W0JPUy$*)Zu-$}d0_RN{$`v$Myyx1k++V?-AuHlkiLE3V4{X4Zz{41p9 z?yhbShaad8m1DQ@kc2PI=VQ&xYGXbhtAYxNY9GZd)S$XTdQ_qQz6>GTu}^8lAB{ga zmnj0y5Zcvq-(^GL#KULdgq-IJDYo{0eoP&fxq`vb=rLu)0Ep~Gg>ul^3+I#AiYY<3}qmWZkCR2rrO?4mafJ>sFZ~Ms|pKH_UJsS$B?AaG8m{d z3xF|cXB9m!XL)9O7PpmnxRcDNuESKN9itE08)&w+G80WLaerC#0n>6YDf(+15IxtCW~@twzLMInkr@JhvX+Ou@9Hx*fedX-~a3PB!3N{uxl#zqA{5 z)1E#lsq0gyN`+|8aYa<`IYq4@SD&KG?CL}T@6wQt(r)AvU3pOckPIn4mY&?U&Z__& zIgOd+FwJ_WJ<--=GlERFc~J9Wv6trvr!886cbl^>6J4@14NZO5jY9*^Hk;vdx95|j zr)2?qR$C#|)V`R5tMx>*#rk#$BcH{b$d!T$?tUuLcD0P%m6_89p5zJU1%7QJyfMj< zoerHop-GkOebBS^buR@e9%;P8;9k}3cqDe#P1w<9z0eTE9r|><@p5$n@$n7e_X7OO z6Hdb7VQRsTp2i_!FF6zG4EzOJs*i8dSQL5ZvSeKQ-|zx`i}jW7ef*J?P|-+Ge%8Q# zE&E*8!2Vl)sfej7|F`0=B>r_(=%=t;b@f|~=y&B`nYe47|EIjTstH^v|787tSN(N+ zbxqa%6l|>j^!xvayWg$+ny9b0Vn4-+=$`@nzA^jV!mkPKI-&m*@Rh-2{q#Ss_c~ty From 2ee10e8e704639ad7a43acde9691deb3d408605e Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 21 Aug 2023 15:51:51 +0500 Subject: [PATCH 08/25] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0=20=D0=BF=D0=BE=20=D0=BC=D0=BE=D0=B4=D0=B0?= =?UTF-8?q?=D0=BB=D0=BA=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=B2:=20=D0=B2=20=D1=81=D0=BF=D0=B8=D1=81=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=BB=D0=B6=D0=BD=D1=8B=20=D0=BF=D0=BE=D0=BF=D0=B0?= =?UTF-8?q?=D0=B4=D0=B0=D1=82=D1=8C=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE?= =?UTF-8?q?=20=D0=B0=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D1=8B=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/WellContactService.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/AsbCloudInfrastructure/Services/WellContactService.cs b/AsbCloudInfrastructure/Services/WellContactService.cs index a8e280da..261ed9f9 100644 --- a/AsbCloudInfrastructure/Services/WellContactService.cs +++ b/AsbCloudInfrastructure/Services/WellContactService.cs @@ -29,18 +29,21 @@ namespace AsbCloudInfrastructure.Services { Caption = c.Caption, Id = c.Id, - Users = c.Users.Select(u => new UserContactDto() - { - Id = u.Id, - Name = u.Name, - Patronymic = u.Patronymic, - Surname = u.Surname, - Company = u.Company.Adapt(), - Email = u.Email, - Phone = u.Phone, - Position = u.Position, - IsContact = u.RelationContactsWells.Any(rel => rel.IdWell == wellId) - }) + Users = c.Users + .Where(u => u.IdState == 1) + .OrderBy(u => u.Surname) + .Select(u => new UserContactDto() + { + Id = u.Id, + Name = u.Name, + Patronymic = u.Patronymic, + Surname = u.Surname, + Company = u.Company.Adapt(), + Email = u.Email, + Phone = u.Phone, + Position = u.Position, + IsContact = u.RelationContactsWells.Any(rel => rel.IdWell == wellId) + }) }); var entities = await query.AsNoTracking() From 70c0157ecb5def3e95b635ca567ef13a082108b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Mon, 21 Aug 2023 16:26:26 +0500 Subject: [PATCH 09/25] =?UTF-8?q?=D0=9F=D0=BB=D0=B0=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=82=D1=80=D0=B0=D0=B5=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Поправил сущность и DTO 2. Создал новые миграции --- AsbCloudApp/Data/TrajectoryGeoFactDto.cs | 10 - AsbCloudApp/Data/TrajectoryGeoPlanDto.cs | 37 +- ...10455_Update_PlannedTrajectory.Designer.cs | 8346 +++++++++++++++++ ...20230821110455_Update_PlannedTrajectory.cs | 123 + .../AsbCloudDbContextModelSnapshot.cs | 45 - AsbCloudDb/Model/PlannedTrajectory.cs | 27 - .../Repository/TrajectoryFactRepository.cs | 2 - 7 files changed, 8470 insertions(+), 120 deletions(-) create mode 100644 AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.Designer.cs create mode 100644 AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.cs diff --git a/AsbCloudApp/Data/TrajectoryGeoFactDto.cs b/AsbCloudApp/Data/TrajectoryGeoFactDto.cs index 0880e507..98b141b7 100644 --- a/AsbCloudApp/Data/TrajectoryGeoFactDto.cs +++ b/AsbCloudApp/Data/TrajectoryGeoFactDto.cs @@ -33,16 +33,6 @@ public abstract class TrajectoryGeoDto /// Глубина вертикальная /// public double? VerticalDepth { get; set; } - - /// - /// Север отн- но устья - /// - public double? NorthOrifice { get; set; } - - /// - /// Восток отн- но устья - /// - public double? EastOrifice { get; set; } } /// diff --git a/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs b/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs index ca538979..7b3a1f41 100644 --- a/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs +++ b/AsbCloudApp/Data/TrajectoryGeoPlanDto.cs @@ -20,42 +20,7 @@ namespace AsbCloudApp.Data /// ИД пользователя /// public int IdUser { get; set; } - - /// - /// Абсолютная отметка - /// - public double AbsoluteMark { get; set; } - - /// - /// Восток картографический - /// - public double EastCartographic { get; set; } - - /// - /// Север картографический - /// - public double NorthCartographic { get; set; } - - /// - /// Пространственная интенсивность - /// - public double SpatialIntensity { get; set; } - - /// - /// Интенсивность по углу - /// - public double AngleIntensity { get; set; } - - /// - /// Интенсивность по азимуту - /// - public double AzimuthIntensity { get; set; } - - /// - /// Смещение от устья - /// - public double OrificeOffset { get; set; } - + /// /// Радиус цели /// diff --git a/AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.Designer.cs b/AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.Designer.cs new file mode 100644 index 00000000..64e38d02 --- /dev/null +++ b/AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.Designer.cs @@ -0,0 +1,8346 @@ +// +using System; +using System.Text.Json; +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + [DbContext(typeof(AsbCloudDbContext))] + [Migration("20230821110455_Update_PlannedTrajectory")] + partial class Update_PlannedTrajectory + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Russian_Russia.1251") + .HasAnnotation("ProductVersion", "6.0.21") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdDeposit") + .HasColumnType("integer") + .HasColumnName("id_deposit"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdDeposit"); + + b.ToTable("t_cluster"); + + b.HasComment("Кусты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCompanyType") + .HasMaxLength(255) + .HasColumnType("integer") + .HasColumnName("id_company_type") + .HasComment("вид деятельности"); + + b.HasKey("Id"); + + b.HasIndex("IdCompanyType"); + + b.ToTable("t_company"); + + b.HasData( + new + { + Id = 1, + Caption = "ООО \"АСБ\"", + IdCompanyType = 3 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IsContact") + .HasColumnType("boolean"); + + b.Property("Order") + .HasColumnType("integer") + .HasColumnName("order"); + + b.HasKey("Id"); + + b.ToTable("t_company_type"); + + b.HasData( + new + { + Id = 1, + Caption = "Недрапользователь", + IsContact = false, + Order = 1 + }, + new + { + Id = 2, + Caption = "Буровой подрядчик", + IsContact = false, + Order = 2 + }, + new + { + Id = 3, + Caption = "Сервис автоматизации бурения", + IsContact = false, + Order = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("StartDate") + .HasColumnType("date") + .HasColumnName("start_date") + .HasComment("Дата отчёта"); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Список параметров для отчёта"); + + b.HasKey("IdWell", "StartDate") + .HasName("t_id_well_date_start_pk"); + + b.ToTable("t_daily_report"); + + b.HasComment("Ежедневные отчёты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.ToTable("t_deposit"); + + b.HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата начала операции"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdReasonOfEnd") + .HasColumnType("integer") + .HasColumnName("id_reason_of_end") + .HasComment("Код признака окончания операции"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUsersAtStart") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя по телеметрии на момент начала операции"); + + b.Property("Value") + .HasColumnType("double precision") + .HasColumnName("value") + .HasComment("Ключевой показатель операции"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_detected_operation"); + + b.HasComment("автоматически определенные операции по телеметрии"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Имя"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("Отчество"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("Фамилия"); + + b.HasKey("Id"); + + b.ToTable("t_driller"); + + b.HasComment("Бурильщик"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdFileCategory") + .HasColumnType("integer") + .HasColumnName("id_file_category"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("Id"); + + b.HasIndex("IdFileCategory"); + + b.HasIndex("IdWell", "IdFileCategory") + .IsUnique(); + + b.ToTable("t_drilling_program_part"); + + b.HasComment("части программ бурения"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer") + .HasColumnType("text") + .HasColumnName("answer") + .HasComment("Текст ответа"); + + b.Property("CounterQuestion") + .HasColumnType("integer") + .HasColumnName("counter_question") + .HasComment("Счетчик повторений вопроса"); + + b.Property("DateAnswer") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_answer") + .HasComment("Дата ответа"); + + b.Property("DateCreatedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created_question") + .HasComment("Дата создания вопроса"); + + b.Property("DateLastEditedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_edited_question") + .HasComment("Дата последнего редактирования вопроса"); + + b.Property("IdAuthorAnswer") + .HasColumnType("integer") + .HasColumnName("id_author_answer") + .HasComment("id автора ответа"); + + b.Property("IdAuthorQuestion") + .HasColumnType("integer") + .HasColumnName("id_author_question") + .HasComment("id автора вопроса"); + + b.Property("IdReplacementQuestion") + .HasColumnType("integer") + .HasColumnName("id_replacement_question") + .HasComment("Ключ заменяющего вопроса"); + + b.Property("IsFrequently") + .HasColumnType("boolean") + .HasColumnName("is_frequently") + .HasComment("Частый вопрос"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text") + .HasColumnName("question") + .HasComment("Текст вопроса"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("Статус вопроса"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthorAnswer"); + + b.HasIndex("IdAuthorQuestion"); + + b.ToTable("t_faq"); + + b.HasComment("вопросы пользователей"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_file_category"); + + b.HasComment("Категории файлов"); + + b.HasData( + new + { + Id = 1, + Name = "Растворный сервис", + ShortName = "fluidService" + }, + new + { + Id = 2, + Name = "Цементирование", + ShortName = "cement" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "nnb" + }, + new + { + Id = 4, + Name = "ГТИ", + ShortName = "gti" + }, + new + { + Id = 5, + Name = "Документы по скважине", + ShortName = "wellDocuments" + }, + new + { + Id = 6, + Name = "Супервайзер", + ShortName = "supervisor" + }, + new + { + Id = 7, + Name = "Мастер", + ShortName = "master" + }, + new + { + Id = 8, + Name = "Долотный сервис", + ShortName = "toolService" + }, + new + { + Id = 9, + Name = "Буровой подрядчик", + ShortName = "drillService" + }, + new + { + Id = 10, + Name = "Сервис по заканчиванию скважины", + ShortName = "closingService" + }, + new + { + Id = 12, + Name = "Рапорт", + ShortName = "report" + }, + new + { + Id = 1000, + Name = "Программа бурения" + }, + new + { + Id = 1001, + Name = "Задание от геологов" + }, + new + { + Id = 1002, + Name = "Профиль ствола скважины (ННБ)" + }, + new + { + Id = 1003, + Name = "Технологические расчеты (ННБ)" + }, + new + { + Id = 1004, + Name = "Долотная программа" + }, + new + { + Id = 1005, + Name = "Программа по растворам" + }, + new + { + Id = 1006, + Name = "Программа геофизических исследований" + }, + new + { + Id = 1007, + Name = "Планы спусков обсадных колонн" + }, + new + { + Id = 1008, + Name = "Программы цементирования обсадных колонн" + }, + new + { + Id = 10000, + Name = "Проект на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10001, + Name = "Программа на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10002, + Name = "Акт о начале бурения" + }, + new + { + Id = 10003, + Name = "План работ спуска и цементирования направления" + }, + new + { + Id = 10004, + Name = "Программа цементирования направления" + }, + new + { + Id = 10005, + Name = "Мера обсадных труб (направление)" + }, + new + { + Id = 10006, + Name = "Акт на выполненные работы по цементированию направления" + }, + new + { + Id = 10007, + Name = "Отчет по цементированию направления (график)" + }, + new + { + Id = 10008, + Name = "План работ спуска и цементирования кондуктора" + }, + new + { + Id = 10009, + Name = "Программа цементирования (кондуктор)" + }, + new + { + Id = 10010, + Name = "Мера обсадных труб (кондуктор)" + }, + new + { + Id = 10011, + Name = "Карта крепления кондуктора" + }, + new + { + Id = 10012, + Name = "Акт на выполненные работы по цементированию кондуктора" + }, + new + { + Id = 10013, + Name = "Отчет по цементированию кондуктора (график)" + }, + new + { + Id = 10014, + Name = "Акт о замере расстояния от стола ротора до муфты кондуктора" + }, + new + { + Id = 10015, + Name = "Акт опресовки цементного кольца за кондуктором" + }, + new + { + Id = 10016, + Name = "Акт опресовки ППГ с глухими плашками совместно с кондуктором" + }, + new + { + Id = 10017, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с кондуктором" + }, + new + { + Id = 10018, + Name = "План работ на крепление обсадной колонны (эк. колонна)" + }, + new + { + Id = 10019, + Name = "Программа цементирования (эк. колонна)" + }, + new + { + Id = 10020, + Name = "Мера труб эксплуатационной колонны" + }, + new + { + Id = 10021, + Name = "Карта по креплению скважины (эк. колонна)" + }, + new + { + Id = 10022, + Name = "Акт на установку пружинных центраторов" + }, + new + { + Id = 10023, + Name = "Отчет по цементированию эксплуатационной колонны (график)" + }, + new + { + Id = 10024, + Name = "Акт на выполненные работы по цементированию эксплуатационной колонны" + }, + new + { + Id = 10025, + Name = "Акт об испытании эк. колонны на герметичность (СТОП)" + }, + new + { + Id = 10026, + Name = "Акт опресовки ППГ с глухими плашками совместно с э/колонной" + }, + new + { + Id = 10027, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с э/колонной" + }, + new + { + Id = 10028, + Name = "Акт на вскрытие продуктивного пласта" + }, + new + { + Id = 10029, + Name = "Акт замера параметров раствора при бурении горизонтального участка" + }, + new + { + Id = 10030, + Name = "Разрешение на спуск «хвостовика» (телефонограмма)" + }, + new + { + Id = 10031, + Name = "План работ на спуск «хвостовика»" + }, + new + { + Id = 10032, + Name = "Акт готовности бурового и энергетического оборудования к спуску «хвостовика»" + }, + new + { + Id = 10033, + Name = "Акт шаблонировки ствола скважины перед спуском «хвостовика»" + }, + new + { + Id = 10034, + Name = "Мера обсадных труб (хвостовик)" + }, + new + { + Id = 10035, + Name = "Акт выполненных работ по спуску хвостовика с закачкой (нефти, солевого раствора" + }, + new + { + Id = 10036, + Name = "Акт о переводе скважины на тех. воду" + }, + new + { + Id = 10037, + Name = "Акт об окончании бурения" + }, + new + { + Id = 10038, + Name = "Акт на передачу скважины в освоение (КРС)" + }, + new + { + Id = 10039, + Name = "Акт на опресовку межколонного пространства с КРС" + }, + new + { + Id = 10040, + Name = "Акт на сдачу скважины в ЦДНГ" + }, + new + { + Id = 10041, + Name = "Паспорт ОУС (заполняется геологами)" + }, + new + { + Id = 10042, + Name = "Паспорт скважины (заполняется геологами)" + }, + new + { + Id = 10043, + Name = "Фактические данные бурения (вставляются в паспорт скважины)" + }, + new + { + Id = 20000, + Name = "Справки по страницам" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории файла"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Удален ли файл"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_file_info"); + + b.HasComment("Файлы всех категорий"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created") + .HasComment("Дата совершенного действия"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла"); + + b.Property("IdMarkType") + .HasColumnType("integer") + .HasColumnName("id_mark_type") + .HasComment("0 - отклонен, 1 - согласован"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("id пользователя"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Помечен ли файл как удаленный"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdUser"); + + b.ToTable("t_file_mark"); + + b.HasComment("Действия с файлами."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("real") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_float"); + + b.HasComment("таблица данных ГТИ с типом значения float"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("integer") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_int"); + + b.HasComment("таблица данных ГТИ с типом значения int"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_string"); + + b.HasComment("таблица данных ГТИ с типом значения string"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории файла"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UrlPage") + .IsRequired() + .HasColumnType("text") + .HasColumnName("url_page") + .HasComment("Url страницы"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.ToTable("t_help_page"); + + b.HasComment("Справки"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_limiting_parameter"); + + b.HasComment("Ограничения по параметрам телеметрии"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("data") + .HasComment("Данные таблицы последних данных"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Пометка удаленным"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("timestamp") + .HasComment("время добавления"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_measure"); + + b.HasComment("Таблица c данными для вкладки 'Последние данные'"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_measure_category"); + + b.HasComment("Категория последних данных"); + + b.HasData( + new + { + Id = 1, + Name = "Показатели бурового раствора", + ShortName = "Раствор" + }, + new + { + Id = 2, + Name = "Шламограмма", + ShortName = "Шламограмма" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "ННБ" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdNotificationCategory") + .HasColumnType("integer") + .HasColumnName("id_notification_category") + .HasComment("Id категории уведомления"); + + b.Property("IdTransportType") + .HasColumnType("integer") + .HasColumnName("id_transport_type") + .HasComment("Id типа доставки уведомления"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id получателя"); + + b.Property("Message") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message") + .HasComment("Сообщение уведомления"); + + b.Property("ReadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("read_date") + .HasComment("Дата прочтения уведомления"); + + b.Property("SentDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("sent_date") + .HasComment("Дата отправки уведомления"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasColumnName("title") + .HasComment("Заголовок уведомления"); + + b.HasKey("Id"); + + b.HasIndex("IdNotificationCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_notification"); + + b.HasComment("Уведомления"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_notification_category"); + + b.HasComment("Категории уведомлений"); + + b.HasData( + new + { + Id = 1, + Name = "Системные уведомления" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Конечная глубина"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Старотовая глубина"); + + b.Property("IdOperationCategory") + .HasColumnType("integer") + .HasColumnName("id_operation_category") + .HasComment("Ид категории операции"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Ид скважины"); + + b.Property("StandardValue") + .HasColumnType("double precision") + .HasColumnName("standard_value") + .HasComment("Нормативный показатель"); + + b.Property("TargetValue") + .HasColumnType("double precision") + .HasColumnName("target_value") + .HasComment("Целевой показатель"); + + b.HasKey("Id"); + + b.HasIndex("IdOperationCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_operationvalue"); + + b.HasComment("Целевые/нормативные показатели операции"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description") + .HasComment("Краткое описание"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_permission"); + + b.HasComment("Разрешения на доступ к данным"); + + b.HasData( + new + { + Id = 100, + Description = "Разрешение удалять админ. Кусты", + Name = "AdminCluster.delete" + }, + new + { + Id = 101, + Description = "Разрешение редактировать админ. Кусты", + Name = "AdminCluster.edit" + }, + new + { + Id = 102, + Description = "Разрешение просматривать админ. Кусты", + Name = "AdminCluster.get" + }, + new + { + Id = 103, + Description = "Разрешение удалять админ. Компании", + Name = "AdminCompany.delete" + }, + new + { + Id = 104, + Description = "Разрешение редактировать админ. Компании", + Name = "AdminCompany.edit" + }, + new + { + Id = 105, + Description = "Разрешение просматривать админ. Компании", + Name = "AdminCompany.get" + }, + new + { + Id = 106, + Description = "Разрешение удалять админ. Типы компаний", + Name = "AdminCompanyType.delete" + }, + new + { + Id = 107, + Description = "Разрешение редактировать админ. Типы компаний", + Name = "AdminCompanyType.edit" + }, + new + { + Id = 108, + Description = "Разрешение просматривать админ. Типы компаний", + Name = "AdminCompanyType.get" + }, + new + { + Id = 109, + Description = "Разрешение удалять админ. Месторождения", + Name = "AdminDeposit.delete" + }, + new + { + Id = 110, + Description = "Разрешение редактировать админ. Месторождения", + Name = "AdminDeposit.edit" + }, + new + { + Id = 111, + Description = "Разрешение просматривать админ. Месторождения", + Name = "AdminDeposit.get" + }, + new + { + Id = 112, + Description = "Разрешение удалять админ. Разрешения", + Name = "AdminPermission.delete" + }, + new + { + Id = 113, + Description = "Разрешение редактировать админ. Разрешения", + Name = "AdminPermission.edit" + }, + new + { + Id = 114, + Description = "Разрешение просматривать админ. Разрешения", + Name = "AdminPermission.get" + }, + new + { + Id = 115, + Description = "Разрешение удалять админ. Телеметрию", + Name = "AdminTelemetry.delete" + }, + new + { + Id = 116, + Description = "Разрешение редактировать админ. Телеметрию", + Name = "AdminTelemetry.edit" + }, + new + { + Id = 117, + Description = "Разрешение просматривать админ. Телеметрию", + Name = "AdminTelemetry.get" + }, + new + { + Id = 118, + Description = "Разрешение удалять админ. Пользователей", + Name = "AdminUser.delete" + }, + new + { + Id = 119, + Description = "Разрешение редактировать админ. Пользователей", + Name = "AdminUser.edit" + }, + new + { + Id = 120, + Description = "Разрешение просматривать админ. Пользователей", + Name = "AdminUser.get" + }, + new + { + Id = 121, + Description = "Разрешение удалять админ. Роли пользователей", + Name = "AdminUserRole.delete" + }, + new + { + Id = 122, + Description = "Разрешение редактировать админ. Роли пользователей", + Name = "AdminUserRole.edit" + }, + new + { + Id = 123, + Description = "Разрешение просматривать админ. Роли пользователей", + Name = "AdminUserRole.get" + }, + new + { + Id = 124, + Description = "Разрешение удалять админ. Скважины", + Name = "AdminWell.delete" + }, + new + { + Id = 125, + Description = "Разрешение редактировать админ. Скважины", + Name = "AdminWell.edit" + }, + new + { + Id = 126, + Description = "Разрешение просматривать админ. Скважины", + Name = "AdminWell.get" + }, + new + { + Id = 127, + Description = "Разрешение удалять админ. Подсистемы", + Name = "AdminSubsytem.delete" + }, + new + { + Id = 128, + Description = "Разрешение редактировать админ. Подсистемы", + Name = "AdminSubsytem.edit" + }, + new + { + Id = 129, + Description = "Разрешение просматривать админ. Подсистемы", + Name = "AdminSubsytem.get" + }, + new + { + Id = 200, + Description = "Разрешение редактировать 0", + Name = "Auth.edit" + }, + new + { + Id = 201, + Description = "Разрешение просматривать 0", + Name = "Auth.get" + }, + new + { + Id = 202, + Description = "Разрешение просматривать Кусты", + Name = "Cluster.get" + }, + new + { + Id = 203, + Description = "Разрешение просматривать Месторождения", + Name = "Deposit.get" + }, + new + { + Id = 204, + Description = "Разрешение удалять РТК", + Name = "DrillFlowChart.delete" + }, + new + { + Id = 205, + Description = "Разрешение редактировать РТК", + Name = "DrillFlowChart.edit" + }, + new + { + Id = 206, + Description = "Разрешение просматривать РТК", + Name = "DrillFlowChart.get" + }, + new + { + Id = 207, + Description = "Разрешение удалять Программу бурения", + Name = "DrillingProgram.delete" + }, + new + { + Id = 208, + Description = "Разрешение редактировать Программу бурения", + Name = "DrillingProgram.edit" + }, + new + { + Id = 209, + Description = "Разрешение просматривать Программу бурения", + Name = "DrillingProgram.get" + }, + new + { + Id = 210, + Description = "Разрешение удалять Режимы бурения", + Name = "DrillParams.delete" + }, + new + { + Id = 211, + Description = "Разрешение редактировать Режимы бурения", + Name = "DrillParams.edit" + }, + new + { + Id = 212, + Description = "Разрешение просматривать Режимы бурения", + Name = "DrillParams.get" + }, + new + { + Id = 213, + Description = "Разрешение удалять Файлы", + Name = "File.delete" + }, + new + { + Id = 214, + Description = "Разрешение редактировать Файлы", + Name = "File.edit" + }, + new + { + Id = 215, + Description = "Разрешение просматривать Файлы", + Name = "File.get" + }, + new + { + Id = 216, + Description = "Разрешение удалять Измерения", + Name = "Measure.delete" + }, + new + { + Id = 217, + Description = "Разрешение редактировать Измерения", + Name = "Measure.edit" + }, + new + { + Id = 218, + Description = "Разрешение просматривать Измерения", + Name = "Measure.get" + }, + new + { + Id = 219, + Description = "Разрешение просматривать Сообщения телеметрии", + Name = "Message.get" + }, + new + { + Id = 220, + Description = "Разрешение просматривать Статистику по операциям", + Name = "OperationStat.get" + }, + new + { + Id = 221, + Description = "Разрешение редактировать Рапорта", + Name = "Report.edit" + }, + new + { + Id = 222, + Description = "Разрешение просматривать Рапорта", + Name = "Report.get" + }, + new + { + Id = 223, + Description = "Разрешение просматривать админ. Системная статистика", + Name = "RequestTracker.get" + }, + new + { + Id = 224, + Description = "Разрешение удалять Рекомендации уставок", + Name = "Setpoints.delete" + }, + new + { + Id = 225, + Description = "Разрешение редактировать Рекомендации уставок", + Name = "Setpoints.edit" + }, + new + { + Id = 226, + Description = "Разрешение просматривать Рекомендации уставок", + Name = "Setpoints.get" + }, + new + { + Id = 227, + Description = "Разрешение редактировать Телеметрии", + Name = "Telemetry.edit" + }, + new + { + Id = 228, + Description = "Разрешение просматривать Анализ телеметрии", + Name = "TelemetryAnalytics.get" + }, + new + { + Id = 229, + Description = "Разрешение редактировать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.edit" + }, + new + { + Id = 230, + Description = "Разрешение просматривать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.get" + }, + new + { + Id = 231, + Description = "Разрешение редактировать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.edit" + }, + new + { + Id = 232, + Description = "Разрешение просматривать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.get" + }, + new + { + Id = 233, + Description = "Разрешение редактировать Скважины", + Name = "Well.edit" + }, + new + { + Id = 234, + Description = "Разрешение просматривать Скважины", + Name = "Well.get" + }, + new + { + Id = 235, + Description = "Разрешение редактировать Композитные скважины", + Name = "WellComposite.edit" + }, + new + { + Id = 236, + Description = "Разрешение просматривать Композитные скважины", + Name = "WellComposite.get" + }, + new + { + Id = 237, + Description = "Разрешение удалять Операции по скважинам", + Name = "WellOperation.delete" + }, + new + { + Id = 238, + Description = "Разрешение редактировать Операции по скважинам", + Name = "WellOperation.edit" + }, + new + { + Id = 239, + Description = "Разрешение просматривать Операции по скважинам", + Name = "WellOperation.get" + }, + new + { + Id = 240, + Description = "Разрешение редактировать Файлы категории 1 (Растворный сервис)", + Name = "File.edit1" + }, + new + { + Id = 241, + Description = "Разрешение редактировать Файлы категории 2 (Цементирование)", + Name = "File.edit2" + }, + new + { + Id = 242, + Description = "Разрешение редактировать Файлы категории 3 (ННБ)", + Name = "File.edit3" + }, + new + { + Id = 243, + Description = "Разрешение редактировать Файлы категории 4 (ГТИ)", + Name = "File.edit4" + }, + new + { + Id = 244, + Description = "Разрешение редактировать Файлы категории 5 (Документы по скважине)", + Name = "File.edit5" + }, + new + { + Id = 245, + Description = "Разрешение редактировать Файлы категории 6 (Супервайзер)", + Name = "File.edit6" + }, + new + { + Id = 246, + Description = "Разрешение редактировать Файлы категории 7 (Мастер)", + Name = "File.edit7" + }, + new + { + Id = 247, + Description = "Разрешение редактировать Файлы категории 8 (Долотный сервис)", + Name = "File.edit8" + }, + new + { + Id = 248, + Description = "Разрешение редактировать Файлы категории 9 (Буровой подрядчик)", + Name = "File.edit9" + }, + new + { + Id = 249, + Description = "Разрешение редактировать Файлы категории 10 (Сервис по заканчиванию скважины)", + Name = "File.edit10" + }, + new + { + Id = 250, + Description = "Разрешение редактировать Файлы категории 11 (Рапорт)", + Name = "File.edit11" + }, + new + { + Id = 251, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit12" + }, + new + { + Id = 252, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit13" + }, + new + { + Id = 253, + Description = "Разрешение редактировать Файлы категории 13", + Name = "File.edit14" + }, + new + { + Id = 254, + Description = "Разрешение редактировать Файлы категории 14", + Name = "File.edit15" + }, + new + { + Id = 255, + Description = "Разрешение редактировать Файлы категории 15", + Name = "File.edit16" + }, + new + { + Id = 256, + Description = "Разрешение редактировать Файлы категории 16", + Name = "File.edit17" + }, + new + { + Id = 257, + Description = "Разрешение редактировать Файлы категории 17", + Name = "File.edit18" + }, + new + { + Id = 258, + Description = "Разрешение редактировать Файлы категории 18", + Name = "File.edit19" + }, + new + { + Id = 259, + Description = "Разрешение редактировать Файлы категории 19", + Name = "File.edit20" + }, + new + { + Id = 260, + Description = "Разрешение редактировать Файлы категории 20", + Name = "File.edit21" + }, + new + { + Id = 261, + Description = "Разрешение редактировать Файлы категории 21", + Name = "File.edit22" + }, + new + { + Id = 262, + Description = "Разрешение редактировать Файлы категории 22", + Name = "File.edit23" + }, + new + { + Id = 263, + Description = "Разрешение редактировать Файлы категории 23", + Name = "File.edit24" + }, + new + { + Id = 264, + Description = "Разрешение редактировать Файлы категории 24", + Name = "File.edit25" + }, + new + { + Id = 265, + Description = "Разрешение редактировать Файлы категории 25", + Name = "File.edit26" + }, + new + { + Id = 266, + Description = "Разрешение редактировать Файлы категории 26", + Name = "File.edit27" + }, + new + { + Id = 267, + Description = "Разрешение редактировать Файлы категории 27", + Name = "File.edit28" + }, + new + { + Id = 268, + Description = "Разрешение редактировать Файлы категории 28", + Name = "File.edit29" + }, + new + { + Id = 269, + Description = "Разрешение редактировать Файлы категории 29", + Name = "File.edit30" + }, + new + { + Id = 380, + Description = "Разрешение просматривать список бурильщиков", + Name = "Driller.get" + }, + new + { + Id = 381, + Description = "Разрешение редактировать бурильщика", + Name = "Driller.edit" + }, + new + { + Id = 382, + Description = "Разрешение удалять бурильщик", + Name = "Driller.delete" + }, + new + { + Id = 383, + Description = "Разрешение просматривать графики бурильщиков", + Name = "Schedule.get" + }, + new + { + Id = 384, + Description = "Разрешение редактировать график бурильщика", + Name = "Schedule.edit" + }, + new + { + Id = 385, + Description = "Разрешение удалять график бурильщика", + Name = "Schedule.delete" + }, + new + { + Id = 386, + Description = "Разрешение просматривать суточный рапорт", + Name = "DailyReport.get" + }, + new + { + Id = 387, + Description = "Разрешение редактировать суточный рапорт", + Name = "DailyReport.edit" + }, + new + { + Id = 388, + Description = "Разрешение просматривать авто. определенные операции", + Name = "DetectedOperation.get" + }, + new + { + Id = 389, + Description = "Разрешение просматривать целевые значения", + Name = "OperationValue.get" + }, + new + { + Id = 390, + Description = "Разрешение редактировать целевые значения", + Name = "OperationValue.edit" + }, + new + { + Id = 391, + Description = "Разрешение удалять целевые значения", + Name = "OperationValue.delete" + }, + new + { + Id = 400, + Description = "Разрешение просматривать инфо по wits параметрам", + Name = "WitsInfo.get" + }, + new + { + Id = 401, + Description = "Разрешение просматривать WITS record 1", + Name = "WitsRecord1.get" + }, + new + { + Id = 407, + Description = "Разрешение просматривать WITS record 7", + Name = "WitsRecord7.get" + }, + new + { + Id = 408, + Description = "Разрешение просматривать WITS record 8", + Name = "WitsRecord8.get" + }, + new + { + Id = 450, + Description = "Разрешение просматривать WITS record 50", + Name = "WitsRecord50.get" + }, + new + { + Id = 460, + Description = "Разрешение просматривать WITS record 60", + Name = "WitsRecord60.get" + }, + new + { + Id = 461, + Description = "Разрешение просматривать WITS record 61", + Name = "WitsRecord61.get" + }, + new + { + Id = 500, + Description = "Разрешение удалять Категорий документов файлов", + Name = "FileCategory.delete" + }, + new + { + Id = 501, + Description = "Разрешение редактировать Категорий документов файлов", + Name = "FileCategory.edit" + }, + new + { + Id = 502, + Description = "Разрешение просматривать Категорий документов файлов", + Name = "FileCategory.get" + }, + new + { + Id = 503, + Description = "Разрешение удалять Дело скважины", + Name = "WellFinalDocuments.delete" + }, + new + { + Id = 504, + Description = "Разрешение редактировать Дело скважины", + Name = "WellFinalDocuments.edit" + }, + new + { + Id = 505, + Description = "Разрешение просматривать Дело скважины", + Name = "WellFinalDocuments.get" + }, + new + { + Id = 506, + Description = "Разрешение редактировать ответственных за загрузку файла Дело скважины", + Name = "WellFinalDocuments.editPublisher" + }, + new + { + Id = 507, + Description = "Разрешение просматривать наработка талевого каната", + Name = "TelemetryWirelineRunOut.get" + }, + new + { + Id = 510, + Description = "Разрешение просматривать плановая траектория", + Name = "PlannedTrajectory.get" + }, + new + { + Id = 511, + Description = "Разрешение редактировать плановая траектория", + Name = "PlannedTrajectory.edit" + }, + new + { + Id = 512, + Description = "Разрешение удалять плановая траектория", + 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 = "Разрешение просматривать статистику вопросов", + Name = "FaqStatistics.get" + }, + new + { + Id = 517, + Description = "Разрешение редактировать вопрос", + Name = "FaqStatistics.edit" + }, + new + { + Id = 518, + Description = "Разрешение удалять вопрос", + Name = "FaqStatistics.delete" + }, + new + { + Id = 519, + Description = "Разрешение просматривать список контактов", + Name = "WellContact.get" + }, + new + { + Id = 520, + Description = "Разрешение редактировать список контактов", + Name = "WellContact.edit" + }, + new + { + Id = 521, + Description = "Разрешить создание справок по страницам", + Name = "HelpPage.edit" + }, + new + { + Id = 522, + Description = "Разрешить удаление всех настроек пользователя", + Name = "UserSettings.delete" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AzimuthGeo") + .HasColumnType("double precision") + .HasColumnName("azimuth_geo") + .HasComment("Азимут Географ."); + + b.Property("AzimuthMagnetic") + .HasColumnType("double precision") + .HasColumnName("azimuth_magnetic") + .HasComment("Азимут Магнитный"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарии"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("ID пользователя который внес/изменил запись"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("Radius") + .HasColumnType("double precision") + .HasColumnName("radius") + .HasComment("Радиус цели"); + + b.Property("UpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("update_date") + .HasComment("Дата загрузки траектории"); + + b.Property("VerticalDepth") + .HasColumnType("double precision") + .HasColumnName("vertical_depth") + .HasComment("Глубина вертикальная"); + + b.Property("WellboreDepth") + .HasColumnType("double precision") + .HasColumnName("wellbore_depth") + .HasComment("Глубина по стволу"); + + b.Property("ZenithAngle") + .HasColumnType("double precision") + .HasColumnName("zenith_angle") + .HasComment("Угол зенитный"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.ToTable("t_planned_trajectory"); + + b.HasComment("Загрузка плановой траектории"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Нагрузка, допустимый максимум"); + + b.Property("AxialLoadPlan") + .HasColumnType("double precision") + .HasColumnName("axial_load_plan") + .HasComment("Нагрузка, план"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина окончания интервала"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Стартовая глубина"); + + b.Property("FlowLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_limit_max") + .HasComment("Расход, допустимый максимум"); + + b.Property("FlowPlan") + .HasColumnType("double precision") + .HasColumnName("flow_plan") + .HasComment("Расход, план"); + + b.Property("IdMode") + .HasColumnType("integer") + .HasColumnName("id_mode") + .HasComment("Id режима (1- ротор, 2 слайд)"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("well_id") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("PressureLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_limit_max") + .HasComment("Перепад давления, допустимый максимум"); + + b.Property("PressurePlan") + .HasColumnType("double precision") + .HasColumnName("pressure_plan") + .HasComment("Перепад давления, план"); + + b.Property("RopPlan") + .HasColumnType("double precision") + .HasColumnName("rop_plan") + .HasComment("Плановая механическая скорость, м/ч"); + + b.Property("TopDriveSpeedLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_limit_max") + .HasComment("Обороты на ВСП, допустимый максимум"); + + b.Property("TopDriveSpeedPlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_plan") + .HasComment("Обороты на ВСП, план"); + + b.Property("TopDriveTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_limit_max") + .HasComment("Момент на ВСП, допустимый максимум"); + + b.Property("TopDriveTorquePlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_plan") + .HasComment("Момент на ВСП, план"); + + b.Property("UsageSaub") + .HasColumnType("double precision") + .HasColumnName("usage_saub") + .HasComment("Плановый процент использования АКБ"); + + b.Property("UsageSpin") + .HasColumnType("double precision") + .HasColumnName("usage_spin") + .HasComment("Плановый процент использования spin master"); + + b.HasKey("Id"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map"); + + b.HasComment("Операции по скважине – РТК"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => + { + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("IdCompany", "IdWell"); + + b.HasIndex("IdWell"); + + b.ToTable("t_relation_company_well"); + + b.HasComment("отношение скважин и компаний"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.HasKey("IdWell", "IdUser"); + + b.HasIndex("IdUser"); + + b.ToTable("t_relation_contact_well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdDrillingProgramPart") + .HasColumnType("integer") + .HasColumnName("id_drilling_program_part"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_role") + .HasComment("1 - publisher, 2 - approver"); + + b.HasKey("IdUser", "IdDrillingProgramPart") + .HasName("t_relation_user_drilling_program_part_pk"); + + b.HasIndex("IdDrillingProgramPart"); + + b.ToTable("t_relation_user_drilling_program_part"); + + b.HasComment("Отношение пользователей и частей ПБ"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdPermission") + .HasColumnType("integer") + .HasColumnName("id_permission"); + + b.HasKey("IdUserRole", "IdPermission"); + + b.HasIndex("IdPermission"); + + b.ToTable("t_relation_user_role_permission"); + + b.HasComment("Отношение ролей пользователей и разрешений доступа"); + + b.HasData( + new + { + IdUserRole = 1100, + IdPermission = 102 + }, + new + { + IdUserRole = 1100, + IdPermission = 111 + }, + new + { + IdUserRole = 1101, + IdPermission = 101 + }, + new + { + IdUserRole = 1101, + IdPermission = 100 + }, + new + { + IdUserRole = 1102, + IdPermission = 105 + }, + new + { + IdUserRole = 1102, + IdPermission = 108 + }, + new + { + IdUserRole = 1103, + IdPermission = 104 + }, + new + { + IdUserRole = 1103, + IdPermission = 103 + }, + new + { + IdUserRole = 1104, + IdPermission = 108 + }, + new + { + IdUserRole = 1105, + IdPermission = 107 + }, + new + { + IdUserRole = 1105, + IdPermission = 106 + }, + new + { + IdUserRole = 1106, + IdPermission = 111 + }, + new + { + IdUserRole = 1107, + IdPermission = 110 + }, + new + { + IdUserRole = 1107, + IdPermission = 109 + }, + new + { + IdUserRole = 1108, + IdPermission = 114 + }, + new + { + IdUserRole = 1109, + IdPermission = 113 + }, + new + { + IdUserRole = 1109, + IdPermission = 112 + }, + new + { + IdUserRole = 1110, + IdPermission = 123 + }, + new + { + IdUserRole = 1110, + IdPermission = 114 + }, + new + { + IdUserRole = 1111, + IdPermission = 122 + }, + new + { + IdUserRole = 1111, + IdPermission = 121 + }, + new + { + IdUserRole = 1112, + IdPermission = 117 + }, + new + { + IdUserRole = 1113, + IdPermission = 105 + }, + new + { + IdUserRole = 1113, + IdPermission = 123 + }, + new + { + IdUserRole = 1113, + IdPermission = 120 + }, + new + { + IdUserRole = 1114, + IdPermission = 119 + }, + new + { + IdUserRole = 1114, + IdPermission = 118 + }, + new + { + IdUserRole = 1114, + IdPermission = 200 + }, + new + { + IdUserRole = 1115, + IdPermission = 223 + }, + new + { + IdUserRole = 1116, + IdPermission = 105 + }, + new + { + IdUserRole = 1116, + IdPermission = 102 + }, + new + { + IdUserRole = 1116, + IdPermission = 117 + }, + new + { + IdUserRole = 1116, + IdPermission = 126 + }, + new + { + IdUserRole = 1117, + IdPermission = 125 + }, + new + { + IdUserRole = 1117, + IdPermission = 124 + }, + new + { + IdUserRole = 1200, + IdPermission = 203 + }, + new + { + IdUserRole = 1200, + IdPermission = 230 + }, + new + { + IdUserRole = 1201, + IdPermission = 202 + }, + new + { + IdUserRole = 1201, + IdPermission = 203 + }, + new + { + IdUserRole = 1201, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 203 + }, + new + { + IdUserRole = 1202, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 236 + }, + new + { + IdUserRole = 1202, + IdPermission = 212 + }, + new + { + IdUserRole = 1203, + IdPermission = 235 + }, + new + { + IdUserRole = 1204, + IdPermission = 202 + }, + new + { + IdUserRole = 1204, + IdPermission = 203 + }, + new + { + IdUserRole = 1205, + IdPermission = 215 + }, + new + { + IdUserRole = 1206, + IdPermission = 203 + }, + new + { + IdUserRole = 1206, + IdPermission = 206 + }, + new + { + IdUserRole = 1207, + IdPermission = 205 + }, + new + { + IdUserRole = 1208, + IdPermission = 218 + }, + new + { + IdUserRole = 1209, + IdPermission = 217 + }, + new + { + IdUserRole = 1210, + IdPermission = 203 + }, + new + { + IdUserRole = 1210, + IdPermission = 230 + }, + new + { + IdUserRole = 1210, + IdPermission = 219 + }, + new + { + IdUserRole = 1211, + IdPermission = 203 + }, + new + { + IdUserRole = 1211, + IdPermission = 220 + }, + new + { + IdUserRole = 1211, + IdPermission = 239 + }, + new + { + IdUserRole = 1212, + IdPermission = 238 + }, + new + { + IdUserRole = 1212, + IdPermission = 237 + }, + new + { + IdUserRole = 1213, + IdPermission = 203 + }, + new + { + IdUserRole = 1213, + IdPermission = 239 + }, + new + { + IdUserRole = 1213, + IdPermission = 212 + }, + new + { + IdUserRole = 1214, + IdPermission = 211 + }, + new + { + IdUserRole = 1214, + IdPermission = 210 + }, + new + { + IdUserRole = 1215, + IdPermission = 203 + }, + new + { + IdUserRole = 1215, + IdPermission = 222 + }, + new + { + IdUserRole = 1216, + IdPermission = 221 + }, + new + { + IdUserRole = 1217, + IdPermission = 226 + }, + new + { + IdUserRole = 1218, + IdPermission = 225 + }, + new + { + IdUserRole = 1218, + IdPermission = 224 + }, + new + { + IdUserRole = 1219, + IdPermission = 203 + }, + new + { + IdUserRole = 1219, + IdPermission = 206 + }, + new + { + IdUserRole = 1219, + IdPermission = 230 + }, + new + { + IdUserRole = 1219, + IdPermission = 232 + }, + new + { + IdUserRole = 1220, + IdPermission = 203 + }, + new + { + IdUserRole = 1220, + IdPermission = 228 + }, + new + { + IdUserRole = 1221, + IdPermission = 202 + }, + new + { + IdUserRole = 1221, + IdPermission = 203 + }, + new + { + IdUserRole = 1221, + IdPermission = 220 + }, + new + { + IdUserRole = 1221, + IdPermission = 234 + }, + new + { + IdUserRole = 1500, + IdPermission = 507 + }, + new + { + IdUserRole = 1500, + IdPermission = 510 + }, + new + { + IdUserRole = 1501, + IdPermission = 214 + }, + new + { + IdUserRole = 1501, + IdPermission = 213 + }, + new + { + IdUserRole = 1502, + IdPermission = 207 + }, + new + { + IdUserRole = 1502, + IdPermission = 208 + }, + new + { + IdUserRole = 2000, + IdPermission = 205 + }, + new + { + IdUserRole = 2000, + IdPermission = 204 + }, + new + { + IdUserRole = 2000, + IdPermission = 245 + }, + new + { + IdUserRole = 2001, + IdPermission = 244 + }, + new + { + IdUserRole = 2001, + IdPermission = 245 + }, + new + { + IdUserRole = 2002, + IdPermission = 244 + }, + new + { + IdUserRole = 2002, + IdPermission = 246 + }, + new + { + IdUserRole = 2002, + IdPermission = 237 + }, + new + { + IdUserRole = 2002, + IdPermission = 238 + }, + new + { + IdUserRole = 2003, + IdPermission = 240 + }, + new + { + IdUserRole = 2003, + IdPermission = 217 + }, + new + { + IdUserRole = 2003, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 242 + }, + new + { + IdUserRole = 2004, + IdPermission = 217 + }, + new + { + IdUserRole = 2004, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 205 + }, + new + { + IdUserRole = 2004, + IdPermission = 204 + }, + new + { + IdUserRole = 2005, + IdPermission = 247 + }, + new + { + IdUserRole = 2005, + IdPermission = 205 + }, + new + { + IdUserRole = 2005, + IdPermission = 204 + }, + new + { + IdUserRole = 2006, + IdPermission = 243 + }, + new + { + IdUserRole = 2006, + IdPermission = 205 + }, + new + { + IdUserRole = 2006, + IdPermission = 204 + }, + new + { + IdUserRole = 2007, + IdPermission = 241 + }, + new + { + IdUserRole = 2007, + IdPermission = 205 + }, + new + { + IdUserRole = 2007, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 100 + }, + new + { + IdUserRole = 1, + IdPermission = 101 + }, + new + { + IdUserRole = 1, + IdPermission = 102 + }, + new + { + IdUserRole = 1, + IdPermission = 103 + }, + new + { + IdUserRole = 1, + IdPermission = 104 + }, + new + { + IdUserRole = 1, + IdPermission = 105 + }, + new + { + IdUserRole = 1, + IdPermission = 106 + }, + new + { + IdUserRole = 1, + IdPermission = 107 + }, + new + { + IdUserRole = 1, + IdPermission = 108 + }, + new + { + IdUserRole = 1, + IdPermission = 109 + }, + new + { + IdUserRole = 1, + IdPermission = 110 + }, + new + { + IdUserRole = 1, + IdPermission = 111 + }, + new + { + IdUserRole = 1, + IdPermission = 112 + }, + new + { + IdUserRole = 1, + IdPermission = 113 + }, + new + { + IdUserRole = 1, + IdPermission = 114 + }, + new + { + IdUserRole = 1, + IdPermission = 115 + }, + new + { + IdUserRole = 1, + IdPermission = 116 + }, + new + { + IdUserRole = 1, + IdPermission = 117 + }, + new + { + IdUserRole = 1, + IdPermission = 118 + }, + new + { + IdUserRole = 1, + IdPermission = 119 + }, + new + { + IdUserRole = 1, + IdPermission = 120 + }, + new + { + IdUserRole = 1, + IdPermission = 121 + }, + new + { + IdUserRole = 1, + IdPermission = 122 + }, + new + { + IdUserRole = 1, + IdPermission = 123 + }, + new + { + IdUserRole = 1, + IdPermission = 124 + }, + new + { + IdUserRole = 1, + IdPermission = 125 + }, + new + { + IdUserRole = 1, + IdPermission = 126 + }, + new + { + IdUserRole = 1, + IdPermission = 127 + }, + new + { + IdUserRole = 1, + IdPermission = 128 + }, + new + { + IdUserRole = 1, + IdPermission = 129 + }, + new + { + IdUserRole = 1, + IdPermission = 200 + }, + new + { + IdUserRole = 1, + IdPermission = 201 + }, + new + { + IdUserRole = 1, + IdPermission = 202 + }, + new + { + IdUserRole = 1, + IdPermission = 203 + }, + new + { + IdUserRole = 1, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 205 + }, + new + { + IdUserRole = 1, + IdPermission = 206 + }, + new + { + IdUserRole = 1, + IdPermission = 207 + }, + new + { + IdUserRole = 1, + IdPermission = 208 + }, + new + { + IdUserRole = 1, + IdPermission = 209 + }, + new + { + IdUserRole = 1, + IdPermission = 210 + }, + new + { + IdUserRole = 1, + IdPermission = 211 + }, + new + { + IdUserRole = 1, + IdPermission = 212 + }, + new + { + IdUserRole = 1, + IdPermission = 213 + }, + new + { + IdUserRole = 1, + IdPermission = 214 + }, + new + { + IdUserRole = 1, + IdPermission = 215 + }, + new + { + IdUserRole = 1, + IdPermission = 216 + }, + new + { + IdUserRole = 1, + IdPermission = 217 + }, + new + { + IdUserRole = 1, + IdPermission = 218 + }, + new + { + IdUserRole = 1, + IdPermission = 219 + }, + new + { + IdUserRole = 1, + IdPermission = 220 + }, + new + { + IdUserRole = 1, + IdPermission = 221 + }, + new + { + IdUserRole = 1, + IdPermission = 222 + }, + new + { + IdUserRole = 1, + IdPermission = 223 + }, + new + { + IdUserRole = 1, + IdPermission = 224 + }, + new + { + IdUserRole = 1, + IdPermission = 225 + }, + new + { + IdUserRole = 1, + IdPermission = 226 + }, + new + { + IdUserRole = 1, + IdPermission = 227 + }, + new + { + IdUserRole = 1, + IdPermission = 228 + }, + new + { + IdUserRole = 1, + IdPermission = 229 + }, + new + { + IdUserRole = 1, + IdPermission = 230 + }, + new + { + IdUserRole = 1, + IdPermission = 231 + }, + new + { + IdUserRole = 1, + IdPermission = 232 + }, + new + { + IdUserRole = 1, + IdPermission = 233 + }, + new + { + IdUserRole = 1, + IdPermission = 234 + }, + new + { + IdUserRole = 1, + IdPermission = 235 + }, + new + { + IdUserRole = 1, + IdPermission = 236 + }, + new + { + IdUserRole = 1, + IdPermission = 237 + }, + new + { + IdUserRole = 1, + IdPermission = 238 + }, + new + { + IdUserRole = 1, + IdPermission = 239 + }, + new + { + IdUserRole = 1, + IdPermission = 240 + }, + new + { + IdUserRole = 1, + IdPermission = 241 + }, + new + { + IdUserRole = 1, + IdPermission = 242 + }, + new + { + IdUserRole = 1, + IdPermission = 243 + }, + new + { + IdUserRole = 1, + IdPermission = 244 + }, + new + { + IdUserRole = 1, + IdPermission = 245 + }, + new + { + IdUserRole = 1, + IdPermission = 246 + }, + new + { + IdUserRole = 1, + IdPermission = 247 + }, + new + { + IdUserRole = 1, + IdPermission = 248 + }, + new + { + IdUserRole = 1, + IdPermission = 249 + }, + new + { + IdUserRole = 1, + IdPermission = 250 + }, + new + { + IdUserRole = 1, + IdPermission = 251 + }, + new + { + IdUserRole = 1, + IdPermission = 252 + }, + new + { + IdUserRole = 1, + IdPermission = 253 + }, + new + { + IdUserRole = 1, + IdPermission = 254 + }, + new + { + IdUserRole = 1, + IdPermission = 255 + }, + new + { + IdUserRole = 1, + IdPermission = 256 + }, + new + { + IdUserRole = 1, + IdPermission = 257 + }, + new + { + IdUserRole = 1, + IdPermission = 258 + }, + new + { + IdUserRole = 1, + IdPermission = 259 + }, + new + { + IdUserRole = 1, + IdPermission = 260 + }, + new + { + IdUserRole = 1, + IdPermission = 261 + }, + new + { + IdUserRole = 1, + IdPermission = 262 + }, + new + { + IdUserRole = 1, + IdPermission = 263 + }, + new + { + IdUserRole = 1, + IdPermission = 264 + }, + new + { + IdUserRole = 1, + IdPermission = 265 + }, + new + { + IdUserRole = 1, + IdPermission = 266 + }, + new + { + IdUserRole = 1, + IdPermission = 267 + }, + new + { + IdUserRole = 1, + IdPermission = 268 + }, + new + { + IdUserRole = 1, + IdPermission = 269 + }, + new + { + IdUserRole = 1, + IdPermission = 380 + }, + new + { + IdUserRole = 1, + IdPermission = 381 + }, + new + { + IdUserRole = 1, + IdPermission = 382 + }, + new + { + IdUserRole = 1, + IdPermission = 383 + }, + new + { + IdUserRole = 1, + IdPermission = 384 + }, + new + { + IdUserRole = 1, + IdPermission = 385 + }, + new + { + IdUserRole = 1, + IdPermission = 386 + }, + new + { + IdUserRole = 1, + IdPermission = 387 + }, + new + { + IdUserRole = 1, + IdPermission = 388 + }, + new + { + IdUserRole = 1, + IdPermission = 389 + }, + new + { + IdUserRole = 1, + IdPermission = 390 + }, + new + { + IdUserRole = 1, + IdPermission = 391 + }, + new + { + IdUserRole = 1, + IdPermission = 400 + }, + new + { + IdUserRole = 1, + IdPermission = 401 + }, + new + { + IdUserRole = 1, + IdPermission = 407 + }, + new + { + IdUserRole = 1, + IdPermission = 408 + }, + new + { + IdUserRole = 1, + IdPermission = 450 + }, + new + { + IdUserRole = 1, + IdPermission = 460 + }, + new + { + IdUserRole = 1, + IdPermission = 461 + }, + new + { + IdUserRole = 1, + IdPermission = 500 + }, + new + { + IdUserRole = 1, + IdPermission = 501 + }, + new + { + IdUserRole = 1, + IdPermission = 502 + }, + new + { + IdUserRole = 1, + IdPermission = 503 + }, + new + { + IdUserRole = 1, + IdPermission = 504 + }, + new + { + IdUserRole = 1, + IdPermission = 505 + }, + new + { + IdUserRole = 1, + IdPermission = 506 + }, + new + { + IdUserRole = 1, + IdPermission = 507 + }, + new + { + IdUserRole = 1, + IdPermission = 510 + }, + new + { + IdUserRole = 1, + IdPermission = 511 + }, + new + { + IdUserRole = 1, + IdPermission = 512 + }, + new + { + IdUserRole = 1, + IdPermission = 513 + }, + new + { + IdUserRole = 1, + IdPermission = 514 + }, + new + { + IdUserRole = 1, + IdPermission = 515 + }, + new + { + IdUserRole = 1, + IdPermission = 516 + }, + new + { + IdUserRole = 1, + IdPermission = 517 + }, + new + { + IdUserRole = 1, + IdPermission = 518 + }, + new + { + IdUserRole = 1, + IdPermission = 519 + }, + new + { + IdUserRole = 1, + IdPermission = 520 + }, + new + { + IdUserRole = 1, + IdPermission = 521 + }, + new + { + IdUserRole = 1, + IdPermission = 522 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdInclude") + .HasColumnType("integer") + .HasColumnName("id_include_user_role"); + + b.HasKey("Id", "IdInclude") + .HasName("t_relation_user_role_user_role_pk"); + + b.HasIndex("IdInclude"); + + b.ToTable("t_relation_user_role_user_role"); + + b.HasComment("Отношение ролей к ролям"); + + b.HasData( + new + { + Id = 1101, + IdInclude = 1100 + }, + new + { + Id = 1103, + IdInclude = 1102 + }, + new + { + Id = 1105, + IdInclude = 1104 + }, + new + { + Id = 1107, + IdInclude = 1106 + }, + new + { + Id = 1109, + IdInclude = 1108 + }, + new + { + Id = 1111, + IdInclude = 1110 + }, + new + { + Id = 1114, + IdInclude = 1113 + }, + new + { + Id = 1117, + IdInclude = 1116 + }, + new + { + Id = 1203, + IdInclude = 1202 + }, + new + { + Id = 1207, + IdInclude = 1206 + }, + new + { + Id = 1209, + IdInclude = 1208 + }, + new + { + Id = 1212, + IdInclude = 1211 + }, + new + { + Id = 1214, + IdInclude = 1213 + }, + new + { + Id = 1216, + IdInclude = 1215 + }, + new + { + Id = 1218, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1200 + }, + new + { + Id = 2000, + IdInclude = 1201 + }, + new + { + Id = 2000, + IdInclude = 1202 + }, + new + { + Id = 2000, + IdInclude = 1204 + }, + new + { + Id = 2000, + IdInclude = 1205 + }, + new + { + Id = 2000, + IdInclude = 1206 + }, + new + { + Id = 2000, + IdInclude = 1208 + }, + new + { + Id = 2000, + IdInclude = 1210 + }, + new + { + Id = 2000, + IdInclude = 1211 + }, + new + { + Id = 2000, + IdInclude = 1213 + }, + new + { + Id = 2000, + IdInclude = 1215 + }, + new + { + Id = 2000, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1219 + }, + new + { + Id = 2000, + IdInclude = 1220 + }, + new + { + Id = 2000, + IdInclude = 1221 + }, + new + { + Id = 2000, + IdInclude = 1500 + }, + new + { + Id = 2000, + IdInclude = 1501 + }, + new + { + Id = 2000, + IdInclude = 1502 + }, + new + { + Id = 2001, + IdInclude = 1500 + }, + new + { + Id = 2001, + IdInclude = 1501 + }, + new + { + Id = 2001, + IdInclude = 1502 + }, + new + { + Id = 2002, + IdInclude = 1500 + }, + new + { + Id = 2002, + IdInclude = 1501 + }, + new + { + Id = 2002, + IdInclude = 1502 + }, + new + { + Id = 2003, + IdInclude = 1500 + }, + new + { + Id = 2003, + IdInclude = 1501 + }, + new + { + Id = 2003, + IdInclude = 1502 + }, + new + { + Id = 2004, + IdInclude = 1500 + }, + new + { + Id = 2004, + IdInclude = 1501 + }, + new + { + Id = 2004, + IdInclude = 1502 + }, + new + { + Id = 2005, + IdInclude = 1500 + }, + new + { + Id = 2005, + IdInclude = 1501 + }, + new + { + Id = 2005, + IdInclude = 1502 + }, + new + { + Id = 2006, + IdInclude = 1500 + }, + new + { + Id = 2006, + IdInclude = 1501 + }, + new + { + Id = 2006, + IdInclude = 1502 + }, + new + { + Id = 2007, + IdInclude = 1500 + }, + new + { + Id = 2007, + IdInclude = 1501 + }, + new + { + Id = 2007, + IdInclude = 1502 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.HasKey("IdUser", "IdUserRole"); + + b.HasIndex("IdUserRole"); + + b.ToTable("t_relation_user_user_role"); + + b.HasComment("Отношение пользователей и ролей"); + + b.HasData( + new + { + IdUser = 1, + IdUserRole = 1 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Begin") + .HasColumnType("timestamp with time zone") + .HasColumnName("begin"); + + b.Property("End") + .HasColumnType("timestamp with time zone") + .HasColumnName("end") + .HasComment("timestamp with time zone"); + + b.Property("Format") + .HasColumnType("integer") + .HasColumnName("format") + .HasComment("Формат отчета"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла-родителя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("Step") + .HasColumnType("integer") + .HasColumnName("step") + .HasComment("размер шага в секундах"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdWell"); + + b.ToTable("t_report_property"); + + b.HasComment("Отчеты с данными по буровым"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DrillEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_end") + .HasComment("Конец вахты"); + + b.Property("DrillStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_start") + .HasComment("Начало вахты"); + + b.Property("IdDriller") + .HasColumnType("integer") + .HasColumnName("id_driller") + .HasComment("Идентификатор бурильщика"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Идентификатор скважины"); + + b.Property("ShiftEnd") + .HasColumnType("time without time zone") + .HasColumnName("shift_end") + .HasComment("Конец смены"); + + b.Property("ShiftStart") + .HasColumnType("time without time zone") + .HasColumnName("shift_start") + .HasComment("Начало смены"); + + b.HasKey("Id"); + + b.HasIndex("IdDriller"); + + b.HasIndex("IdWell"); + + b.ToTable("t_schedule"); + + b.HasComment("График работы бурильщика"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("комментарий для оператора"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("ObsolescenceSec") + .HasColumnType("integer") + .HasColumnName("obsolescence") + .HasComment("сек. до устаревания"); + + b.Property("Setpoints") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("setpoint_set") + .HasComment("Набор уставок"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdWell"); + + b.ToTable("t_setpoints_rquest"); + + b.HasComment("Запросы на изменение уставок панели оператора"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.Subsystem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_subsystem"); + + b.HasComment("Описание подсистем"); + + b.HasData( + new + { + Id = 1, + Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\"", + Name = "АКБ" + }, + new + { + Id = 2, + Description = "Алгоритм поиска оптимальных параметров бурения САУБ", + Name = "MSE" + }, + new + { + Id = 65536, + Description = "Spin master", + Name = "Spin master" + }, + new + { + Id = 65537, + Description = "Torque master", + Name = "Torque master" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("дата/время выключения подсистемы"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("дата/время включения подсистемы"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end") + .HasComment("глубина забоя на момент выключения подсистемы"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start") + .HasComment("глубина забоя на момент включения подсистемы"); + + b.Property("IdSubsystem") + .HasColumnType("integer") + .HasColumnName("id_subsystem"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("ИД телеметрии по которой выдается информация"); + + b.HasKey("Id"); + + b.HasIndex("IdSubsystem"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_subsystem_operation_time"); + + b.HasComment("наработки подсистем"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Информация с панели о скважине"); + + b.Property("RemoteUid") + .IsRequired() + .HasColumnType("text") + .HasColumnName("remote_uid") + .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."); + + b.Property("TimeZone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); + + b.ToTable("t_telemetry"); + + b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("AxialLoad") + .HasColumnType("real") + .HasColumnName("axial_load") + .HasComment("Осевая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("real") + .HasColumnName("axial_load_limit_max") + .HasComment("Осевая нагрузка. Аварийная макс."); + + b.Property("AxialLoadSp") + .HasColumnType("real") + .HasColumnName("axial_load_sp") + .HasComment("Осевая нагрузка. Задание"); + + b.Property("BitDepth") + .HasColumnType("real") + .HasColumnName("bit_depth") + .HasComment("Положение инструмента"); + + b.Property("BlockPosition") + .HasColumnType("real") + .HasColumnName("block_position") + .HasComment("Высота талевого блока"); + + b.Property("BlockPositionMax") + .HasColumnType("real") + .HasColumnName("block_position_max") + .HasComment("Талевый блок. Макс положение"); + + b.Property("BlockPositionMin") + .HasColumnType("real") + .HasColumnName("block_position_min") + .HasComment("Талевый блок. Мин положение"); + + b.Property("BlockSpeed") + .HasColumnType("real") + .HasColumnName("block_speed") + .HasComment("Скорость талевого блока"); + + b.Property("BlockSpeedSp") + .HasColumnType("real") + .HasColumnName("block_speed_sp") + .HasComment("Скорости талевого блока. Задание"); + + b.Property("BlockSpeedSpDevelop") + .HasColumnType("real") + .HasColumnName("block_speed_sp_develop") + .HasComment("Талевый блок. Задание скорости для проработки"); + + b.Property("BlockSpeedSpRotor") + .HasColumnType("real") + .HasColumnName("block_speed_sp_rotor") + .HasComment("Талевый блок. Задание скорости для роторного бурения"); + + b.Property("BlockSpeedSpSlide") + .HasColumnType("real") + .HasColumnName("block_speed_sp_slide") + .HasComment("Талевый блок. Задание скорости для режима слайда"); + + b.Property("Flow") + .HasColumnType("real") + .HasColumnName("flow") + .HasComment("Расход"); + + b.Property("FlowDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("flow_delta_limit_max") + .HasComment("Расход. Аварийный макс."); + + b.Property("FlowIdle") + .HasColumnType("real") + .HasColumnName("flow_idle") + .HasComment("Расход. Холостой ход"); + + b.Property("HookWeight") + .HasColumnType("real") + .HasColumnName("hook_weight") + .HasComment("Вес на крюке"); + + b.Property("HookWeightIdle") + .HasColumnType("real") + .HasColumnName("hook_weight_idle") + .HasComment("Вес на крюке. Холостой ход"); + + b.Property("HookWeightLimitMax") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_max") + .HasComment("Вес на крюке. Затяжка"); + + b.Property("HookWeightLimitMin") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_min") + .HasComment("Вес на крюке. Посадка"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator") + .HasComment("Текущий критерий бурения"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Пользователь САУБ"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Режим САУБ"); + + b.Property("Mse") + .HasColumnType("real") + .HasColumnName("mse") + .HasComment("MSE"); + + b.Property("MseState") + .HasColumnType("smallint") + .HasColumnName("mse_state") + .HasComment("Текущее состояние работы MSE"); + + b.Property("Pressure") + .HasColumnType("real") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("pressure_delta_limit_max") + .HasComment("Давление дифф. Аварийное макс."); + + b.Property("PressureIdle") + .HasColumnType("real") + .HasColumnName("pressure_idle") + .HasComment("Давление. Холостой ход"); + + b.Property("PressureSp") + .HasColumnType("real") + .HasColumnName("pressure_sp") + .HasComment("Давление. Задание"); + + b.Property("PressureSpDevelop") + .HasColumnType("real") + .HasColumnName("pressure_sp_develop") + .HasComment("Давление. Задание для проработки"); + + b.Property("PressureSpRotor") + .HasColumnType("real") + .HasColumnName("pressure_sp_rotor") + .HasComment("Давление. Задание для роторного бурения"); + + b.Property("PressureSpSlide") + .HasColumnType("real") + .HasColumnName("pressure_sp_slide") + .HasComment("Давление. Задание для режима слайда"); + + b.Property("Pump0Flow") + .HasColumnType("real") + .HasColumnName("pump0_flow") + .HasComment("Расход. Буровой насос 1"); + + b.Property("Pump1Flow") + .HasColumnType("real") + .HasColumnName("pump1_flow") + .HasComment("Расход. Буровой насос 2"); + + b.Property("Pump2Flow") + .HasColumnType("real") + .HasColumnName("pump2_flow") + .HasComment("Расход. Буровой насос 3"); + + b.Property("RotorSpeed") + .HasColumnType("real") + .HasColumnName("rotor_speed") + .HasComment("Обороты ротора"); + + b.Property("RotorTorque") + .HasColumnType("real") + .HasColumnName("rotor_torque") + .HasComment("Момент на роторе"); + + b.Property("RotorTorqueIdle") + .HasColumnType("real") + .HasColumnName("rotor_torque_idle") + .HasComment("Момент на роторе. Холостой ход"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("real") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Момент на роторе. Аварийный макс."); + + b.Property("RotorTorqueSp") + .HasColumnType("real") + .HasColumnName("rotor_torque_sp") + .HasComment("Момент на роторе. Задание"); + + b.Property("WellDepth") + .HasColumnType("real") + .HasColumnName("well_depth") + .HasComment("Глубина забоя"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_saub"); + + b.HasComment("набор основных данных по SAUB"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaubStat", b => + { + b.Property("Count") + .HasColumnType("bigint") + .HasColumnName("count_items"); + + b.Property("DateMax") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_max"); + + b.Property("DateMin") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_min"); + + b.Property("DepthMax") + .HasColumnType("real") + .HasColumnName("depth_max"); + + b.Property("DepthMin") + .HasColumnType("real") + .HasColumnName("depth_min"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.ToView("mw_telemetry_datas_saub_stat"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Выбранный режим управления"); + + b.Property("PositionRight") + .HasColumnType("real") + .HasColumnName("position_right") + .HasComment("Крайний правый угол осцилляции"); + + b.Property("PositionZero") + .HasColumnType("real") + .HasColumnName("position_zero") + .HasComment("Нулевая позиция осцилляции"); + + b.Property("RevolsLeftLimit") + .HasColumnType("real") + .HasColumnName("revols_left_limit") + .HasComment("Ограничение числа оборотов влево"); + + b.Property("RevolsLeftTotal") + .HasColumnType("real") + .HasColumnName("revols_left_total") + .HasComment("Суммарное количество оборотов влево"); + + b.Property("RevolsRightLimit") + .HasColumnType("real") + .HasColumnName("revols_right_limit") + .HasComment("Ограничение числа оборотов вправо"); + + b.Property("RevolsRightTotal") + .HasColumnType("real") + .HasColumnName("revols_right_total") + .HasComment("Суммарное количество оборотов вправо"); + + b.Property("SpeedLeftSp") + .HasColumnType("real") + .HasColumnName("speed_left_sp") + .HasComment("Заданная скорость вращения влево"); + + b.Property("SpeedRightSp") + .HasColumnType("real") + .HasColumnName("speed_right_sp") + .HasComment("Заданная скорость вращения вправо"); + + b.Property("State") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("Переменная этапа"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_spin"); + + b.HasComment("набор основных данных по SpinMaster"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.Property("MessageTemplate") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message_template"); + + b.HasKey("IdTelemetry", "IdEvent"); + + b.ToTable("t_telemetry_event"); + + b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Arg0") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg0") + .HasComment("Аргумент №0 для вставки в шаблон сообщения"); + + b.Property("Arg1") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg1"); + + b.Property("Arg2") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg2"); + + b.Property("Arg3") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg3"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdTelemetryUser") + .HasColumnType("integer") + .HasColumnName("id_telemetry_user") + .HasComment("Пользователь панели отправляющей телеметрию. не пользователь облака."); + + b.Property("WellDepth") + .HasColumnType("double precision") + .HasColumnName("well_depth"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_message"); + + b.HasComment("Сообщения на буровых"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname"); + + b.HasKey("IdTelemetry", "IdUser"); + + b.ToTable("t_telemetry_user"); + + b.HasComment("Пользователи панели САУБ. Для сообщений."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryWirelineRunOut", b => + { + b.Property("IdTelemetry") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Идентификатор телеметрии"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("IdTelemetry")); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_time") + .HasComment("Отметка времени"); + + b.Property("Hauling") + .HasColumnType("real") + .HasColumnName("hauling") + .HasComment("Наработка талевого каната с момента перетяжки каната, т*км"); + + b.Property("HaulingWarnSp") + .HasColumnType("real") + .HasColumnName("hauling_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости перетяжки, т*км"); + + b.Property("Replace") + .HasColumnType("real") + .HasColumnName("replace") + .HasComment("Наработка талевого каната с момента замены каната, т*км"); + + b.Property("ReplaceWarnSp") + .HasColumnType("real") + .HasColumnName("replace_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости замены, т*км"); + + b.HasKey("IdTelemetry"); + + b.ToTable("t_telemetry_wireline_run_out"); + + b.HasComment("Наработка талевого каната"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("должность"); + + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdState") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("состояние:\n0 - не активен, \n1 - активен, \n2 - заблокирован"); + + b.Property("Login") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("login"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("имя"); + + b.Property("PasswordHash") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("password_hash") + .HasComment("соленый хэш пароля.\nпервые 5 символов - соль"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("отчество"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("phone") + .HasComment("номер телефона"); + + b.Property("Position") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("position") + .HasComment("email"); + + b.Property("Surname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("фамилия"); + + b.HasKey("Id"); + + b.HasIndex("IdCompany"); + + b.HasIndex("Login") + .IsUnique(); + + b.ToTable("t_user"); + + b.HasComment("Пользователи облака"); + + b.HasData( + new + { + Id = 1, + Email = "", + IdCompany = 1, + IdState = (short)1, + Login = "dev", + Name = "Разработчик", + PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя"); + + b.HasKey("Id"); + + b.ToTable("t_user_role"); + + b.HasComment("Роли пользователей в системе"); + + b.HasData( + new + { + Id = 1, + Caption = "root", + IdType = 1 + }, + new + { + Id = 1100, + Caption = "admin_cluster.view", + IdType = 1 + }, + new + { + Id = 1101, + Caption = "admin_cluster.edit", + IdType = 1 + }, + new + { + Id = 1102, + Caption = "admin_company.view", + IdType = 1 + }, + new + { + Id = 1103, + Caption = "admin_company.edit", + IdType = 1 + }, + new + { + Id = 1104, + Caption = "admin_company_type.view", + IdType = 1 + }, + new + { + Id = 1105, + Caption = "admin_company_type.edit", + IdType = 1 + }, + new + { + Id = 1106, + Caption = "admin_deposit.view", + IdType = 1 + }, + new + { + Id = 1107, + Caption = "admin_deposit.edit", + IdType = 1 + }, + new + { + Id = 1108, + Caption = "admin_permission.view", + IdType = 1 + }, + new + { + Id = 1109, + Caption = "admin_permission.edit", + IdType = 1 + }, + new + { + Id = 1110, + Caption = "admin_role.view", + IdType = 1 + }, + new + { + Id = 1111, + Caption = "admin_role.edit", + IdType = 1 + }, + new + { + Id = 1112, + Caption = "admin_telemetry.view", + IdType = 1 + }, + new + { + Id = 1113, + Caption = "admin_user.view", + IdType = 1 + }, + new + { + Id = 1114, + Caption = "admin_user.edit", + IdType = 1 + }, + new + { + Id = 1115, + Caption = "admin_visit_log.view", + IdType = 1 + }, + new + { + Id = 1116, + Caption = "admin_well.view", + IdType = 1 + }, + new + { + Id = 1117, + Caption = "admin_well.edit", + IdType = 1 + }, + new + { + Id = 1200, + Caption = "archive.view", + IdType = 1 + }, + new + { + Id = 1201, + Caption = "cluster.view", + IdType = 1 + }, + new + { + Id = 1202, + Caption = "composite.view", + IdType = 1 + }, + new + { + Id = 1203, + Caption = "composite.edit", + IdType = 1 + }, + new + { + Id = 1204, + Caption = "deposit.view", + IdType = 1 + }, + new + { + Id = 1205, + Caption = "document.view", + IdType = 1 + }, + new + { + Id = 1206, + Caption = "drillProcessFlow.view", + IdType = 1 + }, + new + { + Id = 1207, + Caption = "drillProcessFlow.edit", + IdType = 1 + }, + new + { + Id = 1208, + Caption = "measure.view", + IdType = 1 + }, + new + { + Id = 1209, + Caption = "measure.edit", + IdType = 1 + }, + new + { + Id = 1210, + Caption = "message.view", + IdType = 1 + }, + new + { + Id = 1211, + Caption = "operations.view", + IdType = 1 + }, + new + { + Id = 1212, + Caption = "operations.edit", + IdType = 1 + }, + new + { + Id = 1213, + Caption = "params.view", + IdType = 1 + }, + new + { + Id = 1214, + Caption = "params.edit", + IdType = 1 + }, + new + { + Id = 1215, + Caption = "report.view", + IdType = 1 + }, + new + { + Id = 1216, + Caption = "report.edit", + IdType = 1 + }, + new + { + Id = 1217, + Caption = "setpoints.view", + IdType = 1 + }, + new + { + Id = 1218, + Caption = "setpoints.edit", + IdType = 1 + }, + new + { + Id = 1219, + Caption = "telemetry.view", + IdType = 1 + }, + new + { + Id = 1220, + Caption = "telemetryAnalysis.view", + IdType = 1 + }, + new + { + Id = 1221, + Caption = "well.view", + IdType = 1 + }, + new + { + Id = 1500, + Caption = "Просмотр всего", + IdType = 1 + }, + new + { + Id = 1501, + Caption = "file.edit", + IdType = 1 + }, + new + { + Id = 1502, + Caption = "drillingProgram.edit", + IdType = 1 + }, + new + { + Id = 2000, + Caption = "Заказчик", + IdType = 0 + }, + new + { + Id = 2001, + Caption = "Супервайзер", + IdType = 0 + }, + new + { + Id = 2002, + Caption = "Буровой подрядчик", + IdType = 0 + }, + new + { + Id = 2003, + Caption = "Растворщик", + IdType = 0 + }, + new + { + Id = 2004, + Caption = "Телеметрист", + IdType = 0 + }, + new + { + Id = 2005, + Caption = "Долотный сервис", + IdType = 0 + }, + new + { + Id = 2006, + Caption = "ГТИ", + IdType = 0 + }, + new + { + Id = 2007, + Caption = "Цементирование", + IdType = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Key") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("key") + .HasComment("Ключ настроек пользователя"); + + b.Property("Value") + .HasColumnType("jsonb") + .HasColumnName("setting_value") + .HasComment("Значение настроек пользователя"); + + b.HasKey("IdUser", "Key"); + + b.ToTable("t_user_settings"); + + b.HasComment("настройки интерфейса пользователя"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCluster") + .HasColumnType("integer") + .HasColumnName("id_cluster"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("0 - неизвестно, 1 - в работе, 2 - завершена"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdWellType") + .HasColumnType("integer") + .HasColumnName("id_well_type"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdCluster"); + + b.HasIndex("IdTelemetry") + .IsUnique(); + + b.HasIndex("IdWellType"); + + b.ToTable("t_well"); + + b.HasComment("скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины получателя"); + + b.Property("IdWellSrc") + .HasColumnType("integer") + .HasColumnName("id_well_src") + .HasComment("Id скважины композита"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции композита"); + + b.HasKey("IdWell", "IdWellSrc", "IdWellSectionType"); + + b.HasIndex("IdWellSectionType"); + + b.HasIndex("IdWellSrc"); + + b.ToTable("t_well_composite"); + + b.HasComment("Композитная скважина"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.HasKey("IdWell", "IdUser", "IdCategory") + .HasName("t_well_final_documents_pk"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_well_final_documents"); + + b.HasComment("Дело скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryInfo") + .HasColumnType("text") + .HasColumnName("category_info") + .HasComment("Доп. информация к выбраной категории"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("DurationHours") + .HasColumnType("double precision") + .HasColumnName("duration_hours") + .HasComment("Продолжительность, часы"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdPlan") + .HasColumnType("integer") + .HasColumnName("id_plan") + .HasComment("Id плановой операции"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0 = План или 1 = Факт"); + + b.Property("IdUser") + .HasColumnType("integer"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции скважины"); + + b.Property("LastUpdateDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("DateStart"); + + b.HasIndex("DepthEnd"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdPlan"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_well_operation"); + + b.HasComment("Данные по операциям на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("id родительской категории"); + + b.Property("KeyValueName") + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("key_value_name") + .HasComment("Название ключевого показателя операции"); + + b.Property("KeyValueUnits") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("key_value_units") + .HasComment("Единицы измерения ключевого показателя операции"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории операции"); + + b.HasKey("Id"); + + b.HasIndex("IdParent"); + + b.ToTable("t_well_operation_category"); + + b.HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "БУРЕНИЕ" + }, + new + { + Id = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КРЕПЛЕНИЕ" + }, + new + { + Id = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГФР" + }, + new + { + Id = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные операции" + }, + new + { + Id = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Непроизводительное время (НПВ)" + }, + new + { + Id = 4000, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КНБК" + }, + new + { + Id = 4001, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "Механическое. бурение" + }, + new + { + Id = 4002, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Статический замер" + }, + new + { + Id = 4003, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Нормализация диаметра скважины" + }, + new + { + Id = 4004, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 4005, + IdParent = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4006, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск обсадной колонны" + }, + new + { + Id = 4007, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 4008, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы при креплении" + }, + new + { + Id = 4009, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка/разборка приборов ГИС" + }, + new + { + Id = 4010, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4011, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГИС" + }, + new + { + Id = 4012, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка, ОБР" + }, + new + { + Id = 4013, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы" + }, + new + { + Id = 4014, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт оборудования" + }, + new + { + Id = 4015, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Аварийные работы" + }, + new + { + Id = 4016, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Осложнение" + }, + new + { + Id = 4017, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Незаложенные в ГГД операции" + }, + new + { + Id = 5000, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка КНБК" + }, + new + { + Id = 5001, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка КНБК" + }, + new + { + Id = 5002, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение слайдом" + }, + new + { + Id = 5003, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение ротором" + }, + new + { + Id = 5004, + IdParent = 4002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Замер ЗТС (запись MWD)" + }, + new + { + Id = 5005, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка перед наращиванием" + }, + new + { + Id = 5006, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка во время бурения" + }, + new + { + Id = 5007, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка перед наращиванием" + }, + new + { + Id = 5008, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка во время бурения" + }, + new + { + Id = 5009, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка перед наращиванием" + }, + new + { + Id = 5010, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 5011, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Удержание в клиньях" + }, + new + { + Id = 5012, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем инструмента" + }, + new + { + Id = 5013, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем КНБК" + }, + new + { + Id = 5014, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента" + }, + new + { + Id = 5015, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КНБК" + }, + new + { + Id = 5016, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка при спуске ОК" + }, + new + { + Id = 5017, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск ОК" + }, + new + { + Id = 5018, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ОЗЦ" + }, + new + { + Id = 5019, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 5020, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка БИ" + }, + new + { + Id = 5021, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ОК" + }, + new + { + Id = 5022, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при спуске ОК" + }, + new + { + Id = 5023, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при цементировании" + }, + new + { + Id = 5024, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка комплекса приборов ГИС" + }, + new + { + Id = 5025, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка комплекса приборов ГИС" + }, + new + { + Id = 5026, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем приборов ГИС (на трубах)" + }, + new + { + Id = 5027, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск приборов ГИС (на трубах)" + }, + new + { + Id = 5028, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на жестком кабеле" + }, + new + { + Id = 5029, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на кабеле" + }, + new + { + Id = 5030, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на трубах" + }, + new + { + Id = 5031, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Закачка/прокачка пачки" + }, + new + { + Id = 5032, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка БР" + }, + new + { + Id = 5033, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование ТС при бурении" + }, + new + { + Id = 5034, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перезапись гаммы-каротажа" + }, + new + { + Id = 5035, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Приготовление БР" + }, + new + { + Id = 5036, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка" + }, + new + { + Id = 5037, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 5038, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента с проработкой" + }, + new + { + Id = 5039, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ВМР" + }, + new + { + Id = 5040, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Демонтаж ПВО" + }, + new + { + Id = 5041, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Долив затруба при подъёме" + }, + new + { + Id = 5042, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж ПВО" + }, + new + { + Id = 5043, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наработка жёлоба" + }, + new + { + Id = 5044, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обвязка устья с циркуляционной системой" + }, + new + { + Id = 5045, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Оборудование устья" + }, + new + { + Id = 5046, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ПВО" + }, + new + { + Id = 5047, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перемонтаж ПВО " + }, + new + { + Id = 5048, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перетяжка талевого каната" + }, + new + { + Id = 5049, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при сборке КНБК" + }, + new + { + Id = 5050, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Полная замена талевого каната" + }, + new + { + Id = 5051, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПР перед забуркой направления" + }, + new + { + Id = 5052, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Продувка манифольда" + }, + new + { + Id = 5053, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Срезка" + }, + new + { + Id = 5054, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тайм-дриллинг" + }, + new + { + Id = 5055, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тех.отстой" + }, + new + { + Id = 5056, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Учебная тревога \"Выброс\"" + }, + new + { + Id = 5057, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Чистка ЦСГО/емкостного блока" + }, + new + { + Id = 5058, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт бурового оборудования" + }, + new + { + Id = 5059, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ловильные работы" + }, + new + { + Id = 5060, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ожидание" + }, + new + { + Id = 5061, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Определение места прихвата и ЛМ" + }, + new + { + Id = 5062, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа яссом" + }, + new + { + Id = 5063, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расхаживание" + }, + new + { + Id = 5064, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - колокол" + }, + new + { + Id = 5065, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - метчик" + }, + new + { + Id = 5066, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - овершот" + }, + new + { + Id = 5067, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - труболовка" + }, + new + { + Id = 5068, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (встряхивание)" + }, + new + { + Id = 5069, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (отстрел)" + }, + new + { + Id = 5070, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Установка ванн" + }, + new + { + Id = 5071, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Фрезеровка" + }, + new + { + Id = 5072, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Контролируемое ГНВП" + }, + new + { + Id = 5073, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Поглощение" + }, + new + { + Id = 5074, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сальникообразование" + }, + new + { + Id = 5075, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Утяжеление БР" + }, + new + { + Id = 5076, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "НПВ / прочее" + }, + new + { + Id = 5077, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка раствора (несоответствие параметров)" + }, + new + { + Id = 5078, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "подъем ОК" + }, + new + { + Id = 5079, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ревизия КНБК/инструмента/ЗТС" + }, + new + { + Id = 5082, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка устройства ориентирования КО" + }, + new + { + Id = 5083, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка принудительная" + }, + new + { + Id = 5084, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка подъем БИ, продувка" + }, + new + { + Id = 5085, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск бурильного инструмента со сборкой с мостков" + }, + new + { + Id = 5086, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем БИ с выбросом на мостки" + }, + new + { + Id = 5087, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск БИ со сборкой с мостков" + }, + new + { + Id = 5088, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка и спуск ТБТ" + }, + new + { + Id = 5089, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КО на транспотрной колонне" + }, + new + { + Id = 5090, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Отворот допускной трубы" + }, + new + { + Id = 5091, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески, опрессовка" + }, + new + { + Id = 5092, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж, опрессовка ФА" + }, + new + { + Id = 5093, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка хвостовика 114мм (согласно схеме)" + }, + new + { + Id = 5094, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР к спуску УЭЦН" + }, + new + { + Id = 5095, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески (потайной колонны, хвостовика)" + }, + new + { + Id = 5096, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование перед спуском" + }, + new + { + Id = 5097, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка - перевод скважины на новый раствор" + }, + new + { + Id = 5098, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка БИ с мостков на подсвечник" + }, + new + { + Id = 5099, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО." + }, + new + { + Id = 5100, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Смена рабочего переводника ВСП" + }, + new + { + Id = 5101, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("Order") + .HasColumnType("real") + .HasColumnName("order") + .HasComment("Порядок"); + + b.HasKey("Id"); + + b.ToTable("t_well_section_type"); + + b.HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол", + Order = 4f + }, + new + { + Id = 2, + Caption = "Направление", + Order = 0f + }, + new + { + Id = 3, + Caption = "Кондуктор", + Order = 1f + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна", + Order = 3f + }, + new + { + Id = 5, + Caption = "Транспортный ствол", + Order = 5f + }, + new + { + Id = 6, + Caption = "Хвостовик", + Order = 6f + }, + new + { + Id = 7, + Caption = "Пилотный ствол 2", + Order = 4.1f + }, + new + { + Id = 8, + Caption = "Направление 2", + Order = 0.1f + }, + new + { + Id = 9, + Caption = "Кондуктор 2", + Order = 1.1f + }, + new + { + Id = 10, + Caption = "Эксплуатационная колонна 2", + Order = 3.1f + }, + new + { + Id = 11, + Caption = "Транспортный ствол 2", + Order = 5.1f + }, + new + { + Id = 12, + Caption = "Хвостовик 2", + Order = 6.1f + }, + new + { + Id = 13, + Caption = "Пилотный ствол 3", + Order = 4.2f + }, + new + { + Id = 14, + Caption = "Направление 3", + Order = 0.2f + }, + new + { + Id = 15, + Caption = "Кондуктор 3", + Order = 1.2f + }, + new + { + Id = 16, + Caption = "Эксплуатационная колонна 3", + Order = 3.2f + }, + new + { + Id = 17, + Caption = "Транспортный ствол 3", + Order = 5.2f + }, + new + { + Id = 18, + Caption = "Хвостовик 3", + Order = 6.2f + }, + new + { + Id = 19, + Caption = "Пилотный ствол 4", + Order = 4.3f + }, + new + { + Id = 20, + Caption = "Направление 4", + Order = 0.3f + }, + new + { + Id = 21, + Caption = "Кондуктор 4", + Order = 1.3f + }, + new + { + Id = 22, + Caption = "Эксплуатационная колонна 4", + Order = 3.3f + }, + new + { + Id = 23, + Caption = "Транспортный ствол 4", + Order = 5.3f + }, + new + { + Id = 24, + Caption = "Хвостовик 4", + Order = 6.3f + }, + new + { + Id = 25, + Caption = "Пилотный ствол 5", + Order = 4.4f + }, + new + { + Id = 26, + Caption = "Направление 5", + Order = 0.4f + }, + new + { + Id = 27, + Caption = "Кондуктор 5", + Order = 1.4f + }, + new + { + Id = 28, + Caption = "Эксплуатационная колонна 5", + Order = 3.4f + }, + new + { + Id = 29, + Caption = "Транспортный ствол 5", + Order = 5.4f + }, + new + { + Id = 30, + Caption = "Хвостовик 5", + Order = 6.4f + }, + new + { + Id = 31, + Caption = "Техническая колонна", + Order = 2f + }, + new + { + Id = 32, + Caption = "Техническая колонна 2", + Order = 2.1f + }, + new + { + Id = 33, + Caption = "Техническая колонна 3", + Order = 2.2f + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_well_type"); + + b.HasComment("конструкция скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Наклонно-направленная" + }, + new + { + Id = 2, + Caption = "Горизонтальная" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.RecordBase", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Actcod") + .HasColumnType("smallint") + .HasColumnName("ACTCOD"); + + b.Property("Date") + .HasColumnType("integer") + .HasColumnName("DATE"); + + b.Property("Recid") + .HasColumnType("smallint") + .HasColumnName("RECID"); + + b.Property("Seqid") + .HasColumnType("integer") + .HasColumnName("SEQID"); + + b.Property("Stknum") + .HasColumnType("smallint") + .HasColumnName("STKNUM"); + + b.Property("Time") + .HasColumnType("integer") + .HasColumnName("TIME"); + + b.Property("Wellid") + .HasColumnType("text") + .HasColumnName("WELLID"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_wits_base"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Blkpos") + .HasColumnType("real") + .HasColumnName("BLKPOS"); + + b.Property("Chkp") + .HasColumnType("real") + .HasColumnName("CHKP"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptretm") + .HasColumnType("real") + .HasColumnName("DEPTRETM"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Gasa") + .HasColumnType("real") + .HasColumnName("GASA"); + + b.Property("Hkla") + .HasColumnType("real") + .HasColumnName("HKLA"); + + b.Property("Hklx") + .HasColumnType("real") + .HasColumnName("HKLX"); + + b.Property("Lagstks") + .HasColumnType("smallint") + .HasColumnName("LAGSTKS"); + + b.Property("Mcia") + .HasColumnType("real") + .HasColumnName("MCIA"); + + b.Property("Mcoa") + .HasColumnType("real") + .HasColumnName("MCOA"); + + b.Property("Mdia") + .HasColumnType("real") + .HasColumnName("MDIA"); + + b.Property("Mdoa") + .HasColumnType("real") + .HasColumnName("MDOA"); + + b.Property("Mfia") + .HasColumnType("real") + .HasColumnName("MFIA"); + + b.Property("Mfoa") + .HasColumnType("real") + .HasColumnName("MFOA"); + + b.Property("Mfop") + .HasColumnType("smallint") + .HasColumnName("MFOP"); + + b.Property("Mtia") + .HasColumnType("real") + .HasColumnName("MTIA"); + + b.Property("Mtoa") + .HasColumnType("real") + .HasColumnName("MTOA"); + + b.Property("Ropa") + .HasColumnType("real") + .HasColumnName("ROPA"); + + b.Property("Rpma") + .HasColumnType("smallint") + .HasColumnName("RPMA"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spm1") + .HasColumnType("smallint") + .HasColumnName("SPM1"); + + b.Property("Spm2") + .HasColumnType("smallint") + .HasColumnName("SPM2"); + + b.Property("Spm3") + .HasColumnType("smallint") + .HasColumnName("SPM3"); + + b.Property("Sppa") + .HasColumnType("real") + .HasColumnName("SPPA"); + + b.Property("Stkc") + .HasColumnType("integer") + .HasColumnName("STKC"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.Property("Torqa") + .HasColumnType("real") + .HasColumnName("TORQA"); + + b.Property("Torqx") + .HasColumnType("real") + .HasColumnName("TORQX"); + + b.Property("Tvolact") + .HasColumnType("real") + .HasColumnName("TVOLACT"); + + b.Property("Tvolcact") + .HasColumnType("real") + .HasColumnName("TVOLCACT"); + + b.Property("Woba") + .HasColumnType("real") + .HasColumnName("WOBA"); + + b.Property("Wobx") + .HasColumnType("real") + .HasColumnName("WOBX"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_1"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("DeptmeasGdpMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_GDP_mc"); + + b.Property("DeptmeasMcrstat") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_MCRSTAT"); + + b.Property("DeptmeasRa33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33_mc"); + + b.Property("DeptmeasRa33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F2_mc"); + + b.Property("DeptmeasRa33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F4_mc"); + + b.Property("DeptmeasRp33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33_mc"); + + b.Property("DeptmeasRp33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F2_mc"); + + b.Property("DeptmeasRp33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F4_mc"); + + b.Property("DeptmeasSlvlMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_SLVL_mc"); + + b.Property("GdpMc") + .HasColumnType("real") + .HasColumnName("GDP_mc"); + + b.Property("Mcrstat") + .HasColumnType("real") + .HasColumnName("MCRSTAT"); + + b.Property("Ra33Mc") + .HasColumnType("real") + .HasColumnName("RA33_mc"); + + b.Property("Ra33f2Mc") + .HasColumnType("real") + .HasColumnName("RA33F2_mc"); + + b.Property("Ra33f4Mc") + .HasColumnType("real") + .HasColumnName("RA33F4_mc"); + + b.Property("Rp33Mc") + .HasColumnType("real") + .HasColumnName("RP33_mc"); + + b.Property("Rp33f2Mc") + .HasColumnType("real") + .HasColumnName("RP33F2_mc"); + + b.Property("Rp33f4Mc") + .HasColumnType("real") + .HasColumnName("RP33F4_mc"); + + b.Property("SlvlMc") + .HasColumnType("real") + .HasColumnName("SLVL_mc"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_50"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Btot") + .HasColumnType("real") + .HasColumnName("Btot"); + + b.Property("Bx") + .HasColumnType("real") + .HasColumnName("Bx"); + + b.Property("By") + .HasColumnType("real") + .HasColumnName("By"); + + b.Property("Bz") + .HasColumnType("real") + .HasColumnName("Bz"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Gtot") + .HasColumnType("real") + .HasColumnName("Gtot"); + + b.Property("Gx") + .HasColumnType("real") + .HasColumnName("Gx"); + + b.Property("Gy") + .HasColumnType("real") + .HasColumnName("Gy"); + + b.Property("Gz") + .HasColumnType("real") + .HasColumnName("Gz"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_60"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Att06h") + .HasColumnType("real") + .HasColumnName("ATT06H"); + + b.Property("Att06l") + .HasColumnType("real") + .HasColumnName("ATT06L"); + + b.Property("Att10h") + .HasColumnType("real") + .HasColumnName("ATT10H"); + + b.Property("Att10l") + .HasColumnType("real") + .HasColumnName("ATT10L"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Phl1f1") + .HasColumnType("real") + .HasColumnName("PHL1F1"); + + b.Property("Phl1f2") + .HasColumnType("real") + .HasColumnName("PHL1F2"); + + b.Property("Phl2f1") + .HasColumnType("real") + .HasColumnName("PHL2F1"); + + b.Property("Phl2f2") + .HasColumnType("real") + .HasColumnName("PHL2F2"); + + b.Property("Status") + .HasColumnType("real") + .HasColumnName("Status"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_61"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptsvym") + .HasColumnType("real") + .HasColumnName("DEPTSVYM"); + + b.Property("Deptsvyv") + .HasColumnType("real") + .HasColumnName("DEPTSVYV"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Svyazc") + .HasColumnType("real") + .HasColumnName("SVYAZC"); + + b.Property("Svyazu") + .HasColumnType("real") + .HasColumnName("SVYAZU"); + + b.Property("Svydls") + .HasColumnType("real") + .HasColumnName("SVYDLS"); + + b.Property("Svyew") + .HasColumnType("real") + .HasColumnName("SVYEW"); + + b.Property("Svygtf") + .HasColumnType("real") + .HasColumnName("SVYGTF"); + + b.Property("Svyinc") + .HasColumnType("real") + .HasColumnName("SVYINC"); + + b.Property("Svymtf") + .HasColumnType("real") + .HasColumnName("SVYMTF"); + + b.Property("Svyns") + .HasColumnType("real") + .HasColumnName("SVYNS"); + + b.Property("Svytype") + .HasColumnType("text") + .HasColumnName("SVYTYPE"); + + b.Property("Svywalk") + .HasColumnType("real") + .HasColumnName("SVYWALK"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_7"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptcalm") + .HasColumnType("real") + .HasColumnName("DEPTCALM"); + + b.Property("Deptcalv") + .HasColumnType("real") + .HasColumnName("DEPTCALV"); + + b.Property("Deptfdm") + .HasColumnType("real") + .HasColumnName("DEPTFDM"); + + b.Property("Deptfdv") + .HasColumnType("real") + .HasColumnName("DEPTFDV"); + + b.Property("Deptgr1m") + .HasColumnType("real") + .HasColumnName("DEPTGR1M"); + + b.Property("Deptgr1v") + .HasColumnType("real") + .HasColumnName("DEPTGR1V"); + + b.Property("Deptgr2m") + .HasColumnType("real") + .HasColumnName("DEPTGR2M"); + + b.Property("Deptgr2v") + .HasColumnType("real") + .HasColumnName("DEPTGR2V"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptp1m") + .HasColumnType("real") + .HasColumnName("DEPTP1M"); + + b.Property("Deptp1v") + .HasColumnType("real") + .HasColumnName("DEPTP1V"); + + b.Property("Deptp2m") + .HasColumnType("real") + .HasColumnName("DEPTP2M"); + + b.Property("Deptp2v") + .HasColumnType("real") + .HasColumnName("DEPTP2V"); + + b.Property("Deptrs1m") + .HasColumnType("real") + .HasColumnName("DEPTRS1M"); + + b.Property("Deptrs1v") + .HasColumnType("real") + .HasColumnName("DEPTRS1V"); + + b.Property("Deptrs2m") + .HasColumnType("real") + .HasColumnName("DEPTRS2M"); + + b.Property("Deptrs2v") + .HasColumnType("real") + .HasColumnName("DEPTRS2V"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Mclp") + .HasColumnType("real") + .HasColumnName("MCLP"); + + b.Property("Mfd") + .HasColumnType("real") + .HasColumnName("MFD"); + + b.Property("Mffp") + .HasColumnType("real") + .HasColumnName("MFFP"); + + b.Property("Mfpp") + .HasColumnType("real") + .HasColumnName("MFPP"); + + b.Property("Mfrann") + .HasColumnType("real") + .HasColumnName("MFRANN"); + + b.Property("Mfrpipe") + .HasColumnType("real") + .HasColumnName("MFRPIPE"); + + b.Property("Mftann") + .HasColumnType("real") + .HasColumnName("MFTANN"); + + b.Property("Mftpipe") + .HasColumnType("real") + .HasColumnName("MFTPIPE"); + + b.Property("Mg1") + .HasColumnType("real") + .HasColumnName("MG1"); + + b.Property("Mg1c") + .HasColumnType("real") + .HasColumnName("MG1C"); + + b.Property("Mg2") + .HasColumnType("real") + .HasColumnName("MG2"); + + b.Property("Mg2c") + .HasColumnType("real") + .HasColumnName("MG2C"); + + b.Property("Mpo1") + .HasColumnType("real") + .HasColumnName("MPO1"); + + b.Property("Mpo2") + .HasColumnType("real") + .HasColumnName("MPO2"); + + b.Property("Mr1") + .HasColumnType("real") + .HasColumnName("MR1"); + + b.Property("Mr1c") + .HasColumnType("real") + .HasColumnName("MR1C"); + + b.Property("Mr2") + .HasColumnType("real") + .HasColumnName("MR2"); + + b.Property("Mr2c") + .HasColumnType("real") + .HasColumnName("MR2C"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spare6") + .HasColumnType("real") + .HasColumnName("SPARE6"); + + b.Property("Spare7") + .HasColumnType("real") + .HasColumnName("SPARE7"); + + b.Property("Spare8") + .HasColumnType("real") + .HasColumnName("SPARE8"); + + b.Property("Spare9") + .HasColumnType("real") + .HasColumnName("SPARE9"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_8"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") + .WithMany("Clusters") + .HasForeignKey("IdDeposit") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_cluster_t_deposit_id_fk"); + + b.Navigation("Deposit"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType") + .WithMany("Companies") + .HasForeignKey("IdCompanyType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CompanyType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdFileCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("DrillingProgramParts") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer") + .WithMany() + .HasForeignKey("IdAuthorAnswer"); + + b.HasOne("AsbCloudDb.Model.User", "AuthorQuestion") + .WithMany() + .HasForeignKey("IdAuthorQuestion") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AuthorAnswer"); + + b.Navigation("AuthorQuestion"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany("Files") + .HasForeignKey("IdAuthor"); + + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "FileInfo") + .WithMany("FileMarks") + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_file_mark_t_file_info_fk"); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("FileMarks") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_user_t_file_mark_fk"); + + b.Navigation("FileInfo"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category") + .WithMany("Measures") + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.HasOne("AsbCloudDb.Model.NotificationCategory", "NotificationCategory") + .WithMany("Notifications") + .HasForeignKey("IdNotificationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NotificationCategory"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdOperationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", 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.Navigation("User"); + + 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.RelationCompanyWell", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_company_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_well_id_fk"); + + b.Navigation("Company"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationContactsWells") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.DrillingProgramPart", "DrillingProgramPart") + .WithMany("RelatedUsers") + .HasForeignKey("IdDrillingProgramPart") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrillingProgramPart"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.HasOne("AsbCloudDb.Model.Permission", "Permission") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdPermission") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.HasOne("AsbCloudDb.Model.UserRole", "Role") + .WithMany("RelationUserRoleUserRoles") + .HasForeignKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "IncludeRole") + .WithMany() + .HasForeignKey("IdInclude") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IncludeRole"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "File") + .WithMany() + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.HasOne("AsbCloudDb.Model.Driller", "Driller") + .WithMany("Schedule") + .HasForeignKey("IdDriller") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_schedule_t_driller_id_driller"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Driller"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b => + { + b.HasOne("AsbCloudDb.Model.Subsystems.Subsystem", "Subsystem") + .WithMany() + .HasForeignKey("IdSubsystem") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subsystem"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSaub") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSpin") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Events") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_event_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Messages") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_messages_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Users") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_user_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("Users") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("t_user_t_company_id_fk"); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") + .WithMany("Wells") + .HasForeignKey("IdCluster") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_t_cluster_id_fk"); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithOne("Well") + .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("t_well_t_telemetry_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellType", "WellType") + .WithMany("Wells") + .HasForeignKey("IdWellType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("Telemetry"); + + b.Navigation("WellType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellComposites") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellComposites") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_section_type_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "WellSrc") + .WithMany("WellCompositeSrcs") + .HasForeignKey("IdWellSrc") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_src_t_well_id_fk"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + + b.Navigation("WellSrc"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Navigation("Category"); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellOperation", "OperationPlan") + .WithMany() + .HasForeignKey("IdPlan"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellOperations") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellOperations") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("OperationPlan"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Parent") + .WithMany() + .HasForeignKey("IdParent"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record1", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record50", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record60", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record61", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record7", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record8", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Navigation("Wells"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Navigation("RelationCompaniesWells"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Navigation("Companies"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Navigation("Clusters"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Navigation("Schedule"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Navigation("RelatedUsers"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Navigation("FileMarks"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Navigation("Measures"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Navigation("RelationUserRolePermissions"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Navigation("DataSaub"); + + b.Navigation("DataSpin"); + + b.Navigation("Events"); + + b.Navigation("Messages"); + + b.Navigation("Users"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Navigation("FileMarks"); + + b.Navigation("Files"); + + b.Navigation("RelationContactsWells"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Navigation("RelationUserRolePermissions"); + + b.Navigation("RelationUserRoleUserRoles"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Navigation("DrillingProgramParts"); + + b.Navigation("ProcessMaps"); + + b.Navigation("RelationCompaniesWells"); + + b.Navigation("WellCompositeSrcs"); + + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Navigation("Wells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.cs b/AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.cs new file mode 100644 index 00000000..d8b973f5 --- /dev/null +++ b/AsbCloudDb/Migrations/20230821110455_Update_PlannedTrajectory.cs @@ -0,0 +1,123 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + public partial class Update_PlannedTrajectory : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "absolute_mark", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "angle_intensity", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "azimuth_intensity", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "east_cartographic", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "east_orifice", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "north_cartographic", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "north_orifice", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "orifice_offset", + table: "t_planned_trajectory"); + + migrationBuilder.DropColumn( + name: "spatial_intensity", + table: "t_planned_trajectory"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "absolute_mark", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Абсолютная отметка"); + + migrationBuilder.AddColumn( + name: "angle_intensity", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Интенсивность по углу"); + + migrationBuilder.AddColumn( + name: "azimuth_intensity", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Интенсивность по азимуту"); + + migrationBuilder.AddColumn( + name: "east_cartographic", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Восток картографический"); + + migrationBuilder.AddColumn( + name: "east_orifice", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Восток отн-но устья"); + + migrationBuilder.AddColumn( + name: "north_cartographic", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Север картографический"); + + migrationBuilder.AddColumn( + name: "north_orifice", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Север отн-но устья"); + + migrationBuilder.AddColumn( + name: "orifice_offset", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Смещение от устья"); + + migrationBuilder.AddColumn( + name: "spatial_intensity", + table: "t_planned_trajectory", + type: "double precision", + nullable: false, + defaultValue: 0.0, + comment: "Пространственная интенсивность"); + } + } +} diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index e55bff40..0d23ed40 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -2175,26 +2175,11 @@ namespace AsbCloudDb.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("AbsoluteMark") - .HasColumnType("double precision") - .HasColumnName("absolute_mark") - .HasComment("Абсолютная отметка"); - - b.Property("AngleIntensity") - .HasColumnType("double precision") - .HasColumnName("angle_intensity") - .HasComment("Интенсивность по углу"); - b.Property("AzimuthGeo") .HasColumnType("double precision") .HasColumnName("azimuth_geo") .HasComment("Азимут Географ."); - b.Property("AzimuthIntensity") - .HasColumnType("double precision") - .HasColumnName("azimuth_intensity") - .HasComment("Интенсивность по азимуту"); - b.Property("AzimuthMagnetic") .HasColumnType("double precision") .HasColumnName("azimuth_magnetic") @@ -2205,16 +2190,6 @@ namespace AsbCloudDb.Migrations .HasColumnName("comment") .HasComment("Комментарии"); - b.Property("EastCartographic") - .HasColumnType("double precision") - .HasColumnName("east_cartographic") - .HasComment("Восток картографический"); - - b.Property("EastOrifice") - .HasColumnType("double precision") - .HasColumnName("east_orifice") - .HasComment("Восток отн-но устья"); - b.Property("IdUser") .HasColumnType("integer") .HasColumnName("id_user") @@ -2225,31 +2200,11 @@ namespace AsbCloudDb.Migrations .HasColumnName("id_well") .HasComment("ID скважины"); - b.Property("NorthCartographic") - .HasColumnType("double precision") - .HasColumnName("north_cartographic") - .HasComment("Север картографический"); - - b.Property("NorthOrifice") - .HasColumnType("double precision") - .HasColumnName("north_orifice") - .HasComment("Север отн-но устья"); - - b.Property("OrificeOffset") - .HasColumnType("double precision") - .HasColumnName("orifice_offset") - .HasComment("Смещение от устья"); - b.Property("Radius") .HasColumnType("double precision") .HasColumnName("radius") .HasComment("Радиус цели"); - b.Property("SpatialIntensity") - .HasColumnType("double precision") - .HasColumnName("spatial_intensity") - .HasComment("Пространственная интенсивность"); - b.Property("UpdateDate") .HasColumnType("timestamp with time zone") .HasColumnName("update_date") diff --git a/AsbCloudDb/Model/PlannedTrajectory.cs b/AsbCloudDb/Model/PlannedTrajectory.cs index a11f3bd7..647c15b8 100644 --- a/AsbCloudDb/Model/PlannedTrajectory.cs +++ b/AsbCloudDb/Model/PlannedTrajectory.cs @@ -35,33 +35,6 @@ namespace AsbCloudDb.Model [Column("vertical_depth"), Comment("Глубина вертикальная")] public double VerticalDepth { get; set; } - [Column("absolute_mark"), Comment("Абсолютная отметка")] - public double AbsoluteMark { get; set; } - - [Column("north_orifice"), Comment("Север отн-но устья")] - public double NorthOrifice { get; set; } - - [Column("east_orifice"), Comment("Восток отн-но устья")] - public double EastOrifice { get; set; } - - [Column("east_cartographic"), Comment("Восток картографический")] - public double EastCartographic { get; set; } - - [Column("north_cartographic"), Comment("Север картографический")] - public double NorthCartographic { get; set; } - - [Column("spatial_intensity"), Comment("Пространственная интенсивность")] - public double SpatialIntensity { get; set; } - - [Column("angle_intensity"), Comment("Интенсивность по углу")] - public double AngleIntensity { get; set; } - - [Column("azimuth_intensity"), Comment("Интенсивность по азимуту")] - public double AzimuthIntensity { get; set; } - - [Column("orifice_offset"), Comment("Смещение от устья")] - public double OrificeOffset { get; set; } - [Column("comment"), Comment("Комментарии")] public string? Comment { get; set; } diff --git a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs index 23cf92a6..5eb7b57d 100644 --- a/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs +++ b/AsbCloudInfrastructure/Repository/TrajectoryFactRepository.cs @@ -41,8 +41,6 @@ namespace AsbCloudInfrastructure.Repository IdWell = idWell, AzimuthMagnetic = coord.Svymtf, VerticalDepth = coord.Deptsvyv, - NorthOrifice = coord.Svyns, - EastOrifice = coord.Svyew, WellboreDepth = coord.Deptsvym!.Value, ZenithAngle = coord.Svyinc!.Value, AzimuthGeo = coord.Svyazc!.Value From 6aa643b0d35d055fb59d57ede60766cc7036cecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=B8=D1=87?= Date: Wed, 23 Aug 2023 11:38:54 +0500 Subject: [PATCH 10/25] =?UTF-8?q?=D0=9D=D0=B5=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=20=D1=81=D1=87=D0=B8=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D1=81=D1=8F=20Count=20=D0=BF=D1=80=D0=B8=20=D1=84=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20=D1=81=D1=83=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BD=D1=8B=D1=85=20=D0=BE=D1=82=D1=87=D1=91=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20+=20=D1=84=D0=B8=D0=BA=D1=81=20=D1=84=D0=BE=D1=80?= =?UTF-8?q?=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=B2?= =?UTF-8?q?=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B8?= =?UTF-8?q?=D0=BD=D1=82=D0=B5=D1=80=D0=B2=D0=B0=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoGeneratedDailyReportService.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs index 03a19c44..0e364319 100644 --- a/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs +++ b/AsbCloudInfrastructure/Services/AutoGeneratedDailyReports/AutoGeneratedDailyReportService.cs @@ -66,8 +66,6 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService if (datesRange is null) return result; - - result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays)); if (request.StartDate.HasValue) { @@ -87,6 +85,9 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService datesRange.To = finishDate; } + if (datesRange.From.AddDays(result.Skip) <= datesRange.To) + result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays)); + for (int day = result.Skip; (day - result.Skip) < result.Take && (datesRange.From.AddDays(day)) <= datesRange.To; day++) { var reportDate = DateOnly.FromDateTime(datesRange.From.AddDays(day)); @@ -149,8 +150,8 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService return new DatesRangeDto { - From = factOperations.Min(o => o.DateStart), - To = factOperations.Max(o => o.DateStart) + From = factOperations.Min(o => o.DateStart).Date, + To = factOperations.Max(o => o.DateStart).Date }; } From b58cd2d636a7fc766a0ffeb02c53a388175053ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Tue, 5 Sep 2023 16:23:40 +0500 Subject: [PATCH 11/25] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D1=80=D0=B5=D1=82=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B7=D0=B0=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D1=88=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D1=81=D0=BA=D0=B2?= =?UTF-8?q?=D0=B0=D0=B6=D0=B8=D0=BD=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=BD?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B5=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Добавил новые права для координаторов и тех.поддержки 2. Переименовал ProcessMapReportService.cs -> ProcessMapService.cs 3. Добавил ProcessMapService.cs метод удаления записи РТК 4. Добавил проверки на наличие прав в контроллерах 5. Накатил новые миграции --- AsbCloudApp/Services/IProcessMapService.cs | 13 +- ...30905071606_Add_New_Permissons.Designer.cs | 8433 +++++++++++++++++ .../20230905071606_Add_New_Permissons.cs | 77 + .../AsbCloudDbContextModelSnapshot.cs | 42 + .../DefaultData/EntityFillerPermission.cs | 3 + .../EntityFillerRelationUserRolePermission.cs | 3 + AsbCloudInfrastructure/DependencyInjection.cs | 2 +- .../ProcessMapReportMakerService.cs | 4 +- ...pReportService.cs => ProcessMapService.cs} | 14 +- .../Controllers/ProcessMapController.cs | 42 +- .../Controllers/WellOperationController.cs | 40 +- 11 files changed, 8657 insertions(+), 16 deletions(-) create mode 100644 AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs create mode 100644 AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs rename AsbCloudInfrastructure/Services/ProcessMap/{ProcessMapReportService.cs => ProcessMapService.cs} (96%) diff --git a/AsbCloudApp/Services/IProcessMapService.cs b/AsbCloudApp/Services/IProcessMapService.cs index d405869a..25e1d2f1 100644 --- a/AsbCloudApp/Services/IProcessMapService.cs +++ b/AsbCloudApp/Services/IProcessMapService.cs @@ -6,9 +6,9 @@ using System.Threading.Tasks; namespace AsbCloudApp.Services { /// - /// Сервис формирования РТК + /// Сервис РТК /// - public interface IProcessMapReportService + public interface IProcessMapService { /// /// Получение моделей РТК @@ -17,5 +17,14 @@ namespace AsbCloudApp.Services /// /// Task> GetProcessMapReportAsync(int idWell, CancellationToken token); + + /// + /// Удаление записи РТК + /// + /// + /// + /// + /// + Task DeleteAsync(int id, int idWell, CancellationToken token); } } diff --git a/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs b/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs new file mode 100644 index 00000000..a7730041 --- /dev/null +++ b/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs @@ -0,0 +1,8433 @@ +// +using System; +using System.Text.Json; +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + [DbContext(typeof(AsbCloudDbContext))] + [Migration("20230905071606_Add_New_Permissons")] + partial class Add_New_Permissons + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("Russian_Russia.1251") + .HasAnnotation("ProductVersion", "6.0.21") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdDeposit") + .HasColumnType("integer") + .HasColumnName("id_deposit"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdDeposit"); + + b.ToTable("t_cluster"); + + b.HasComment("Кусты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCompanyType") + .HasMaxLength(255) + .HasColumnType("integer") + .HasColumnName("id_company_type") + .HasComment("вид деятельности"); + + b.HasKey("Id"); + + b.HasIndex("IdCompanyType"); + + b.ToTable("t_company"); + + b.HasData( + new + { + Id = 1, + Caption = "ООО \"АСБ\"", + IdCompanyType = 3 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IsContact") + .HasColumnType("boolean"); + + b.Property("Order") + .HasColumnType("integer") + .HasColumnName("order"); + + b.HasKey("Id"); + + b.ToTable("t_company_type"); + + b.HasData( + new + { + Id = 1, + Caption = "Недрапользователь", + IsContact = false, + Order = 1 + }, + new + { + Id = 2, + Caption = "Буровой подрядчик", + IsContact = false, + Order = 2 + }, + new + { + Id = 3, + Caption = "Сервис автоматизации бурения", + IsContact = false, + Order = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("StartDate") + .HasColumnType("date") + .HasColumnName("start_date") + .HasComment("Дата отчёта"); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Список параметров для отчёта"); + + b.HasKey("IdWell", "StartDate") + .HasName("t_id_well_date_start_pk"); + + b.ToTable("t_daily_report"); + + b.HasComment("Ежедневные отчёты"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.ToTable("t_deposit"); + + b.HasComment("Месторождение"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("Дата начала операции"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdReasonOfEnd") + .HasColumnType("integer") + .HasColumnName("id_reason_of_end") + .HasComment("Код признака окончания операции"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUsersAtStart") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя по телеметрии на момент начала операции"); + + b.Property("Value") + .HasColumnType("double precision") + .HasColumnName("value") + .HasComment("Ключевой показатель операции"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_detected_operation"); + + b.HasComment("автоматически определенные операции по телеметрии"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Имя"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("Отчество"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("Фамилия"); + + b.HasKey("Id"); + + b.ToTable("t_driller"); + + b.HasComment("Бурильщик"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdFileCategory") + .HasColumnType("integer") + .HasColumnName("id_file_category"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("Id"); + + b.HasIndex("IdFileCategory"); + + b.HasIndex("IdWell", "IdFileCategory") + .IsUnique(); + + b.ToTable("t_drilling_program_part"); + + b.HasComment("части программ бурения"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Answer") + .HasColumnType("text") + .HasColumnName("answer") + .HasComment("Текст ответа"); + + b.Property("CounterQuestion") + .HasColumnType("integer") + .HasColumnName("counter_question") + .HasComment("Счетчик повторений вопроса"); + + b.Property("DateAnswer") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_answer") + .HasComment("Дата ответа"); + + b.Property("DateCreatedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created_question") + .HasComment("Дата создания вопроса"); + + b.Property("DateLastEditedQuestion") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_last_edited_question") + .HasComment("Дата последнего редактирования вопроса"); + + b.Property("IdAuthorAnswer") + .HasColumnType("integer") + .HasColumnName("id_author_answer") + .HasComment("id автора ответа"); + + b.Property("IdAuthorQuestion") + .HasColumnType("integer") + .HasColumnName("id_author_question") + .HasComment("id автора вопроса"); + + b.Property("IdReplacementQuestion") + .HasColumnType("integer") + .HasColumnName("id_replacement_question") + .HasComment("Ключ заменяющего вопроса"); + + b.Property("IsFrequently") + .HasColumnType("boolean") + .HasColumnName("is_frequently") + .HasComment("Частый вопрос"); + + b.Property("Question") + .IsRequired() + .HasColumnType("text") + .HasColumnName("question") + .HasComment("Текст вопроса"); + + b.Property("State") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("Статус вопроса"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthorAnswer"); + + b.HasIndex("IdAuthorQuestion"); + + b.ToTable("t_faq"); + + b.HasComment("вопросы пользователей"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_file_category"); + + b.HasComment("Категории файлов"); + + b.HasData( + new + { + Id = 1, + Name = "Растворный сервис", + ShortName = "fluidService" + }, + new + { + Id = 2, + Name = "Цементирование", + ShortName = "cement" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "nnb" + }, + new + { + Id = 4, + Name = "ГТИ", + ShortName = "gti" + }, + new + { + Id = 5, + Name = "Документы по скважине", + ShortName = "wellDocuments" + }, + new + { + Id = 6, + Name = "Супервайзер", + ShortName = "supervisor" + }, + new + { + Id = 7, + Name = "Мастер", + ShortName = "master" + }, + new + { + Id = 8, + Name = "Долотный сервис", + ShortName = "toolService" + }, + new + { + Id = 9, + Name = "Буровой подрядчик", + ShortName = "drillService" + }, + new + { + Id = 10, + Name = "Сервис по заканчиванию скважины", + ShortName = "closingService" + }, + new + { + Id = 12, + Name = "Рапорт", + ShortName = "report" + }, + new + { + Id = 1000, + Name = "Программа бурения" + }, + new + { + Id = 1001, + Name = "Задание от геологов" + }, + new + { + Id = 1002, + Name = "Профиль ствола скважины (ННБ)" + }, + new + { + Id = 1003, + Name = "Технологические расчеты (ННБ)" + }, + new + { + Id = 1004, + Name = "Долотная программа" + }, + new + { + Id = 1005, + Name = "Программа по растворам" + }, + new + { + Id = 1006, + Name = "Программа геофизических исследований" + }, + new + { + Id = 1007, + Name = "Планы спусков обсадных колонн" + }, + new + { + Id = 1008, + Name = "Программы цементирования обсадных колонн" + }, + new + { + Id = 10000, + Name = "Проект на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10001, + Name = "Программа на бурение транспортного и горизонтального участков скважины" + }, + new + { + Id = 10002, + Name = "Акт о начале бурения" + }, + new + { + Id = 10003, + Name = "План работ спуска и цементирования направления" + }, + new + { + Id = 10004, + Name = "Программа цементирования направления" + }, + new + { + Id = 10005, + Name = "Мера обсадных труб (направление)" + }, + new + { + Id = 10006, + Name = "Акт на выполненные работы по цементированию направления" + }, + new + { + Id = 10007, + Name = "Отчет по цементированию направления (график)" + }, + new + { + Id = 10008, + Name = "План работ спуска и цементирования кондуктора" + }, + new + { + Id = 10009, + Name = "Программа цементирования (кондуктор)" + }, + new + { + Id = 10010, + Name = "Мера обсадных труб (кондуктор)" + }, + new + { + Id = 10011, + Name = "Карта крепления кондуктора" + }, + new + { + Id = 10012, + Name = "Акт на выполненные работы по цементированию кондуктора" + }, + new + { + Id = 10013, + Name = "Отчет по цементированию кондуктора (график)" + }, + new + { + Id = 10014, + Name = "Акт о замере расстояния от стола ротора до муфты кондуктора" + }, + new + { + Id = 10015, + Name = "Акт опресовки цементного кольца за кондуктором" + }, + new + { + Id = 10016, + Name = "Акт опресовки ППГ с глухими плашками совместно с кондуктором" + }, + new + { + Id = 10017, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с кондуктором" + }, + new + { + Id = 10018, + Name = "План работ на крепление обсадной колонны (эк. колонна)" + }, + new + { + Id = 10019, + Name = "Программа цементирования (эк. колонна)" + }, + new + { + Id = 10020, + Name = "Мера труб эксплуатационной колонны" + }, + new + { + Id = 10021, + Name = "Карта по креплению скважины (эк. колонна)" + }, + new + { + Id = 10022, + Name = "Акт на установку пружинных центраторов" + }, + new + { + Id = 10023, + Name = "Отчет по цементированию эксплуатационной колонны (график)" + }, + new + { + Id = 10024, + Name = "Акт на выполненные работы по цементированию эксплуатационной колонны" + }, + new + { + Id = 10025, + Name = "Акт об испытании эк. колонны на герметичность (СТОП)" + }, + new + { + Id = 10026, + Name = "Акт опресовки ППГ с глухими плашками совместно с э/колонной" + }, + new + { + Id = 10027, + Name = "Акт опресовки ПУГ, ППГ с трубными плашками совместно с э/колонной" + }, + new + { + Id = 10028, + Name = "Акт на вскрытие продуктивного пласта" + }, + new + { + Id = 10029, + Name = "Акт замера параметров раствора при бурении горизонтального участка" + }, + new + { + Id = 10030, + Name = "Разрешение на спуск «хвостовика» (телефонограмма)" + }, + new + { + Id = 10031, + Name = "План работ на спуск «хвостовика»" + }, + new + { + Id = 10032, + Name = "Акт готовности бурового и энергетического оборудования к спуску «хвостовика»" + }, + new + { + Id = 10033, + Name = "Акт шаблонировки ствола скважины перед спуском «хвостовика»" + }, + new + { + Id = 10034, + Name = "Мера обсадных труб (хвостовик)" + }, + new + { + Id = 10035, + Name = "Акт выполненных работ по спуску хвостовика с закачкой (нефти, солевого раствора" + }, + new + { + Id = 10036, + Name = "Акт о переводе скважины на тех. воду" + }, + new + { + Id = 10037, + Name = "Акт об окончании бурения" + }, + new + { + Id = 10038, + Name = "Акт на передачу скважины в освоение (КРС)" + }, + new + { + Id = 10039, + Name = "Акт на опресовку межколонного пространства с КРС" + }, + new + { + Id = 10040, + Name = "Акт на сдачу скважины в ЦДНГ" + }, + new + { + Id = 10041, + Name = "Паспорт ОУС (заполняется геологами)" + }, + new + { + Id = 10042, + Name = "Паспорт скважины (заполняется геологами)" + }, + new + { + Id = 10043, + Name = "Фактические данные бурения (вставляются в паспорт скважины)" + }, + new + { + Id = 20000, + Name = "Справки по страницам" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории файла"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Удален ли файл"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_file_info"); + + b.HasComment("Файлы всех категорий"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateCreated") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_created") + .HasComment("Дата совершенного действия"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла"); + + b.Property("IdMarkType") + .HasColumnType("integer") + .HasColumnName("id_mark_type") + .HasComment("0 - отклонен, 1 - согласован"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("id пользователя"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Помечен ли файл как удаленный"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdUser"); + + b.ToTable("t_file_mark"); + + b.HasComment("Действия с файлами."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("real") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_float"); + + b.HasComment("таблица данных ГТИ с типом значения float"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .HasColumnType("integer") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_int"); + + b.HasComment("таблица данных ГТИ с типом значения int"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdRecord") + .HasColumnType("integer") + .HasColumnName("id_record"); + + b.Property("IdItem") + .HasColumnType("integer") + .HasColumnName("id_item"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text") + .HasColumnName("value"); + + b.HasKey("IdTelemetry", "IdRecord", "IdItem", "DateTime"); + + b.ToTable("t_wits_string"); + + b.HasComment("таблица данных ГТИ с типом значения string"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории файла"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название файла"); + + b.Property("Size") + .HasColumnType("bigint") + .HasColumnName("file_size") + .HasComment("Размер файла"); + + b.Property("UrlPage") + .IsRequired() + .HasColumnType("text") + .HasColumnName("url_page") + .HasComment("Url страницы"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.ToTable("t_help_page"); + + b.HasComment("Справки"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_limiting_parameter"); + + b.HasComment("Ограничения по параметрам телеметрии"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Data") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("data") + .HasComment("Данные таблицы последних данных"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("id категории"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("IsDeleted") + .HasColumnType("boolean") + .HasColumnName("is_deleted") + .HasComment("Пометка удаленным"); + + b.Property("Timestamp") + .HasColumnType("timestamp with time zone") + .HasColumnName("timestamp") + .HasComment("время добавления"); + + b.HasKey("Id"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_measure"); + + b.HasComment("Таблица c данными для вкладки 'Последние данные'"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории"); + + b.Property("ShortName") + .HasColumnType("text") + .HasColumnName("short_name") + .HasComment("Короткое название категории"); + + b.HasKey("Id"); + + b.ToTable("t_measure_category"); + + b.HasComment("Категория последних данных"); + + b.HasData( + new + { + Id = 1, + Name = "Показатели бурового раствора", + ShortName = "Раствор" + }, + new + { + Id = 2, + Name = "Шламограмма", + ShortName = "Шламограмма" + }, + new + { + Id = 3, + Name = "ННБ", + ShortName = "ННБ" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdNotificationCategory") + .HasColumnType("integer") + .HasColumnName("id_notification_category") + .HasComment("Id категории уведомления"); + + b.Property("IdTransportType") + .HasColumnType("integer") + .HasColumnName("id_transport_type") + .HasComment("Id типа доставки уведомления"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id получателя"); + + b.Property("Message") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message") + .HasComment("Сообщение уведомления"); + + b.Property("ReadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("read_date") + .HasComment("Дата прочтения уведомления"); + + b.Property("SentDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("sent_date") + .HasComment("Дата отправки уведомления"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text") + .HasColumnName("title") + .HasComment("Заголовок уведомления"); + + b.HasKey("Id"); + + b.HasIndex("IdNotificationCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_notification"); + + b.HasComment("Уведомления"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_notification_category"); + + b.HasComment("Категории уведомлений"); + + b.HasData( + new + { + Id = 1, + Name = "Системные уведомления" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Конечная глубина"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Старотовая глубина"); + + b.Property("IdOperationCategory") + .HasColumnType("integer") + .HasColumnName("id_operation_category") + .HasComment("Ид категории операции"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Ид скважины"); + + b.Property("StandardValue") + .HasColumnType("double precision") + .HasColumnName("standard_value") + .HasComment("Нормативный показатель"); + + b.Property("TargetValue") + .HasColumnType("double precision") + .HasColumnName("target_value") + .HasComment("Целевой показатель"); + + b.HasKey("Id"); + + b.HasIndex("IdOperationCategory"); + + b.HasIndex("IdWell"); + + b.ToTable("t_operationvalue"); + + b.HasComment("Целевые/нормативные показатели операции"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description") + .HasComment("Краткое описание"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_permission"); + + b.HasComment("Разрешения на доступ к данным"); + + b.HasData( + new + { + Id = 100, + Description = "Разрешение удалять админ. Кусты", + Name = "AdminCluster.delete" + }, + new + { + Id = 101, + Description = "Разрешение редактировать админ. Кусты", + Name = "AdminCluster.edit" + }, + new + { + Id = 102, + Description = "Разрешение просматривать админ. Кусты", + Name = "AdminCluster.get" + }, + new + { + Id = 103, + Description = "Разрешение удалять админ. Компании", + Name = "AdminCompany.delete" + }, + new + { + Id = 104, + Description = "Разрешение редактировать админ. Компании", + Name = "AdminCompany.edit" + }, + new + { + Id = 105, + Description = "Разрешение просматривать админ. Компании", + Name = "AdminCompany.get" + }, + new + { + Id = 106, + Description = "Разрешение удалять админ. Типы компаний", + Name = "AdminCompanyType.delete" + }, + new + { + Id = 107, + Description = "Разрешение редактировать админ. Типы компаний", + Name = "AdminCompanyType.edit" + }, + new + { + Id = 108, + Description = "Разрешение просматривать админ. Типы компаний", + Name = "AdminCompanyType.get" + }, + new + { + Id = 109, + Description = "Разрешение удалять админ. Месторождения", + Name = "AdminDeposit.delete" + }, + new + { + Id = 110, + Description = "Разрешение редактировать админ. Месторождения", + Name = "AdminDeposit.edit" + }, + new + { + Id = 111, + Description = "Разрешение просматривать админ. Месторождения", + Name = "AdminDeposit.get" + }, + new + { + Id = 112, + Description = "Разрешение удалять админ. Разрешения", + Name = "AdminPermission.delete" + }, + new + { + Id = 113, + Description = "Разрешение редактировать админ. Разрешения", + Name = "AdminPermission.edit" + }, + new + { + Id = 114, + Description = "Разрешение просматривать админ. Разрешения", + Name = "AdminPermission.get" + }, + new + { + Id = 115, + Description = "Разрешение удалять админ. Телеметрию", + Name = "AdminTelemetry.delete" + }, + new + { + Id = 116, + Description = "Разрешение редактировать админ. Телеметрию", + Name = "AdminTelemetry.edit" + }, + new + { + Id = 117, + Description = "Разрешение просматривать админ. Телеметрию", + Name = "AdminTelemetry.get" + }, + new + { + Id = 118, + Description = "Разрешение удалять админ. Пользователей", + Name = "AdminUser.delete" + }, + new + { + Id = 119, + Description = "Разрешение редактировать админ. Пользователей", + Name = "AdminUser.edit" + }, + new + { + Id = 120, + Description = "Разрешение просматривать админ. Пользователей", + Name = "AdminUser.get" + }, + new + { + Id = 121, + Description = "Разрешение удалять админ. Роли пользователей", + Name = "AdminUserRole.delete" + }, + new + { + Id = 122, + Description = "Разрешение редактировать админ. Роли пользователей", + Name = "AdminUserRole.edit" + }, + new + { + Id = 123, + Description = "Разрешение просматривать админ. Роли пользователей", + Name = "AdminUserRole.get" + }, + new + { + Id = 124, + Description = "Разрешение удалять админ. Скважины", + Name = "AdminWell.delete" + }, + new + { + Id = 125, + Description = "Разрешение редактировать админ. Скважины", + Name = "AdminWell.edit" + }, + new + { + Id = 126, + Description = "Разрешение просматривать админ. Скважины", + Name = "AdminWell.get" + }, + new + { + Id = 127, + Description = "Разрешение удалять админ. Подсистемы", + Name = "AdminSubsytem.delete" + }, + new + { + Id = 128, + Description = "Разрешение редактировать админ. Подсистемы", + Name = "AdminSubsytem.edit" + }, + new + { + Id = 129, + Description = "Разрешение просматривать админ. Подсистемы", + Name = "AdminSubsytem.get" + }, + new + { + Id = 200, + Description = "Разрешение редактировать 0", + Name = "Auth.edit" + }, + new + { + Id = 201, + Description = "Разрешение просматривать 0", + Name = "Auth.get" + }, + new + { + Id = 202, + Description = "Разрешение просматривать Кусты", + Name = "Cluster.get" + }, + new + { + Id = 203, + Description = "Разрешение просматривать Месторождения", + Name = "Deposit.get" + }, + new + { + Id = 204, + Description = "Разрешение удалять РТК", + Name = "DrillFlowChart.delete" + }, + new + { + Id = 205, + Description = "Разрешение редактировать РТК", + Name = "DrillFlowChart.edit" + }, + new + { + Id = 206, + Description = "Разрешение просматривать РТК", + Name = "DrillFlowChart.get" + }, + new + { + Id = 207, + Description = "Разрешение удалять Программу бурения", + Name = "DrillingProgram.delete" + }, + new + { + Id = 208, + Description = "Разрешение редактировать Программу бурения", + Name = "DrillingProgram.edit" + }, + new + { + Id = 209, + Description = "Разрешение просматривать Программу бурения", + Name = "DrillingProgram.get" + }, + new + { + Id = 210, + Description = "Разрешение удалять Режимы бурения", + Name = "DrillParams.delete" + }, + new + { + Id = 211, + Description = "Разрешение редактировать Режимы бурения", + Name = "DrillParams.edit" + }, + new + { + Id = 212, + Description = "Разрешение просматривать Режимы бурения", + Name = "DrillParams.get" + }, + new + { + Id = 213, + Description = "Разрешение удалять Файлы", + Name = "File.delete" + }, + new + { + Id = 214, + Description = "Разрешение редактировать Файлы", + Name = "File.edit" + }, + new + { + Id = 215, + Description = "Разрешение просматривать Файлы", + Name = "File.get" + }, + new + { + Id = 216, + Description = "Разрешение удалять Измерения", + Name = "Measure.delete" + }, + new + { + Id = 217, + Description = "Разрешение редактировать Измерения", + Name = "Measure.edit" + }, + new + { + Id = 218, + Description = "Разрешение просматривать Измерения", + Name = "Measure.get" + }, + new + { + Id = 219, + Description = "Разрешение просматривать Сообщения телеметрии", + Name = "Message.get" + }, + new + { + Id = 220, + Description = "Разрешение просматривать Статистику по операциям", + Name = "OperationStat.get" + }, + new + { + Id = 221, + Description = "Разрешение редактировать Рапорта", + Name = "Report.edit" + }, + new + { + Id = 222, + Description = "Разрешение просматривать Рапорта", + Name = "Report.get" + }, + new + { + Id = 223, + Description = "Разрешение просматривать админ. Системная статистика", + Name = "RequestTracker.get" + }, + new + { + Id = 224, + Description = "Разрешение удалять Рекомендации уставок", + Name = "Setpoints.delete" + }, + new + { + Id = 225, + Description = "Разрешение редактировать Рекомендации уставок", + Name = "Setpoints.edit" + }, + new + { + Id = 226, + Description = "Разрешение просматривать Рекомендации уставок", + Name = "Setpoints.get" + }, + new + { + Id = 227, + Description = "Разрешение редактировать Телеметрии", + Name = "Telemetry.edit" + }, + new + { + Id = 228, + Description = "Разрешение просматривать Анализ телеметрии", + Name = "TelemetryAnalytics.get" + }, + new + { + Id = 229, + Description = "Разрешение редактировать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.edit" + }, + new + { + Id = 230, + Description = "Разрешение просматривать Данные телеметрии по САУБ", + Name = "TelemetryDataSaub.get" + }, + new + { + Id = 231, + Description = "Разрешение редактировать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.edit" + }, + new + { + Id = 232, + Description = "Разрешение просматривать Данные телеметрии по SpinMaster", + Name = "TelemetryDataSpin.get" + }, + new + { + Id = 233, + Description = "Разрешение редактировать Скважины", + Name = "Well.edit" + }, + new + { + Id = 234, + Description = "Разрешение просматривать Скважины", + Name = "Well.get" + }, + new + { + Id = 235, + Description = "Разрешение редактировать Композитные скважины", + Name = "WellComposite.edit" + }, + new + { + Id = 236, + Description = "Разрешение просматривать Композитные скважины", + Name = "WellComposite.get" + }, + new + { + Id = 237, + Description = "Разрешение удалять Операции по скважинам", + Name = "WellOperation.delete" + }, + new + { + Id = 238, + Description = "Разрешение редактировать Операции по скважинам", + Name = "WellOperation.edit" + }, + new + { + Id = 239, + Description = "Разрешение просматривать Операции по скважинам", + Name = "WellOperation.get" + }, + new + { + Id = 240, + Description = "Разрешение редактировать Файлы категории 1 (Растворный сервис)", + Name = "File.edit1" + }, + new + { + Id = 241, + Description = "Разрешение редактировать Файлы категории 2 (Цементирование)", + Name = "File.edit2" + }, + new + { + Id = 242, + Description = "Разрешение редактировать Файлы категории 3 (ННБ)", + Name = "File.edit3" + }, + new + { + Id = 243, + Description = "Разрешение редактировать Файлы категории 4 (ГТИ)", + Name = "File.edit4" + }, + new + { + Id = 244, + Description = "Разрешение редактировать Файлы категории 5 (Документы по скважине)", + Name = "File.edit5" + }, + new + { + Id = 245, + Description = "Разрешение редактировать Файлы категории 6 (Супервайзер)", + Name = "File.edit6" + }, + new + { + Id = 246, + Description = "Разрешение редактировать Файлы категории 7 (Мастер)", + Name = "File.edit7" + }, + new + { + Id = 247, + Description = "Разрешение редактировать Файлы категории 8 (Долотный сервис)", + Name = "File.edit8" + }, + new + { + Id = 248, + Description = "Разрешение редактировать Файлы категории 9 (Буровой подрядчик)", + Name = "File.edit9" + }, + new + { + Id = 249, + Description = "Разрешение редактировать Файлы категории 10 (Сервис по заканчиванию скважины)", + Name = "File.edit10" + }, + new + { + Id = 250, + Description = "Разрешение редактировать Файлы категории 11 (Рапорт)", + Name = "File.edit11" + }, + new + { + Id = 251, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit12" + }, + new + { + Id = 252, + Description = "Разрешение редактировать Файлы категории 12", + Name = "File.edit13" + }, + new + { + Id = 253, + Description = "Разрешение редактировать Файлы категории 13", + Name = "File.edit14" + }, + new + { + Id = 254, + Description = "Разрешение редактировать Файлы категории 14", + Name = "File.edit15" + }, + new + { + Id = 255, + Description = "Разрешение редактировать Файлы категории 15", + Name = "File.edit16" + }, + new + { + Id = 256, + Description = "Разрешение редактировать Файлы категории 16", + Name = "File.edit17" + }, + new + { + Id = 257, + Description = "Разрешение редактировать Файлы категории 17", + Name = "File.edit18" + }, + new + { + Id = 258, + Description = "Разрешение редактировать Файлы категории 18", + Name = "File.edit19" + }, + new + { + Id = 259, + Description = "Разрешение редактировать Файлы категории 19", + Name = "File.edit20" + }, + new + { + Id = 260, + Description = "Разрешение редактировать Файлы категории 20", + Name = "File.edit21" + }, + new + { + Id = 261, + Description = "Разрешение редактировать Файлы категории 21", + Name = "File.edit22" + }, + new + { + Id = 262, + Description = "Разрешение редактировать Файлы категории 22", + Name = "File.edit23" + }, + new + { + Id = 263, + Description = "Разрешение редактировать Файлы категории 23", + Name = "File.edit24" + }, + new + { + Id = 264, + Description = "Разрешение редактировать Файлы категории 24", + Name = "File.edit25" + }, + new + { + Id = 265, + Description = "Разрешение редактировать Файлы категории 25", + Name = "File.edit26" + }, + new + { + Id = 266, + Description = "Разрешение редактировать Файлы категории 26", + Name = "File.edit27" + }, + new + { + Id = 267, + Description = "Разрешение редактировать Файлы категории 27", + Name = "File.edit28" + }, + new + { + Id = 268, + Description = "Разрешение редактировать Файлы категории 28", + Name = "File.edit29" + }, + new + { + Id = 269, + Description = "Разрешение редактировать Файлы категории 29", + Name = "File.edit30" + }, + new + { + Id = 380, + Description = "Разрешение просматривать список бурильщиков", + Name = "Driller.get" + }, + new + { + Id = 381, + Description = "Разрешение редактировать бурильщика", + Name = "Driller.edit" + }, + new + { + Id = 382, + Description = "Разрешение удалять бурильщик", + Name = "Driller.delete" + }, + new + { + Id = 383, + Description = "Разрешение просматривать графики бурильщиков", + Name = "Schedule.get" + }, + new + { + Id = 384, + Description = "Разрешение редактировать график бурильщика", + Name = "Schedule.edit" + }, + new + { + Id = 385, + Description = "Разрешение удалять график бурильщика", + Name = "Schedule.delete" + }, + new + { + Id = 386, + Description = "Разрешение просматривать суточный рапорт", + Name = "DailyReport.get" + }, + new + { + Id = 387, + Description = "Разрешение редактировать суточный рапорт", + Name = "DailyReport.edit" + }, + new + { + Id = 388, + Description = "Разрешение просматривать авто. определенные операции", + Name = "DetectedOperation.get" + }, + new + { + Id = 389, + Description = "Разрешение просматривать целевые значения", + Name = "OperationValue.get" + }, + new + { + Id = 390, + Description = "Разрешение редактировать целевые значения", + Name = "OperationValue.edit" + }, + new + { + Id = 391, + Description = "Разрешение удалять целевые значения", + Name = "OperationValue.delete" + }, + new + { + Id = 400, + Description = "Разрешение просматривать инфо по wits параметрам", + Name = "WitsInfo.get" + }, + new + { + Id = 401, + Description = "Разрешение просматривать WITS record 1", + Name = "WitsRecord1.get" + }, + new + { + Id = 407, + Description = "Разрешение просматривать WITS record 7", + Name = "WitsRecord7.get" + }, + new + { + Id = 408, + Description = "Разрешение просматривать WITS record 8", + Name = "WitsRecord8.get" + }, + new + { + Id = 450, + Description = "Разрешение просматривать WITS record 50", + Name = "WitsRecord50.get" + }, + new + { + Id = 460, + Description = "Разрешение просматривать WITS record 60", + Name = "WitsRecord60.get" + }, + new + { + Id = 461, + Description = "Разрешение просматривать WITS record 61", + Name = "WitsRecord61.get" + }, + new + { + Id = 500, + Description = "Разрешение удалять Категорий документов файлов", + Name = "FileCategory.delete" + }, + new + { + Id = 501, + Description = "Разрешение редактировать Категорий документов файлов", + Name = "FileCategory.edit" + }, + new + { + Id = 502, + Description = "Разрешение просматривать Категорий документов файлов", + Name = "FileCategory.get" + }, + new + { + Id = 503, + Description = "Разрешение удалять Дело скважины", + Name = "WellFinalDocuments.delete" + }, + new + { + Id = 504, + Description = "Разрешение редактировать Дело скважины", + Name = "WellFinalDocuments.edit" + }, + new + { + Id = 505, + Description = "Разрешение просматривать Дело скважины", + Name = "WellFinalDocuments.get" + }, + new + { + Id = 506, + Description = "Разрешение редактировать ответственных за загрузку файла Дело скважины", + Name = "WellFinalDocuments.editPublisher" + }, + new + { + Id = 507, + Description = "Разрешение просматривать наработка талевого каната", + Name = "TelemetryWirelineRunOut.get" + }, + new + { + Id = 510, + Description = "Разрешение просматривать плановая траектория", + Name = "PlannedTrajectory.get" + }, + new + { + Id = 511, + Description = "Разрешение редактировать плановая траектория", + Name = "PlannedTrajectory.edit" + }, + new + { + Id = 512, + Description = "Разрешение удалять плановая траектория", + 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 = "Разрешение просматривать статистику вопросов", + Name = "FaqStatistics.get" + }, + new + { + Id = 517, + Description = "Разрешение редактировать вопрос", + Name = "FaqStatistics.edit" + }, + new + { + Id = 518, + Description = "Разрешение удалять вопрос", + Name = "FaqStatistics.delete" + }, + new + { + Id = 519, + Description = "Разрешение просматривать список контактов", + Name = "WellContact.get" + }, + new + { + Id = 520, + Description = "Разрешение редактировать список контактов", + Name = "WellContact.edit" + }, + new + { + Id = 521, + Description = "Разрешить создание справок по страницам", + Name = "HelpPage.edit" + }, + new + { + Id = 522, + Description = "Разрешить удаление всех настроек пользователя", + Name = "UserSettings.delete" + }, + new + { + Id = 525, + Description = "Разрешение на редактирование РТК у завершенной скважины", + Name = "ProcessMap.editCompletedWell" + }, + new + { + Id = 526, + Description = "Разрешение на редактирование операций у завершенной скважины", + Name = "WellOperation.editCompletedWell" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AbsoluteMark") + .HasColumnType("double precision") + .HasColumnName("absolute_mark") + .HasComment("Абсолютная отметка"); + + b.Property("AngleIntensity") + .HasColumnType("double precision") + .HasColumnName("angle_intensity") + .HasComment("Интенсивность по углу"); + + b.Property("AzimuthGeo") + .HasColumnType("double precision") + .HasColumnName("azimuth_geo") + .HasComment("Азимут Географ."); + + b.Property("AzimuthIntensity") + .HasColumnType("double precision") + .HasColumnName("azimuth_intensity") + .HasComment("Интенсивность по азимуту"); + + b.Property("AzimuthMagnetic") + .HasColumnType("double precision") + .HasColumnName("azimuth_magnetic") + .HasComment("Азимут Магнитный"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарии"); + + b.Property("EastCartographic") + .HasColumnType("double precision") + .HasColumnName("east_cartographic") + .HasComment("Восток картографический"); + + b.Property("EastOrifice") + .HasColumnType("double precision") + .HasColumnName("east_orifice") + .HasComment("Восток отн-но устья"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("ID пользователя который внес/изменил запись"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("ID скважины"); + + b.Property("NorthCartographic") + .HasColumnType("double precision") + .HasColumnName("north_cartographic") + .HasComment("Север картографический"); + + b.Property("NorthOrifice") + .HasColumnType("double precision") + .HasColumnName("north_orifice") + .HasComment("Север отн-но устья"); + + b.Property("OrificeOffset") + .HasColumnType("double precision") + .HasColumnName("orifice_offset") + .HasComment("Смещение от устья"); + + b.Property("Radius") + .HasColumnType("double precision") + .HasColumnName("radius") + .HasComment("Радиус цели"); + + b.Property("SpatialIntensity") + .HasColumnType("double precision") + .HasColumnName("spatial_intensity") + .HasComment("Пространственная интенсивность"); + + b.Property("UpdateDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("update_date") + .HasComment("Дата загрузки траектории"); + + b.Property("VerticalDepth") + .HasColumnType("double precision") + .HasColumnName("vertical_depth") + .HasComment("Глубина вертикальная"); + + b.Property("WellboreDepth") + .HasColumnType("double precision") + .HasColumnName("wellbore_depth") + .HasComment("Глубина по стволу"); + + b.Property("ZenithAngle") + .HasColumnType("double precision") + .HasColumnName("zenith_angle") + .HasComment("Угол зенитный"); + + b.HasKey("Id"); + + b.HasIndex("IdUser"); + + b.HasIndex("IdWell"); + + b.ToTable("t_planned_trajectory"); + + b.HasComment("Загрузка плановой траектории"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ProcessMap", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AxialLoadLimitMax") + .HasColumnType("double precision") + .HasColumnName("axial_load_limit_max") + .HasComment("Нагрузка, допустимый максимум"); + + b.Property("AxialLoadPlan") + .HasColumnType("double precision") + .HasColumnName("axial_load_plan") + .HasComment("Нагрузка, план"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина окончания интервала"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Стартовая глубина"); + + b.Property("FlowLimitMax") + .HasColumnType("double precision") + .HasColumnName("flow_limit_max") + .HasComment("Расход, допустимый максимум"); + + b.Property("FlowPlan") + .HasColumnType("double precision") + .HasColumnName("flow_plan") + .HasComment("Расход, план"); + + b.Property("IdMode") + .HasColumnType("integer") + .HasColumnName("id_mode") + .HasComment("Id режима (1- ротор, 2 слайд)"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Id пользователя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("well_id") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_wellsection_type") + .HasComment("Тип секции"); + + b.Property("LastUpdate") + .HasColumnType("timestamp with time zone") + .HasColumnName("last_update") + .HasComment("Дата последнего изменения"); + + b.Property("PressureLimitMax") + .HasColumnType("double precision") + .HasColumnName("pressure_limit_max") + .HasComment("Перепад давления, допустимый максимум"); + + b.Property("PressurePlan") + .HasColumnType("double precision") + .HasColumnName("pressure_plan") + .HasComment("Перепад давления, план"); + + b.Property("RopPlan") + .HasColumnType("double precision") + .HasColumnName("rop_plan") + .HasComment("Плановая механическая скорость, м/ч"); + + b.Property("TopDriveSpeedLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_limit_max") + .HasComment("Обороты на ВСП, допустимый максимум"); + + b.Property("TopDriveSpeedPlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_speed_plan") + .HasComment("Обороты на ВСП, план"); + + b.Property("TopDriveTorqueLimitMax") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_limit_max") + .HasComment("Момент на ВСП, допустимый максимум"); + + b.Property("TopDriveTorquePlan") + .HasColumnType("double precision") + .HasColumnName("top_drive_torque_plan") + .HasComment("Момент на ВСП, план"); + + b.Property("UsageSaub") + .HasColumnType("double precision") + .HasColumnName("usage_saub") + .HasComment("Плановый процент использования АКБ"); + + b.Property("UsageSpin") + .HasColumnType("double precision") + .HasColumnName("usage_spin") + .HasComment("Плановый процент использования spin master"); + + b.HasKey("Id"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_process_map"); + + b.HasComment("Операции по скважине – РТК"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationCompanyWell", b => + { + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.HasKey("IdCompany", "IdWell"); + + b.HasIndex("IdWell"); + + b.ToTable("t_relation_company_well"); + + b.HasComment("отношение скважин и компаний"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.HasKey("IdWell", "IdUser"); + + b.HasIndex("IdUser"); + + b.ToTable("t_relation_contact_well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdDrillingProgramPart") + .HasColumnType("integer") + .HasColumnName("id_drilling_program_part"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_role") + .HasComment("1 - publisher, 2 - approver"); + + b.HasKey("IdUser", "IdDrillingProgramPart") + .HasName("t_relation_user_drilling_program_part_pk"); + + b.HasIndex("IdDrillingProgramPart"); + + b.ToTable("t_relation_user_drilling_program_part"); + + b.HasComment("Отношение пользователей и частей ПБ"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdPermission") + .HasColumnType("integer") + .HasColumnName("id_permission"); + + b.HasKey("IdUserRole", "IdPermission"); + + b.HasIndex("IdPermission"); + + b.ToTable("t_relation_user_role_permission"); + + b.HasComment("Отношение ролей пользователей и разрешений доступа"); + + b.HasData( + new + { + IdUserRole = 1100, + IdPermission = 102 + }, + new + { + IdUserRole = 1100, + IdPermission = 111 + }, + new + { + IdUserRole = 1101, + IdPermission = 101 + }, + new + { + IdUserRole = 1101, + IdPermission = 100 + }, + new + { + IdUserRole = 1102, + IdPermission = 105 + }, + new + { + IdUserRole = 1102, + IdPermission = 108 + }, + new + { + IdUserRole = 1103, + IdPermission = 104 + }, + new + { + IdUserRole = 1103, + IdPermission = 103 + }, + new + { + IdUserRole = 1104, + IdPermission = 108 + }, + new + { + IdUserRole = 1105, + IdPermission = 107 + }, + new + { + IdUserRole = 1105, + IdPermission = 106 + }, + new + { + IdUserRole = 1106, + IdPermission = 111 + }, + new + { + IdUserRole = 1107, + IdPermission = 110 + }, + new + { + IdUserRole = 1107, + IdPermission = 109 + }, + new + { + IdUserRole = 1108, + IdPermission = 114 + }, + new + { + IdUserRole = 1109, + IdPermission = 113 + }, + new + { + IdUserRole = 1109, + IdPermission = 112 + }, + new + { + IdUserRole = 1110, + IdPermission = 123 + }, + new + { + IdUserRole = 1110, + IdPermission = 114 + }, + new + { + IdUserRole = 1111, + IdPermission = 122 + }, + new + { + IdUserRole = 1111, + IdPermission = 121 + }, + new + { + IdUserRole = 1112, + IdPermission = 117 + }, + new + { + IdUserRole = 1113, + IdPermission = 105 + }, + new + { + IdUserRole = 1113, + IdPermission = 123 + }, + new + { + IdUserRole = 1113, + IdPermission = 120 + }, + new + { + IdUserRole = 1114, + IdPermission = 119 + }, + new + { + IdUserRole = 1114, + IdPermission = 118 + }, + new + { + IdUserRole = 1114, + IdPermission = 200 + }, + new + { + IdUserRole = 1115, + IdPermission = 223 + }, + new + { + IdUserRole = 1116, + IdPermission = 105 + }, + new + { + IdUserRole = 1116, + IdPermission = 102 + }, + new + { + IdUserRole = 1116, + IdPermission = 117 + }, + new + { + IdUserRole = 1116, + IdPermission = 126 + }, + new + { + IdUserRole = 1117, + IdPermission = 125 + }, + new + { + IdUserRole = 1117, + IdPermission = 124 + }, + new + { + IdUserRole = 1200, + IdPermission = 203 + }, + new + { + IdUserRole = 1200, + IdPermission = 230 + }, + new + { + IdUserRole = 1201, + IdPermission = 202 + }, + new + { + IdUserRole = 1201, + IdPermission = 203 + }, + new + { + IdUserRole = 1201, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 203 + }, + new + { + IdUserRole = 1202, + IdPermission = 220 + }, + new + { + IdUserRole = 1202, + IdPermission = 236 + }, + new + { + IdUserRole = 1202, + IdPermission = 212 + }, + new + { + IdUserRole = 1203, + IdPermission = 235 + }, + new + { + IdUserRole = 1204, + IdPermission = 202 + }, + new + { + IdUserRole = 1204, + IdPermission = 203 + }, + new + { + IdUserRole = 1205, + IdPermission = 215 + }, + new + { + IdUserRole = 1206, + IdPermission = 203 + }, + new + { + IdUserRole = 1206, + IdPermission = 206 + }, + new + { + IdUserRole = 1207, + IdPermission = 205 + }, + new + { + IdUserRole = 1208, + IdPermission = 218 + }, + new + { + IdUserRole = 1209, + IdPermission = 217 + }, + new + { + IdUserRole = 1210, + IdPermission = 203 + }, + new + { + IdUserRole = 1210, + IdPermission = 230 + }, + new + { + IdUserRole = 1210, + IdPermission = 219 + }, + new + { + IdUserRole = 1211, + IdPermission = 203 + }, + new + { + IdUserRole = 1211, + IdPermission = 220 + }, + new + { + IdUserRole = 1211, + IdPermission = 239 + }, + new + { + IdUserRole = 1212, + IdPermission = 238 + }, + new + { + IdUserRole = 1212, + IdPermission = 237 + }, + new + { + IdUserRole = 1213, + IdPermission = 203 + }, + new + { + IdUserRole = 1213, + IdPermission = 239 + }, + new + { + IdUserRole = 1213, + IdPermission = 212 + }, + new + { + IdUserRole = 1214, + IdPermission = 211 + }, + new + { + IdUserRole = 1214, + IdPermission = 210 + }, + new + { + IdUserRole = 1215, + IdPermission = 203 + }, + new + { + IdUserRole = 1215, + IdPermission = 222 + }, + new + { + IdUserRole = 1216, + IdPermission = 221 + }, + new + { + IdUserRole = 1217, + IdPermission = 226 + }, + new + { + IdUserRole = 1218, + IdPermission = 225 + }, + new + { + IdUserRole = 1218, + IdPermission = 224 + }, + new + { + IdUserRole = 1219, + IdPermission = 203 + }, + new + { + IdUserRole = 1219, + IdPermission = 206 + }, + new + { + IdUserRole = 1219, + IdPermission = 230 + }, + new + { + IdUserRole = 1219, + IdPermission = 232 + }, + new + { + IdUserRole = 1220, + IdPermission = 203 + }, + new + { + IdUserRole = 1220, + IdPermission = 228 + }, + new + { + IdUserRole = 1221, + IdPermission = 202 + }, + new + { + IdUserRole = 1221, + IdPermission = 203 + }, + new + { + IdUserRole = 1221, + IdPermission = 220 + }, + new + { + IdUserRole = 1221, + IdPermission = 234 + }, + new + { + IdUserRole = 1500, + IdPermission = 507 + }, + new + { + IdUserRole = 1500, + IdPermission = 510 + }, + new + { + IdUserRole = 1501, + IdPermission = 214 + }, + new + { + IdUserRole = 1501, + IdPermission = 213 + }, + new + { + IdUserRole = 1502, + IdPermission = 207 + }, + new + { + IdUserRole = 1502, + IdPermission = 208 + }, + new + { + IdUserRole = 2000, + IdPermission = 205 + }, + new + { + IdUserRole = 2000, + IdPermission = 204 + }, + new + { + IdUserRole = 2000, + IdPermission = 245 + }, + new + { + IdUserRole = 2001, + IdPermission = 244 + }, + new + { + IdUserRole = 2001, + IdPermission = 245 + }, + new + { + IdUserRole = 2002, + IdPermission = 244 + }, + new + { + IdUserRole = 2002, + IdPermission = 246 + }, + new + { + IdUserRole = 2002, + IdPermission = 237 + }, + new + { + IdUserRole = 2002, + IdPermission = 238 + }, + new + { + IdUserRole = 2003, + IdPermission = 240 + }, + new + { + IdUserRole = 2003, + IdPermission = 217 + }, + new + { + IdUserRole = 2003, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 242 + }, + new + { + IdUserRole = 2004, + IdPermission = 217 + }, + new + { + IdUserRole = 2004, + IdPermission = 216 + }, + new + { + IdUserRole = 2004, + IdPermission = 205 + }, + new + { + IdUserRole = 2004, + IdPermission = 204 + }, + new + { + IdUserRole = 2005, + IdPermission = 247 + }, + new + { + IdUserRole = 2005, + IdPermission = 205 + }, + new + { + IdUserRole = 2005, + IdPermission = 204 + }, + new + { + IdUserRole = 2006, + IdPermission = 243 + }, + new + { + IdUserRole = 2006, + IdPermission = 205 + }, + new + { + IdUserRole = 2006, + IdPermission = 204 + }, + new + { + IdUserRole = 2007, + IdPermission = 241 + }, + new + { + IdUserRole = 2007, + IdPermission = 205 + }, + new + { + IdUserRole = 2007, + IdPermission = 204 + }, + new + { + IdUserRole = 2009, + IdPermission = 525 + }, + new + { + IdUserRole = 2009, + IdPermission = 526 + }, + new + { + IdUserRole = 2013, + IdPermission = 525 + }, + new + { + IdUserRole = 2013, + IdPermission = 526 + }, + new + { + IdUserRole = 1, + IdPermission = 100 + }, + new + { + IdUserRole = 1, + IdPermission = 101 + }, + new + { + IdUserRole = 1, + IdPermission = 102 + }, + new + { + IdUserRole = 1, + IdPermission = 103 + }, + new + { + IdUserRole = 1, + IdPermission = 104 + }, + new + { + IdUserRole = 1, + IdPermission = 105 + }, + new + { + IdUserRole = 1, + IdPermission = 106 + }, + new + { + IdUserRole = 1, + IdPermission = 107 + }, + new + { + IdUserRole = 1, + IdPermission = 108 + }, + new + { + IdUserRole = 1, + IdPermission = 109 + }, + new + { + IdUserRole = 1, + IdPermission = 110 + }, + new + { + IdUserRole = 1, + IdPermission = 111 + }, + new + { + IdUserRole = 1, + IdPermission = 112 + }, + new + { + IdUserRole = 1, + IdPermission = 113 + }, + new + { + IdUserRole = 1, + IdPermission = 114 + }, + new + { + IdUserRole = 1, + IdPermission = 115 + }, + new + { + IdUserRole = 1, + IdPermission = 116 + }, + new + { + IdUserRole = 1, + IdPermission = 117 + }, + new + { + IdUserRole = 1, + IdPermission = 118 + }, + new + { + IdUserRole = 1, + IdPermission = 119 + }, + new + { + IdUserRole = 1, + IdPermission = 120 + }, + new + { + IdUserRole = 1, + IdPermission = 121 + }, + new + { + IdUserRole = 1, + IdPermission = 122 + }, + new + { + IdUserRole = 1, + IdPermission = 123 + }, + new + { + IdUserRole = 1, + IdPermission = 124 + }, + new + { + IdUserRole = 1, + IdPermission = 125 + }, + new + { + IdUserRole = 1, + IdPermission = 126 + }, + new + { + IdUserRole = 1, + IdPermission = 127 + }, + new + { + IdUserRole = 1, + IdPermission = 128 + }, + new + { + IdUserRole = 1, + IdPermission = 129 + }, + new + { + IdUserRole = 1, + IdPermission = 200 + }, + new + { + IdUserRole = 1, + IdPermission = 201 + }, + new + { + IdUserRole = 1, + IdPermission = 202 + }, + new + { + IdUserRole = 1, + IdPermission = 203 + }, + new + { + IdUserRole = 1, + IdPermission = 204 + }, + new + { + IdUserRole = 1, + IdPermission = 205 + }, + new + { + IdUserRole = 1, + IdPermission = 206 + }, + new + { + IdUserRole = 1, + IdPermission = 207 + }, + new + { + IdUserRole = 1, + IdPermission = 208 + }, + new + { + IdUserRole = 1, + IdPermission = 209 + }, + new + { + IdUserRole = 1, + IdPermission = 210 + }, + new + { + IdUserRole = 1, + IdPermission = 211 + }, + new + { + IdUserRole = 1, + IdPermission = 212 + }, + new + { + IdUserRole = 1, + IdPermission = 213 + }, + new + { + IdUserRole = 1, + IdPermission = 214 + }, + new + { + IdUserRole = 1, + IdPermission = 215 + }, + new + { + IdUserRole = 1, + IdPermission = 216 + }, + new + { + IdUserRole = 1, + IdPermission = 217 + }, + new + { + IdUserRole = 1, + IdPermission = 218 + }, + new + { + IdUserRole = 1, + IdPermission = 219 + }, + new + { + IdUserRole = 1, + IdPermission = 220 + }, + new + { + IdUserRole = 1, + IdPermission = 221 + }, + new + { + IdUserRole = 1, + IdPermission = 222 + }, + new + { + IdUserRole = 1, + IdPermission = 223 + }, + new + { + IdUserRole = 1, + IdPermission = 224 + }, + new + { + IdUserRole = 1, + IdPermission = 225 + }, + new + { + IdUserRole = 1, + IdPermission = 226 + }, + new + { + IdUserRole = 1, + IdPermission = 227 + }, + new + { + IdUserRole = 1, + IdPermission = 228 + }, + new + { + IdUserRole = 1, + IdPermission = 229 + }, + new + { + IdUserRole = 1, + IdPermission = 230 + }, + new + { + IdUserRole = 1, + IdPermission = 231 + }, + new + { + IdUserRole = 1, + IdPermission = 232 + }, + new + { + IdUserRole = 1, + IdPermission = 233 + }, + new + { + IdUserRole = 1, + IdPermission = 234 + }, + new + { + IdUserRole = 1, + IdPermission = 235 + }, + new + { + IdUserRole = 1, + IdPermission = 236 + }, + new + { + IdUserRole = 1, + IdPermission = 237 + }, + new + { + IdUserRole = 1, + IdPermission = 238 + }, + new + { + IdUserRole = 1, + IdPermission = 239 + }, + new + { + IdUserRole = 1, + IdPermission = 240 + }, + new + { + IdUserRole = 1, + IdPermission = 241 + }, + new + { + IdUserRole = 1, + IdPermission = 242 + }, + new + { + IdUserRole = 1, + IdPermission = 243 + }, + new + { + IdUserRole = 1, + IdPermission = 244 + }, + new + { + IdUserRole = 1, + IdPermission = 245 + }, + new + { + IdUserRole = 1, + IdPermission = 246 + }, + new + { + IdUserRole = 1, + IdPermission = 247 + }, + new + { + IdUserRole = 1, + IdPermission = 248 + }, + new + { + IdUserRole = 1, + IdPermission = 249 + }, + new + { + IdUserRole = 1, + IdPermission = 250 + }, + new + { + IdUserRole = 1, + IdPermission = 251 + }, + new + { + IdUserRole = 1, + IdPermission = 252 + }, + new + { + IdUserRole = 1, + IdPermission = 253 + }, + new + { + IdUserRole = 1, + IdPermission = 254 + }, + new + { + IdUserRole = 1, + IdPermission = 255 + }, + new + { + IdUserRole = 1, + IdPermission = 256 + }, + new + { + IdUserRole = 1, + IdPermission = 257 + }, + new + { + IdUserRole = 1, + IdPermission = 258 + }, + new + { + IdUserRole = 1, + IdPermission = 259 + }, + new + { + IdUserRole = 1, + IdPermission = 260 + }, + new + { + IdUserRole = 1, + IdPermission = 261 + }, + new + { + IdUserRole = 1, + IdPermission = 262 + }, + new + { + IdUserRole = 1, + IdPermission = 263 + }, + new + { + IdUserRole = 1, + IdPermission = 264 + }, + new + { + IdUserRole = 1, + IdPermission = 265 + }, + new + { + IdUserRole = 1, + IdPermission = 266 + }, + new + { + IdUserRole = 1, + IdPermission = 267 + }, + new + { + IdUserRole = 1, + IdPermission = 268 + }, + new + { + IdUserRole = 1, + IdPermission = 269 + }, + new + { + IdUserRole = 1, + IdPermission = 380 + }, + new + { + IdUserRole = 1, + IdPermission = 381 + }, + new + { + IdUserRole = 1, + IdPermission = 382 + }, + new + { + IdUserRole = 1, + IdPermission = 383 + }, + new + { + IdUserRole = 1, + IdPermission = 384 + }, + new + { + IdUserRole = 1, + IdPermission = 385 + }, + new + { + IdUserRole = 1, + IdPermission = 386 + }, + new + { + IdUserRole = 1, + IdPermission = 387 + }, + new + { + IdUserRole = 1, + IdPermission = 388 + }, + new + { + IdUserRole = 1, + IdPermission = 389 + }, + new + { + IdUserRole = 1, + IdPermission = 390 + }, + new + { + IdUserRole = 1, + IdPermission = 391 + }, + new + { + IdUserRole = 1, + IdPermission = 400 + }, + new + { + IdUserRole = 1, + IdPermission = 401 + }, + new + { + IdUserRole = 1, + IdPermission = 407 + }, + new + { + IdUserRole = 1, + IdPermission = 408 + }, + new + { + IdUserRole = 1, + IdPermission = 450 + }, + new + { + IdUserRole = 1, + IdPermission = 460 + }, + new + { + IdUserRole = 1, + IdPermission = 461 + }, + new + { + IdUserRole = 1, + IdPermission = 500 + }, + new + { + IdUserRole = 1, + IdPermission = 501 + }, + new + { + IdUserRole = 1, + IdPermission = 502 + }, + new + { + IdUserRole = 1, + IdPermission = 503 + }, + new + { + IdUserRole = 1, + IdPermission = 504 + }, + new + { + IdUserRole = 1, + IdPermission = 505 + }, + new + { + IdUserRole = 1, + IdPermission = 506 + }, + new + { + IdUserRole = 1, + IdPermission = 507 + }, + new + { + IdUserRole = 1, + IdPermission = 510 + }, + new + { + IdUserRole = 1, + IdPermission = 511 + }, + new + { + IdUserRole = 1, + IdPermission = 512 + }, + new + { + IdUserRole = 1, + IdPermission = 513 + }, + new + { + IdUserRole = 1, + IdPermission = 514 + }, + new + { + IdUserRole = 1, + IdPermission = 515 + }, + new + { + IdUserRole = 1, + IdPermission = 516 + }, + new + { + IdUserRole = 1, + IdPermission = 517 + }, + new + { + IdUserRole = 1, + IdPermission = 518 + }, + new + { + IdUserRole = 1, + IdPermission = 519 + }, + new + { + IdUserRole = 1, + IdPermission = 520 + }, + new + { + IdUserRole = 1, + IdPermission = 521 + }, + new + { + IdUserRole = 1, + IdPermission = 522 + }, + new + { + IdUserRole = 1, + IdPermission = 525 + }, + new + { + IdUserRole = 1, + IdPermission = 526 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.Property("Id") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.Property("IdInclude") + .HasColumnType("integer") + .HasColumnName("id_include_user_role"); + + b.HasKey("Id", "IdInclude") + .HasName("t_relation_user_role_user_role_pk"); + + b.HasIndex("IdInclude"); + + b.ToTable("t_relation_user_role_user_role"); + + b.HasComment("Отношение ролей к ролям"); + + b.HasData( + new + { + Id = 1101, + IdInclude = 1100 + }, + new + { + Id = 1103, + IdInclude = 1102 + }, + new + { + Id = 1105, + IdInclude = 1104 + }, + new + { + Id = 1107, + IdInclude = 1106 + }, + new + { + Id = 1109, + IdInclude = 1108 + }, + new + { + Id = 1111, + IdInclude = 1110 + }, + new + { + Id = 1114, + IdInclude = 1113 + }, + new + { + Id = 1117, + IdInclude = 1116 + }, + new + { + Id = 1203, + IdInclude = 1202 + }, + new + { + Id = 1207, + IdInclude = 1206 + }, + new + { + Id = 1209, + IdInclude = 1208 + }, + new + { + Id = 1212, + IdInclude = 1211 + }, + new + { + Id = 1214, + IdInclude = 1213 + }, + new + { + Id = 1216, + IdInclude = 1215 + }, + new + { + Id = 1218, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1200 + }, + new + { + Id = 2000, + IdInclude = 1201 + }, + new + { + Id = 2000, + IdInclude = 1202 + }, + new + { + Id = 2000, + IdInclude = 1204 + }, + new + { + Id = 2000, + IdInclude = 1205 + }, + new + { + Id = 2000, + IdInclude = 1206 + }, + new + { + Id = 2000, + IdInclude = 1208 + }, + new + { + Id = 2000, + IdInclude = 1210 + }, + new + { + Id = 2000, + IdInclude = 1211 + }, + new + { + Id = 2000, + IdInclude = 1213 + }, + new + { + Id = 2000, + IdInclude = 1215 + }, + new + { + Id = 2000, + IdInclude = 1217 + }, + new + { + Id = 2000, + IdInclude = 1219 + }, + new + { + Id = 2000, + IdInclude = 1220 + }, + new + { + Id = 2000, + IdInclude = 1221 + }, + new + { + Id = 2000, + IdInclude = 1500 + }, + new + { + Id = 2000, + IdInclude = 1501 + }, + new + { + Id = 2000, + IdInclude = 1502 + }, + new + { + Id = 2001, + IdInclude = 1500 + }, + new + { + Id = 2001, + IdInclude = 1501 + }, + new + { + Id = 2001, + IdInclude = 1502 + }, + new + { + Id = 2002, + IdInclude = 1500 + }, + new + { + Id = 2002, + IdInclude = 1501 + }, + new + { + Id = 2002, + IdInclude = 1502 + }, + new + { + Id = 2003, + IdInclude = 1500 + }, + new + { + Id = 2003, + IdInclude = 1501 + }, + new + { + Id = 2003, + IdInclude = 1502 + }, + new + { + Id = 2004, + IdInclude = 1500 + }, + new + { + Id = 2004, + IdInclude = 1501 + }, + new + { + Id = 2004, + IdInclude = 1502 + }, + new + { + Id = 2005, + IdInclude = 1500 + }, + new + { + Id = 2005, + IdInclude = 1501 + }, + new + { + Id = 2005, + IdInclude = 1502 + }, + new + { + Id = 2006, + IdInclude = 1500 + }, + new + { + Id = 2006, + IdInclude = 1501 + }, + new + { + Id = 2006, + IdInclude = 1502 + }, + new + { + Id = 2007, + IdInclude = 1500 + }, + new + { + Id = 2007, + IdInclude = 1501 + }, + new + { + Id = 2007, + IdInclude = 1502 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdUserRole") + .HasColumnType("integer") + .HasColumnName("id_user_role"); + + b.HasKey("IdUser", "IdUserRole"); + + b.HasIndex("IdUserRole"); + + b.ToTable("t_relation_user_user_role"); + + b.HasComment("Отношение пользователей и ролей"); + + b.HasData( + new + { + IdUser = 1, + IdUserRole = 1 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Begin") + .HasColumnType("timestamp with time zone") + .HasColumnName("begin"); + + b.Property("End") + .HasColumnType("timestamp with time zone") + .HasColumnName("end") + .HasComment("timestamp with time zone"); + + b.Property("Format") + .HasColumnType("integer") + .HasColumnName("format") + .HasComment("Формат отчета"); + + b.Property("IdFile") + .HasColumnType("integer") + .HasColumnName("id_file") + .HasComment("id файла-родителя"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("Step") + .HasColumnType("integer") + .HasColumnName("step") + .HasComment("размер шага в секундах"); + + b.HasKey("Id"); + + b.HasIndex("IdFile"); + + b.HasIndex("IdWell"); + + b.ToTable("t_report_property"); + + b.HasComment("Отчеты с данными по буровым"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id") + .HasComment("Идентификатор"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DrillEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_end") + .HasComment("Конец вахты"); + + b.Property("DrillStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("drill_start") + .HasComment("Начало вахты"); + + b.Property("IdDriller") + .HasColumnType("integer") + .HasColumnName("id_driller") + .HasComment("Идентификатор бурильщика"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Идентификатор скважины"); + + b.Property("ShiftEnd") + .HasColumnType("time without time zone") + .HasColumnName("shift_end") + .HasComment("Конец смены"); + + b.Property("ShiftStart") + .HasColumnType("time without time zone") + .HasColumnName("shift_start") + .HasComment("Начало смены"); + + b.HasKey("Id"); + + b.HasIndex("IdDriller"); + + b.HasIndex("IdWell"); + + b.ToTable("t_schedule"); + + b.HasComment("График работы бурильщика"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("комментарий для оператора"); + + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id пользователя, загрузившего файл"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("id_state") + .HasComment("0: неизвестно, 1:ожидает отправки, 2: отправлено, 3: принято оператором, 4: отклонено оператором, 5: устарело"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("id скважины"); + + b.Property("ObsolescenceSec") + .HasColumnType("integer") + .HasColumnName("obsolescence") + .HasComment("сек. до устаревания"); + + b.Property("Setpoints") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("setpoint_set") + .HasComment("Набор уставок"); + + b.Property("UploadDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.HasKey("Id"); + + b.HasIndex("IdAuthor"); + + b.HasIndex("IdWell"); + + b.ToTable("t_setpoints_rquest"); + + b.HasComment("Запросы на изменение уставок панели оператора"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.Subsystem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("description"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.HasKey("Id"); + + b.ToTable("t_subsystem"); + + b.HasComment("Описание подсистем"); + + b.HasData( + new + { + Id = 1, + Description = "Совместная работа режимов \"Бурение в роторе\" и \"Бурение в слайде\"", + Name = "АКБ" + }, + new + { + Id = 2, + Description = "Алгоритм поиска оптимальных параметров бурения САУБ", + Name = "MSE" + }, + new + { + Id = 65536, + Description = "Spin master", + Name = "Spin master" + }, + new + { + Id = 65537, + Description = "Torque master", + Name = "Torque master" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("DateEnd") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_end") + .HasComment("дата/время выключения подсистемы"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("дата/время включения подсистемы"); + + b.Property("DepthEnd") + .HasColumnType("real") + .HasColumnName("depth_end") + .HasComment("глубина забоя на момент выключения подсистемы"); + + b.Property("DepthStart") + .HasColumnType("real") + .HasColumnName("depth_start") + .HasComment("глубина забоя на момент включения подсистемы"); + + b.Property("IdSubsystem") + .HasColumnType("integer") + .HasColumnName("id_subsystem"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("ИД телеметрии по которой выдается информация"); + + b.HasKey("Id"); + + b.HasIndex("IdSubsystem"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_subsystem_operation_time"); + + b.HasComment("наработки подсистем"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Info") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("info") + .HasComment("Информация с панели о скважине"); + + b.Property("RemoteUid") + .IsRequired() + .HasColumnType("text") + .HasColumnName("remote_uid") + .HasComment("Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."); + + b.Property("TimeZone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex(new[] { "RemoteUid" }, "t_telemetry_remote_uid_index"); + + b.ToTable("t_telemetry"); + + b.HasComment("таблица привязки телеметрии от комплектов к конкретной скважине."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("AxialLoad") + .HasColumnType("real") + .HasColumnName("axial_load") + .HasComment("Осевая нагрузка"); + + b.Property("AxialLoadLimitMax") + .HasColumnType("real") + .HasColumnName("axial_load_limit_max") + .HasComment("Осевая нагрузка. Аварийная макс."); + + b.Property("AxialLoadSp") + .HasColumnType("real") + .HasColumnName("axial_load_sp") + .HasComment("Осевая нагрузка. Задание"); + + b.Property("BitDepth") + .HasColumnType("real") + .HasColumnName("bit_depth") + .HasComment("Положение инструмента"); + + b.Property("BlockPosition") + .HasColumnType("real") + .HasColumnName("block_position") + .HasComment("Высота талевого блока"); + + b.Property("BlockPositionMax") + .HasColumnType("real") + .HasColumnName("block_position_max") + .HasComment("Талевый блок. Макс положение"); + + b.Property("BlockPositionMin") + .HasColumnType("real") + .HasColumnName("block_position_min") + .HasComment("Талевый блок. Мин положение"); + + b.Property("BlockSpeed") + .HasColumnType("real") + .HasColumnName("block_speed") + .HasComment("Скорость талевого блока"); + + b.Property("BlockSpeedSp") + .HasColumnType("real") + .HasColumnName("block_speed_sp") + .HasComment("Скорости талевого блока. Задание"); + + b.Property("BlockSpeedSpDevelop") + .HasColumnType("real") + .HasColumnName("block_speed_sp_develop") + .HasComment("Талевый блок. Задание скорости для проработки"); + + b.Property("BlockSpeedSpRotor") + .HasColumnType("real") + .HasColumnName("block_speed_sp_rotor") + .HasComment("Талевый блок. Задание скорости для роторного бурения"); + + b.Property("BlockSpeedSpSlide") + .HasColumnType("real") + .HasColumnName("block_speed_sp_slide") + .HasComment("Талевый блок. Задание скорости для режима слайда"); + + b.Property("Flow") + .HasColumnType("real") + .HasColumnName("flow") + .HasComment("Расход"); + + b.Property("FlowDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("flow_delta_limit_max") + .HasComment("Расход. Аварийный макс."); + + b.Property("FlowIdle") + .HasColumnType("real") + .HasColumnName("flow_idle") + .HasComment("Расход. Холостой ход"); + + b.Property("HookWeight") + .HasColumnType("real") + .HasColumnName("hook_weight") + .HasComment("Вес на крюке"); + + b.Property("HookWeightIdle") + .HasColumnType("real") + .HasColumnName("hook_weight_idle") + .HasComment("Вес на крюке. Холостой ход"); + + b.Property("HookWeightLimitMax") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_max") + .HasComment("Вес на крюке. Затяжка"); + + b.Property("HookWeightLimitMin") + .HasColumnType("real") + .HasColumnName("hook_weight_limit_min") + .HasComment("Вес на крюке. Посадка"); + + b.Property("IdFeedRegulator") + .HasColumnType("smallint") + .HasColumnName("id_feed_regulator") + .HasComment("Текущий критерий бурения"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user") + .HasComment("Пользователь САУБ"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Режим САУБ"); + + b.Property("Mse") + .HasColumnType("real") + .HasColumnName("mse") + .HasComment("MSE"); + + b.Property("MseState") + .HasColumnType("smallint") + .HasColumnName("mse_state") + .HasComment("Текущее состояние работы MSE"); + + b.Property("Pressure") + .HasColumnType("real") + .HasColumnName("pressure") + .HasComment("Давление"); + + b.Property("PressureDeltaLimitMax") + .HasColumnType("real") + .HasColumnName("pressure_delta_limit_max") + .HasComment("Давление дифф. Аварийное макс."); + + b.Property("PressureIdle") + .HasColumnType("real") + .HasColumnName("pressure_idle") + .HasComment("Давление. Холостой ход"); + + b.Property("PressureSp") + .HasColumnType("real") + .HasColumnName("pressure_sp") + .HasComment("Давление. Задание"); + + b.Property("PressureSpDevelop") + .HasColumnType("real") + .HasColumnName("pressure_sp_develop") + .HasComment("Давление. Задание для проработки"); + + b.Property("PressureSpRotor") + .HasColumnType("real") + .HasColumnName("pressure_sp_rotor") + .HasComment("Давление. Задание для роторного бурения"); + + b.Property("PressureSpSlide") + .HasColumnType("real") + .HasColumnName("pressure_sp_slide") + .HasComment("Давление. Задание для режима слайда"); + + b.Property("Pump0Flow") + .HasColumnType("real") + .HasColumnName("pump0_flow") + .HasComment("Расход. Буровой насос 1"); + + b.Property("Pump1Flow") + .HasColumnType("real") + .HasColumnName("pump1_flow") + .HasComment("Расход. Буровой насос 2"); + + b.Property("Pump2Flow") + .HasColumnType("real") + .HasColumnName("pump2_flow") + .HasComment("Расход. Буровой насос 3"); + + b.Property("RotorSpeed") + .HasColumnType("real") + .HasColumnName("rotor_speed") + .HasComment("Обороты ротора"); + + b.Property("RotorTorque") + .HasColumnType("real") + .HasColumnName("rotor_torque") + .HasComment("Момент на роторе"); + + b.Property("RotorTorqueIdle") + .HasColumnType("real") + .HasColumnName("rotor_torque_idle") + .HasComment("Момент на роторе. Холостой ход"); + + b.Property("RotorTorqueLimitMax") + .HasColumnType("real") + .HasColumnName("rotor_torque_limit_max") + .HasComment("Момент на роторе. Аварийный макс."); + + b.Property("RotorTorqueSp") + .HasColumnType("real") + .HasColumnName("rotor_torque_sp") + .HasComment("Момент на роторе. Задание"); + + b.Property("WellDepth") + .HasColumnType("real") + .HasColumnName("well_depth") + .HasComment("Глубина забоя"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_saub"); + + b.HasComment("набор основных данных по SAUB"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaubStat", b => + { + b.Property("Count") + .HasColumnType("bigint") + .HasColumnName("count_items"); + + b.Property("DateMax") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_max"); + + b.Property("DateMin") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_min"); + + b.Property("DepthMax") + .HasColumnType("real") + .HasColumnName("depth_max"); + + b.Property("DepthMin") + .HasColumnType("real") + .HasColumnName("depth_min"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.ToView("mw_telemetry_datas_saub_stat"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date") + .HasComment("'2021-10-19 18:23:54+05'"); + + b.Property("Mode") + .HasColumnType("smallint") + .HasColumnName("mode") + .HasComment("Выбранный режим управления"); + + b.Property("PositionRight") + .HasColumnType("real") + .HasColumnName("position_right") + .HasComment("Крайний правый угол осцилляции"); + + b.Property("PositionZero") + .HasColumnType("real") + .HasColumnName("position_zero") + .HasComment("Нулевая позиция осцилляции"); + + b.Property("RevolsLeftLimit") + .HasColumnType("real") + .HasColumnName("revols_left_limit") + .HasComment("Ограничение числа оборотов влево"); + + b.Property("RevolsLeftTotal") + .HasColumnType("real") + .HasColumnName("revols_left_total") + .HasComment("Суммарное количество оборотов влево"); + + b.Property("RevolsRightLimit") + .HasColumnType("real") + .HasColumnName("revols_right_limit") + .HasComment("Ограничение числа оборотов вправо"); + + b.Property("RevolsRightTotal") + .HasColumnType("real") + .HasColumnName("revols_right_total") + .HasComment("Суммарное количество оборотов вправо"); + + b.Property("SpeedLeftSp") + .HasColumnType("real") + .HasColumnName("speed_left_sp") + .HasComment("Заданная скорость вращения влево"); + + b.Property("SpeedRightSp") + .HasColumnType("real") + .HasColumnName("speed_right_sp") + .HasComment("Заданная скорость вращения вправо"); + + b.Property("State") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("Переменная этапа"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_data_spin"); + + b.HasComment("набор основных данных по SpinMaster"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.Property("MessageTemplate") + .IsRequired() + .HasColumnType("text") + .HasColumnName("message_template"); + + b.HasKey("IdTelemetry", "IdEvent"); + + b.ToTable("t_telemetry_event"); + + b.HasComment("Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Arg0") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg0") + .HasComment("Аргумент №0 для вставки в шаблон сообщения"); + + b.Property("Arg1") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg1"); + + b.Property("Arg2") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg2"); + + b.Property("Arg3") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("arg3"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("IdEvent") + .HasColumnType("integer") + .HasColumnName("id_event"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdTelemetryUser") + .HasColumnType("integer") + .HasColumnName("id_telemetry_user") + .HasComment("Пользователь панели отправляющей телеметрию. не пользователь облака."); + + b.Property("WellDepth") + .HasColumnType("double precision") + .HasColumnName("well_depth"); + + b.HasKey("Id"); + + b.HasIndex("IdTelemetry"); + + b.ToTable("t_telemetry_message"); + + b.HasComment("Сообщения на буровых"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname"); + + b.HasKey("IdTelemetry", "IdUser"); + + b.ToTable("t_telemetry_user"); + + b.HasComment("Пользователи панели САУБ. Для сообщений."); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryWirelineRunOut", b => + { + b.Property("IdTelemetry") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id_telemetry") + .HasComment("Идентификатор телеметрии"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("IdTelemetry")); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_time") + .HasComment("Отметка времени"); + + b.Property("Hauling") + .HasColumnType("real") + .HasColumnName("hauling") + .HasComment("Наработка талевого каната с момента перетяжки каната, т*км"); + + b.Property("HaulingWarnSp") + .HasColumnType("real") + .HasColumnName("hauling_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости перетяжки, т*км"); + + b.Property("Replace") + .HasColumnType("real") + .HasColumnName("replace") + .HasComment("Наработка талевого каната с момента замены каната, т*км"); + + b.Property("ReplaceWarnSp") + .HasColumnType("real") + .HasColumnName("replace_warn_sp") + .HasComment("Наработка талевого каната до сигнализации о необходимости замены, т*км"); + + b.HasKey("IdTelemetry"); + + b.ToTable("t_telemetry_wireline_run_out"); + + b.HasComment("Наработка талевого каната"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("email") + .HasComment("должность"); + + b.Property("IdCompany") + .HasColumnType("integer") + .HasColumnName("id_company"); + + b.Property("IdState") + .HasColumnType("smallint") + .HasColumnName("state") + .HasComment("состояние:\n0 - не активен, \n1 - активен, \n2 - заблокирован"); + + b.Property("Login") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("login"); + + b.Property("Name") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("name") + .HasComment("имя"); + + b.Property("PasswordHash") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("password_hash") + .HasComment("соленый хэш пароля.\nпервые 5 символов - соль"); + + b.Property("Patronymic") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("patronymic") + .HasComment("отчество"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("character varying(50)") + .HasColumnName("phone") + .HasComment("номер телефона"); + + b.Property("Position") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("position") + .HasComment("email"); + + b.Property("Surname") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("surname") + .HasComment("фамилия"); + + b.HasKey("Id"); + + b.HasIndex("IdCompany"); + + b.HasIndex("Login") + .IsUnique(); + + b.ToTable("t_user"); + + b.HasComment("Пользователи облака"); + + b.HasData( + new + { + Id = 1, + Email = "", + IdCompany = 1, + IdState = (short)1, + Login = "dev", + Name = "Разработчик", + PasswordHash = "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя"); + + b.HasKey("Id"); + + b.ToTable("t_user_role"); + + b.HasComment("Роли пользователей в системе"); + + b.HasData( + new + { + Id = 1, + Caption = "root", + IdType = 1 + }, + new + { + Id = 1100, + Caption = "admin_cluster.view", + IdType = 1 + }, + new + { + Id = 1101, + Caption = "admin_cluster.edit", + IdType = 1 + }, + new + { + Id = 1102, + Caption = "admin_company.view", + IdType = 1 + }, + new + { + Id = 1103, + Caption = "admin_company.edit", + IdType = 1 + }, + new + { + Id = 1104, + Caption = "admin_company_type.view", + IdType = 1 + }, + new + { + Id = 1105, + Caption = "admin_company_type.edit", + IdType = 1 + }, + new + { + Id = 1106, + Caption = "admin_deposit.view", + IdType = 1 + }, + new + { + Id = 1107, + Caption = "admin_deposit.edit", + IdType = 1 + }, + new + { + Id = 1108, + Caption = "admin_permission.view", + IdType = 1 + }, + new + { + Id = 1109, + Caption = "admin_permission.edit", + IdType = 1 + }, + new + { + Id = 1110, + Caption = "admin_role.view", + IdType = 1 + }, + new + { + Id = 1111, + Caption = "admin_role.edit", + IdType = 1 + }, + new + { + Id = 1112, + Caption = "admin_telemetry.view", + IdType = 1 + }, + new + { + Id = 1113, + Caption = "admin_user.view", + IdType = 1 + }, + new + { + Id = 1114, + Caption = "admin_user.edit", + IdType = 1 + }, + new + { + Id = 1115, + Caption = "admin_visit_log.view", + IdType = 1 + }, + new + { + Id = 1116, + Caption = "admin_well.view", + IdType = 1 + }, + new + { + Id = 1117, + Caption = "admin_well.edit", + IdType = 1 + }, + new + { + Id = 1200, + Caption = "archive.view", + IdType = 1 + }, + new + { + Id = 1201, + Caption = "cluster.view", + IdType = 1 + }, + new + { + Id = 1202, + Caption = "composite.view", + IdType = 1 + }, + new + { + Id = 1203, + Caption = "composite.edit", + IdType = 1 + }, + new + { + Id = 1204, + Caption = "deposit.view", + IdType = 1 + }, + new + { + Id = 1205, + Caption = "document.view", + IdType = 1 + }, + new + { + Id = 1206, + Caption = "drillProcessFlow.view", + IdType = 1 + }, + new + { + Id = 1207, + Caption = "drillProcessFlow.edit", + IdType = 1 + }, + new + { + Id = 1208, + Caption = "measure.view", + IdType = 1 + }, + new + { + Id = 1209, + Caption = "measure.edit", + IdType = 1 + }, + new + { + Id = 1210, + Caption = "message.view", + IdType = 1 + }, + new + { + Id = 1211, + Caption = "operations.view", + IdType = 1 + }, + new + { + Id = 1212, + Caption = "operations.edit", + IdType = 1 + }, + new + { + Id = 1213, + Caption = "params.view", + IdType = 1 + }, + new + { + Id = 1214, + Caption = "params.edit", + IdType = 1 + }, + new + { + Id = 1215, + Caption = "report.view", + IdType = 1 + }, + new + { + Id = 1216, + Caption = "report.edit", + IdType = 1 + }, + new + { + Id = 1217, + Caption = "setpoints.view", + IdType = 1 + }, + new + { + Id = 1218, + Caption = "setpoints.edit", + IdType = 1 + }, + new + { + Id = 1219, + Caption = "telemetry.view", + IdType = 1 + }, + new + { + Id = 1220, + Caption = "telemetryAnalysis.view", + IdType = 1 + }, + new + { + Id = 1221, + Caption = "well.view", + IdType = 1 + }, + new + { + Id = 1500, + Caption = "Просмотр всего", + IdType = 1 + }, + new + { + Id = 1501, + Caption = "file.edit", + IdType = 1 + }, + new + { + Id = 1502, + Caption = "drillingProgram.edit", + IdType = 1 + }, + new + { + Id = 2000, + Caption = "Заказчик", + IdType = 0 + }, + new + { + Id = 2001, + Caption = "Супервайзер", + IdType = 0 + }, + new + { + Id = 2002, + Caption = "Буровой подрядчик", + IdType = 0 + }, + new + { + Id = 2003, + Caption = "Растворщик", + IdType = 0 + }, + new + { + Id = 2004, + Caption = "Телеметрист", + IdType = 0 + }, + new + { + Id = 2005, + Caption = "Долотный сервис", + IdType = 0 + }, + new + { + Id = 2006, + Caption = "ГТИ", + IdType = 0 + }, + new + { + Id = 2007, + Caption = "Цементирование", + IdType = 0 + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("Key") + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("key") + .HasComment("Ключ настроек пользователя"); + + b.Property("Value") + .HasColumnType("jsonb") + .HasColumnName("setting_value") + .HasComment("Значение настроек пользователя"); + + b.HasKey("IdUser", "Key"); + + b.ToTable("t_user_settings"); + + b.HasComment("настройки интерфейса пользователя"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption"); + + b.Property("IdCluster") + .HasColumnType("integer") + .HasColumnName("id_cluster"); + + b.Property("IdState") + .HasColumnType("integer") + .HasColumnName("state") + .HasComment("0 - неизвестно, 1 - в работе, 2 - завершена"); + + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("IdWellType") + .HasColumnType("integer") + .HasColumnName("id_well_type"); + + b.Property("Latitude") + .HasColumnType("double precision") + .HasColumnName("latitude"); + + b.Property("Longitude") + .HasColumnType("double precision") + .HasColumnName("longitude"); + + b.Property("Timezone") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("timezone") + .HasComment("Смещение часового пояса от UTC"); + + b.HasKey("Id"); + + b.HasIndex("IdCluster"); + + b.HasIndex("IdTelemetry") + .IsUnique(); + + b.HasIndex("IdWellType"); + + b.ToTable("t_well"); + + b.HasComment("скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины получателя"); + + b.Property("IdWellSrc") + .HasColumnType("integer") + .HasColumnName("id_well_src") + .HasComment("Id скважины композита"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции композита"); + + b.HasKey("IdWell", "IdWellSrc", "IdWellSectionType"); + + b.HasIndex("IdWellSectionType"); + + b.HasIndex("IdWellSrc"); + + b.ToTable("t_well_composite"); + + b.HasComment("Композитная скважина"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well"); + + b.Property("IdUser") + .HasColumnType("integer") + .HasColumnName("id_user"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category"); + + b.HasKey("IdWell", "IdUser", "IdCategory") + .HasName("t_well_final_documents_pk"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdUser"); + + b.ToTable("t_well_final_documents"); + + b.HasComment("Дело скважины"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CategoryInfo") + .HasColumnType("text") + .HasColumnName("category_info") + .HasComment("Доп. информация к выбраной категории"); + + b.Property("Comment") + .HasColumnType("text") + .HasColumnName("comment") + .HasComment("Комментарий"); + + b.Property("DateStart") + .HasColumnType("timestamp with time zone") + .HasColumnName("date_start") + .HasComment("Дата начала операции"); + + b.Property("DepthEnd") + .HasColumnType("double precision") + .HasColumnName("depth_end") + .HasComment("Глубина после завершения операции, м"); + + b.Property("DepthStart") + .HasColumnType("double precision") + .HasColumnName("depth_start") + .HasComment("Глубина на начало операции, м"); + + b.Property("DurationHours") + .HasColumnType("double precision") + .HasColumnName("duration_hours") + .HasComment("Продолжительность, часы"); + + b.Property("IdCategory") + .HasColumnType("integer") + .HasColumnName("id_category") + .HasComment("Id категории операции"); + + b.Property("IdPlan") + .HasColumnType("integer") + .HasColumnName("id_plan") + .HasComment("Id плановой операции"); + + b.Property("IdType") + .HasColumnType("integer") + .HasColumnName("id_type") + .HasComment("0 = План или 1 = Факт"); + + b.Property("IdUser") + .HasColumnType("integer"); + + b.Property("IdWell") + .HasColumnType("integer") + .HasColumnName("id_well") + .HasComment("Id скважины"); + + b.Property("IdWellSectionType") + .HasColumnType("integer") + .HasColumnName("id_well_section_type") + .HasComment("Id тип секции скважины"); + + b.Property("LastUpdateDate") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("DateStart"); + + b.HasIndex("DepthEnd"); + + b.HasIndex("IdCategory"); + + b.HasIndex("IdPlan"); + + b.HasIndex("IdWell"); + + b.HasIndex("IdWellSectionType"); + + b.ToTable("t_well_operation"); + + b.HasComment("Данные по операциям на скважине"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdParent") + .HasColumnType("integer") + .HasColumnName("id_parent") + .HasComment("id родительской категории"); + + b.Property("KeyValueName") + .HasMaxLength(32) + .HasColumnType("character varying(32)") + .HasColumnName("key_value_name") + .HasComment("Название ключевого показателя операции"); + + b.Property("KeyValueUnits") + .HasMaxLength(16) + .HasColumnType("character varying(16)") + .HasColumnName("key_value_units") + .HasComment("Единицы измерения ключевого показателя операции"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name") + .HasComment("Название категории операции"); + + b.HasKey("Id"); + + b.HasIndex("IdParent"); + + b.ToTable("t_well_operation_category"); + + b.HasComment("Справочник операций на скважине"); + + b.HasData( + new + { + Id = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "БУРЕНИЕ" + }, + new + { + Id = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КРЕПЛЕНИЕ" + }, + new + { + Id = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГФР" + }, + new + { + Id = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные операции" + }, + new + { + Id = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Непроизводительное время (НПВ)" + }, + new + { + Id = 4000, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "КНБК" + }, + new + { + Id = 4001, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "м/ч", + Name = "Механическое. бурение" + }, + new + { + Id = 4002, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Статический замер" + }, + new + { + Id = 4003, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Нормализация диаметра скважины" + }, + new + { + Id = 4004, + IdParent = 3000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 4005, + IdParent = 3001, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4006, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск обсадной колонны" + }, + new + { + Id = 4007, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 4008, + IdParent = 3002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы при креплении" + }, + new + { + Id = 4009, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка/разборка приборов ГИС" + }, + new + { + Id = 4010, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО" + }, + new + { + Id = 4011, + IdParent = 3003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ГИС" + }, + new + { + Id = 4012, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка, ОБР" + }, + new + { + Id = 4013, + IdParent = 3004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Вспомогательные работы" + }, + new + { + Id = 4014, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт оборудования" + }, + new + { + Id = 4015, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Аварийные работы" + }, + new + { + Id = 4016, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Осложнение" + }, + new + { + Id = 4017, + IdParent = 3005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Незаложенные в ГГД операции" + }, + new + { + Id = 5000, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка КНБК" + }, + new + { + Id = 5001, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка КНБК" + }, + new + { + Id = 5002, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение слайдом" + }, + new + { + Id = 5003, + IdParent = 4001, + KeyValueName = "МСП", + KeyValueUnits = "м/ч", + Name = "Бурение ротором" + }, + new + { + Id = 5004, + IdParent = 4002, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Замер ЗТС (запись MWD)" + }, + new + { + Id = 5005, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка перед наращиванием" + }, + new + { + Id = 5006, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка во время бурения" + }, + new + { + Id = 5007, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка перед наращиванием" + }, + new + { + Id = 5008, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка во время бурения" + }, + new + { + Id = 5009, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка перед наращиванием" + }, + new + { + Id = 5010, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наращивание" + }, + new + { + Id = 5011, + IdParent = 4004, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Удержание в клиньях" + }, + new + { + Id = 5012, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем инструмента" + }, + new + { + Id = 5013, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем КНБК" + }, + new + { + Id = 5014, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента" + }, + new + { + Id = 5015, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КНБК" + }, + new + { + Id = 5016, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка при спуске ОК" + }, + new + { + Id = 5017, + IdParent = 4006, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск ОК" + }, + new + { + Id = 5018, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ОЗЦ" + }, + new + { + Id = 5019, + IdParent = 4007, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Цементирование" + }, + new + { + Id = 5020, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка БИ" + }, + new + { + Id = 5021, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ОК" + }, + new + { + Id = 5022, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при спуске ОК" + }, + new + { + Id = 5023, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при цементировании" + }, + new + { + Id = 5024, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разборка комплекса приборов ГИС" + }, + new + { + Id = 5025, + IdParent = 4009, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка комплекса приборов ГИС" + }, + new + { + Id = 5026, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем приборов ГИС (на трубах)" + }, + new + { + Id = 5027, + IdParent = 4010, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск приборов ГИС (на трубах)" + }, + new + { + Id = 5028, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на жестком кабеле" + }, + new + { + Id = 5029, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на кабеле" + }, + new + { + Id = 5030, + IdParent = 4011, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Комплекс ГИС на трубах" + }, + new + { + Id = 5031, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Закачка/прокачка пачки" + }, + new + { + Id = 5032, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка БР" + }, + new + { + Id = 5033, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ориентирование ТС при бурении" + }, + new + { + Id = 5034, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перезапись гаммы-каротажа" + }, + new + { + Id = 5035, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Приготовление БР" + }, + new + { + Id = 5036, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка" + }, + new + { + Id = 5037, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Разбуривание тех.оснастки" + }, + new + { + Id = 5038, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск инструмента с проработкой" + }, + new + { + Id = 5039, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ВМР" + }, + new + { + Id = 5040, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Демонтаж ПВО" + }, + new + { + Id = 5041, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Долив затруба при подъёме" + }, + new + { + Id = 5042, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж ПВО" + }, + new + { + Id = 5043, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Наработка жёлоба" + }, + new + { + Id = 5044, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обвязка устья с циркуляционной системой" + }, + new + { + Id = 5045, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Оборудование устья" + }, + new + { + Id = 5046, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Опрессовка ПВО" + }, + new + { + Id = 5047, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перемонтаж ПВО " + }, + new + { + Id = 5048, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Перетяжка талевого каната" + }, + new + { + Id = 5049, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР при сборке КНБК" + }, + new + { + Id = 5050, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Полная замена талевого каната" + }, + new + { + Id = 5051, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПР перед забуркой направления" + }, + new + { + Id = 5052, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Продувка манифольда" + }, + new + { + Id = 5053, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Срезка" + }, + new + { + Id = 5054, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тайм-дриллинг" + }, + new + { + Id = 5055, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Тех.отстой" + }, + new + { + Id = 5056, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Учебная тревога \"Выброс\"" + }, + new + { + Id = 5057, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Чистка ЦСГО/емкостного блока" + }, + new + { + Id = 5058, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт бурового оборудования" + }, + new + { + Id = 5059, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ловильные работы" + }, + new + { + Id = 5060, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ожидание" + }, + new + { + Id = 5061, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Определение места прихвата и ЛМ" + }, + new + { + Id = 5062, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Работа яссом" + }, + new + { + Id = 5063, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Расхаживание" + }, + new + { + Id = 5064, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - колокол" + }, + new + { + Id = 5065, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - метчик" + }, + new + { + Id = 5066, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - овершот" + }, + new + { + Id = 5067, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "СПО - труболовка" + }, + new + { + Id = 5068, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (встряхивание)" + }, + new + { + Id = 5069, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Торпедирование (отстрел)" + }, + new + { + Id = 5070, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Установка ванн" + }, + new + { + Id = 5071, + IdParent = 4015, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Фрезеровка" + }, + new + { + Id = 5072, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Контролируемое ГНВП" + }, + new + { + Id = 5073, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Поглощение" + }, + new + { + Id = 5074, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сальникообразование" + }, + new + { + Id = 5075, + IdParent = 4016, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Утяжеление БР" + }, + new + { + Id = 5076, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "НПВ / прочее" + }, + new + { + Id = 5077, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Обработка раствора (несоответствие параметров)" + }, + new + { + Id = 5078, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "подъем ОК" + }, + new + { + Id = 5079, + IdParent = 4017, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ревизия КНБК/инструмента/ЗТС" + }, + new + { + Id = 5082, + IdParent = 4000, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка устройства ориентирования КО" + }, + new + { + Id = 5083, + IdParent = 4003, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Проработка принудительная" + }, + new + { + Id = 5084, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонировка подъем БИ, продувка" + }, + new + { + Id = 5085, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск бурильного инструмента со сборкой с мостков" + }, + new + { + Id = 5086, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подъем БИ с выбросом на мостки" + }, + new + { + Id = 5087, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск БИ со сборкой с мостков" + }, + new + { + Id = 5088, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка и спуск ТБТ" + }, + new + { + Id = 5089, + IdParent = 4005, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Спуск КО на транспотрной колонне" + }, + new + { + Id = 5090, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Отворот допускной трубы" + }, + new + { + Id = 5091, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески, опрессовка" + }, + new + { + Id = 5092, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Монтаж, опрессовка ФА" + }, + new + { + Id = 5093, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка хвостовика 114мм (согласно схеме)" + }, + new + { + Id = 5094, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "ПЗР к спуску УЭЦН" + }, + new + { + Id = 5095, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Активация подвески (потайной колонны, хвостовика)" + }, + new + { + Id = 5096, + IdParent = 4008, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Шаблонирование перед спуском" + }, + new + { + Id = 5097, + IdParent = 4012, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Промывка - перевод скважины на новый раствор" + }, + new + { + Id = 5098, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Сборка БИ с мостков на подсвечник" + }, + new + { + Id = 5099, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Подготовка ствола скважины. Перезапись ГК в интервале установки КО." + }, + new + { + Id = 5100, + IdParent = 4013, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Смена рабочего переводника ВСП" + }, + new + { + Id = 5101, + IdParent = 4014, + KeyValueName = "dT", + KeyValueUnits = "мин", + Name = "Ремонт" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.Property("Order") + .HasColumnType("real") + .HasColumnName("order") + .HasComment("Порядок"); + + b.HasKey("Id"); + + b.ToTable("t_well_section_type"); + + b.HasComment("конструкция секции скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Пилотный ствол", + Order = 4f + }, + new + { + Id = 2, + Caption = "Направление", + Order = 0f + }, + new + { + Id = 3, + Caption = "Кондуктор", + Order = 1f + }, + new + { + Id = 4, + Caption = "Эксплуатационная колонна", + Order = 3f + }, + new + { + Id = 5, + Caption = "Транспортный ствол", + Order = 5f + }, + new + { + Id = 6, + Caption = "Хвостовик", + Order = 6f + }, + new + { + Id = 7, + Caption = "Пилотный ствол 2", + Order = 4.1f + }, + new + { + Id = 8, + Caption = "Направление 2", + Order = 0.1f + }, + new + { + Id = 9, + Caption = "Кондуктор 2", + Order = 1.1f + }, + new + { + Id = 10, + Caption = "Эксплуатационная колонна 2", + Order = 3.1f + }, + new + { + Id = 11, + Caption = "Транспортный ствол 2", + Order = 5.1f + }, + new + { + Id = 12, + Caption = "Хвостовик 2", + Order = 6.1f + }, + new + { + Id = 13, + Caption = "Пилотный ствол 3", + Order = 4.2f + }, + new + { + Id = 14, + Caption = "Направление 3", + Order = 0.2f + }, + new + { + Id = 15, + Caption = "Кондуктор 3", + Order = 1.2f + }, + new + { + Id = 16, + Caption = "Эксплуатационная колонна 3", + Order = 3.2f + }, + new + { + Id = 17, + Caption = "Транспортный ствол 3", + Order = 5.2f + }, + new + { + Id = 18, + Caption = "Хвостовик 3", + Order = 6.2f + }, + new + { + Id = 19, + Caption = "Пилотный ствол 4", + Order = 4.3f + }, + new + { + Id = 20, + Caption = "Направление 4", + Order = 0.3f + }, + new + { + Id = 21, + Caption = "Кондуктор 4", + Order = 1.3f + }, + new + { + Id = 22, + Caption = "Эксплуатационная колонна 4", + Order = 3.3f + }, + new + { + Id = 23, + Caption = "Транспортный ствол 4", + Order = 5.3f + }, + new + { + Id = 24, + Caption = "Хвостовик 4", + Order = 6.3f + }, + new + { + Id = 25, + Caption = "Пилотный ствол 5", + Order = 4.4f + }, + new + { + Id = 26, + Caption = "Направление 5", + Order = 0.4f + }, + new + { + Id = 27, + Caption = "Кондуктор 5", + Order = 1.4f + }, + new + { + Id = 28, + Caption = "Эксплуатационная колонна 5", + Order = 3.4f + }, + new + { + Id = 29, + Caption = "Транспортный ствол 5", + Order = 5.4f + }, + new + { + Id = 30, + Caption = "Хвостовик 5", + Order = 6.4f + }, + new + { + Id = 31, + Caption = "Техническая колонна", + Order = 2f + }, + new + { + Id = 32, + Caption = "Техническая колонна 2", + Order = 2.1f + }, + new + { + Id = 33, + Caption = "Техническая колонна 3", + Order = 2.2f + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Caption") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("character varying(255)") + .HasColumnName("caption") + .HasComment("Название"); + + b.HasKey("Id"); + + b.ToTable("t_well_type"); + + b.HasComment("конструкция скважины"); + + b.HasData( + new + { + Id = 1, + Caption = "Наклонно-направленная" + }, + new + { + Id = 2, + Caption = "Горизонтальная" + }); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.RecordBase", b => + { + b.Property("IdTelemetry") + .HasColumnType("integer") + .HasColumnName("id_telemetry"); + + b.Property("DateTime") + .HasColumnType("timestamp with time zone") + .HasColumnName("date"); + + b.Property("Actcod") + .HasColumnType("smallint") + .HasColumnName("ACTCOD"); + + b.Property("Date") + .HasColumnType("integer") + .HasColumnName("DATE"); + + b.Property("Recid") + .HasColumnType("smallint") + .HasColumnName("RECID"); + + b.Property("Seqid") + .HasColumnType("integer") + .HasColumnName("SEQID"); + + b.Property("Stknum") + .HasColumnType("smallint") + .HasColumnName("STKNUM"); + + b.Property("Time") + .HasColumnType("integer") + .HasColumnName("TIME"); + + b.Property("Wellid") + .HasColumnType("text") + .HasColumnName("WELLID"); + + b.HasKey("IdTelemetry", "DateTime"); + + b.ToTable("t_telemetry_wits_base"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Blkpos") + .HasColumnType("real") + .HasColumnName("BLKPOS"); + + b.Property("Chkp") + .HasColumnType("real") + .HasColumnName("CHKP"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptretm") + .HasColumnType("real") + .HasColumnName("DEPTRETM"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Gasa") + .HasColumnType("real") + .HasColumnName("GASA"); + + b.Property("Hkla") + .HasColumnType("real") + .HasColumnName("HKLA"); + + b.Property("Hklx") + .HasColumnType("real") + .HasColumnName("HKLX"); + + b.Property("Lagstks") + .HasColumnType("smallint") + .HasColumnName("LAGSTKS"); + + b.Property("Mcia") + .HasColumnType("real") + .HasColumnName("MCIA"); + + b.Property("Mcoa") + .HasColumnType("real") + .HasColumnName("MCOA"); + + b.Property("Mdia") + .HasColumnType("real") + .HasColumnName("MDIA"); + + b.Property("Mdoa") + .HasColumnType("real") + .HasColumnName("MDOA"); + + b.Property("Mfia") + .HasColumnType("real") + .HasColumnName("MFIA"); + + b.Property("Mfoa") + .HasColumnType("real") + .HasColumnName("MFOA"); + + b.Property("Mfop") + .HasColumnType("smallint") + .HasColumnName("MFOP"); + + b.Property("Mtia") + .HasColumnType("real") + .HasColumnName("MTIA"); + + b.Property("Mtoa") + .HasColumnType("real") + .HasColumnName("MTOA"); + + b.Property("Ropa") + .HasColumnType("real") + .HasColumnName("ROPA"); + + b.Property("Rpma") + .HasColumnType("smallint") + .HasColumnName("RPMA"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spm1") + .HasColumnType("smallint") + .HasColumnName("SPM1"); + + b.Property("Spm2") + .HasColumnType("smallint") + .HasColumnName("SPM2"); + + b.Property("Spm3") + .HasColumnType("smallint") + .HasColumnName("SPM3"); + + b.Property("Sppa") + .HasColumnType("real") + .HasColumnName("SPPA"); + + b.Property("Stkc") + .HasColumnType("integer") + .HasColumnName("STKC"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.Property("Torqa") + .HasColumnType("real") + .HasColumnName("TORQA"); + + b.Property("Torqx") + .HasColumnType("real") + .HasColumnName("TORQX"); + + b.Property("Tvolact") + .HasColumnType("real") + .HasColumnName("TVOLACT"); + + b.Property("Tvolcact") + .HasColumnType("real") + .HasColumnName("TVOLCACT"); + + b.Property("Woba") + .HasColumnType("real") + .HasColumnName("WOBA"); + + b.Property("Wobx") + .HasColumnType("real") + .HasColumnName("WOBX"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_1"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("DeptmeasGdpMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_GDP_mc"); + + b.Property("DeptmeasMcrstat") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_MCRSTAT"); + + b.Property("DeptmeasRa33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33_mc"); + + b.Property("DeptmeasRa33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F2_mc"); + + b.Property("DeptmeasRa33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RA33F4_mc"); + + b.Property("DeptmeasRp33Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33_mc"); + + b.Property("DeptmeasRp33f2Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F2_mc"); + + b.Property("DeptmeasRp33f4Mc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_RP33F4_mc"); + + b.Property("DeptmeasSlvlMc") + .HasColumnType("real") + .HasColumnName("DEPTMEAS_SLVL_mc"); + + b.Property("GdpMc") + .HasColumnType("real") + .HasColumnName("GDP_mc"); + + b.Property("Mcrstat") + .HasColumnType("real") + .HasColumnName("MCRSTAT"); + + b.Property("Ra33Mc") + .HasColumnType("real") + .HasColumnName("RA33_mc"); + + b.Property("Ra33f2Mc") + .HasColumnType("real") + .HasColumnName("RA33F2_mc"); + + b.Property("Ra33f4Mc") + .HasColumnType("real") + .HasColumnName("RA33F4_mc"); + + b.Property("Rp33Mc") + .HasColumnType("real") + .HasColumnName("RP33_mc"); + + b.Property("Rp33f2Mc") + .HasColumnType("real") + .HasColumnName("RP33F2_mc"); + + b.Property("Rp33f4Mc") + .HasColumnType("real") + .HasColumnName("RP33F4_mc"); + + b.Property("SlvlMc") + .HasColumnType("real") + .HasColumnName("SLVL_mc"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_50"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Btot") + .HasColumnType("real") + .HasColumnName("Btot"); + + b.Property("Bx") + .HasColumnType("real") + .HasColumnName("Bx"); + + b.Property("By") + .HasColumnType("real") + .HasColumnName("By"); + + b.Property("Bz") + .HasColumnType("real") + .HasColumnName("Bz"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Gtot") + .HasColumnType("real") + .HasColumnName("Gtot"); + + b.Property("Gx") + .HasColumnType("real") + .HasColumnName("Gx"); + + b.Property("Gy") + .HasColumnType("real") + .HasColumnName("Gy"); + + b.Property("Gz") + .HasColumnType("real") + .HasColumnName("Gz"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_60"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Att06h") + .HasColumnType("real") + .HasColumnName("ATT06H"); + + b.Property("Att06l") + .HasColumnType("real") + .HasColumnName("ATT06L"); + + b.Property("Att10h") + .HasColumnType("real") + .HasColumnName("ATT10H"); + + b.Property("Att10l") + .HasColumnType("real") + .HasColumnName("ATT10L"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Phl1f1") + .HasColumnType("real") + .HasColumnName("PHL1F1"); + + b.Property("Phl1f2") + .HasColumnType("real") + .HasColumnName("PHL1F2"); + + b.Property("Phl2f1") + .HasColumnType("real") + .HasColumnName("PHL2F1"); + + b.Property("Phl2f2") + .HasColumnType("real") + .HasColumnName("PHL2F2"); + + b.Property("Status") + .HasColumnType("real") + .HasColumnName("Status"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_61"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptsvym") + .HasColumnType("real") + .HasColumnName("DEPTSVYM"); + + b.Property("Deptsvyv") + .HasColumnType("real") + .HasColumnName("DEPTSVYV"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Svyazc") + .HasColumnType("real") + .HasColumnName("SVYAZC"); + + b.Property("Svyazu") + .HasColumnType("real") + .HasColumnName("SVYAZU"); + + b.Property("Svydls") + .HasColumnType("real") + .HasColumnName("SVYDLS"); + + b.Property("Svyew") + .HasColumnType("real") + .HasColumnName("SVYEW"); + + b.Property("Svygtf") + .HasColumnType("real") + .HasColumnName("SVYGTF"); + + b.Property("Svyinc") + .HasColumnType("real") + .HasColumnName("SVYINC"); + + b.Property("Svymtf") + .HasColumnType("real") + .HasColumnName("SVYMTF"); + + b.Property("Svyns") + .HasColumnType("real") + .HasColumnName("SVYNS"); + + b.Property("Svytype") + .HasColumnType("text") + .HasColumnName("SVYTYPE"); + + b.Property("Svywalk") + .HasColumnType("real") + .HasColumnName("SVYWALK"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_7"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasBaseType("AsbCloudDb.Model.WITS.RecordBase"); + + b.Property("Deptbitm") + .HasColumnType("real") + .HasColumnName("DEPTBITM"); + + b.Property("Deptbitv") + .HasColumnType("real") + .HasColumnName("DEPTBITV"); + + b.Property("Deptcalm") + .HasColumnType("real") + .HasColumnName("DEPTCALM"); + + b.Property("Deptcalv") + .HasColumnType("real") + .HasColumnName("DEPTCALV"); + + b.Property("Deptfdm") + .HasColumnType("real") + .HasColumnName("DEPTFDM"); + + b.Property("Deptfdv") + .HasColumnType("real") + .HasColumnName("DEPTFDV"); + + b.Property("Deptgr1m") + .HasColumnType("real") + .HasColumnName("DEPTGR1M"); + + b.Property("Deptgr1v") + .HasColumnType("real") + .HasColumnName("DEPTGR1V"); + + b.Property("Deptgr2m") + .HasColumnType("real") + .HasColumnName("DEPTGR2M"); + + b.Property("Deptgr2v") + .HasColumnType("real") + .HasColumnName("DEPTGR2V"); + + b.Property("Deptmeas") + .HasColumnType("real") + .HasColumnName("DEPTMEAS"); + + b.Property("Deptp1m") + .HasColumnType("real") + .HasColumnName("DEPTP1M"); + + b.Property("Deptp1v") + .HasColumnType("real") + .HasColumnName("DEPTP1V"); + + b.Property("Deptp2m") + .HasColumnType("real") + .HasColumnName("DEPTP2M"); + + b.Property("Deptp2v") + .HasColumnType("real") + .HasColumnName("DEPTP2V"); + + b.Property("Deptrs1m") + .HasColumnType("real") + .HasColumnName("DEPTRS1M"); + + b.Property("Deptrs1v") + .HasColumnType("real") + .HasColumnName("DEPTRS1V"); + + b.Property("Deptrs2m") + .HasColumnType("real") + .HasColumnName("DEPTRS2M"); + + b.Property("Deptrs2v") + .HasColumnType("real") + .HasColumnName("DEPTRS2V"); + + b.Property("Deptvert") + .HasColumnType("real") + .HasColumnName("DEPTVERT"); + + b.Property("Mclp") + .HasColumnType("real") + .HasColumnName("MCLP"); + + b.Property("Mfd") + .HasColumnType("real") + .HasColumnName("MFD"); + + b.Property("Mffp") + .HasColumnType("real") + .HasColumnName("MFFP"); + + b.Property("Mfpp") + .HasColumnType("real") + .HasColumnName("MFPP"); + + b.Property("Mfrann") + .HasColumnType("real") + .HasColumnName("MFRANN"); + + b.Property("Mfrpipe") + .HasColumnType("real") + .HasColumnName("MFRPIPE"); + + b.Property("Mftann") + .HasColumnType("real") + .HasColumnName("MFTANN"); + + b.Property("Mftpipe") + .HasColumnType("real") + .HasColumnName("MFTPIPE"); + + b.Property("Mg1") + .HasColumnType("real") + .HasColumnName("MG1"); + + b.Property("Mg1c") + .HasColumnType("real") + .HasColumnName("MG1C"); + + b.Property("Mg2") + .HasColumnType("real") + .HasColumnName("MG2"); + + b.Property("Mg2c") + .HasColumnType("real") + .HasColumnName("MG2C"); + + b.Property("Mpo1") + .HasColumnType("real") + .HasColumnName("MPO1"); + + b.Property("Mpo2") + .HasColumnType("real") + .HasColumnName("MPO2"); + + b.Property("Mr1") + .HasColumnType("real") + .HasColumnName("MR1"); + + b.Property("Mr1c") + .HasColumnType("real") + .HasColumnName("MR1C"); + + b.Property("Mr2") + .HasColumnType("real") + .HasColumnName("MR2"); + + b.Property("Mr2c") + .HasColumnType("real") + .HasColumnName("MR2C"); + + b.Property("Passnum") + .HasColumnType("smallint") + .HasColumnName("PASSNUM"); + + b.Property("Spare1") + .HasColumnType("real") + .HasColumnName("SPARE1"); + + b.Property("Spare2") + .HasColumnType("real") + .HasColumnName("SPARE2"); + + b.Property("Spare3") + .HasColumnType("real") + .HasColumnName("SPARE3"); + + b.Property("Spare4") + .HasColumnType("real") + .HasColumnName("SPARE4"); + + b.Property("Spare5") + .HasColumnType("real") + .HasColumnName("SPARE5"); + + b.Property("Spare6") + .HasColumnType("real") + .HasColumnName("SPARE6"); + + b.Property("Spare7") + .HasColumnType("real") + .HasColumnName("SPARE7"); + + b.Property("Spare8") + .HasColumnType("real") + .HasColumnName("SPARE8"); + + b.Property("Spare9") + .HasColumnType("real") + .HasColumnName("SPARE9"); + + b.Property("TelemetryId") + .HasColumnType("integer"); + + b.HasIndex("TelemetryId"); + + b.ToTable("t_telemetry_wits_8"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.HasOne("AsbCloudDb.Model.Deposit", "Deposit") + .WithMany("Clusters") + .HasForeignKey("IdDeposit") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_cluster_t_deposit_id_fk"); + + b.Navigation("Deposit"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.HasOne("AsbCloudDb.Model.CompanyType", "CompanyType") + .WithMany("Companies") + .HasForeignKey("IdCompanyType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CompanyType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DailyReport.DailyReport", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DetectedOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdFileCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("DrillingProgramParts") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Faq", b => + { + b.HasOne("AsbCloudDb.Model.User", "AuthorAnswer") + .WithMany() + .HasForeignKey("IdAuthorAnswer"); + + b.HasOne("AsbCloudDb.Model.User", "AuthorQuestion") + .WithMany() + .HasForeignKey("IdAuthorQuestion") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AuthorAnswer"); + + b.Navigation("AuthorQuestion"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany("Files") + .HasForeignKey("IdAuthor"); + + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("FileCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileMark", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "FileInfo") + .WithMany("FileMarks") + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_file_mark_t_file_info_fk"); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("FileMarks") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_user_t_file_mark_fk"); + + b.Navigation("FileInfo"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemFloat", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemInt", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.GTR.WitsItemString", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FileCategory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Measure", b => + { + b.HasOne("AsbCloudDb.Model.MeasureCategory", "Category") + .WithMany("Measures") + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Notification", b => + { + b.HasOne("AsbCloudDb.Model.NotificationCategory", "NotificationCategory") + .WithMany("Notifications") + .HasForeignKey("IdNotificationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NotificationCategory"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.OperationValue", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdOperationCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.PlannedTrajectory", 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.Navigation("User"); + + 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.RelationCompanyWell", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_company_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("RelationCompaniesWells") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_relation_company_well_t_well_id_fk"); + + b.Navigation("Company"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationContactWell", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationContactsWells") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserDrillingProgramPart", b => + { + b.HasOne("AsbCloudDb.Model.DrillingProgramPart", "DrillingProgramPart") + .WithMany("RelatedUsers") + .HasForeignKey("IdDrillingProgramPart") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrillingProgramPart"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRolePermission", b => + { + b.HasOne("AsbCloudDb.Model.Permission", "Permission") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdPermission") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUserRolePermissions") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Permission"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => + { + b.HasOne("AsbCloudDb.Model.UserRole", "Role") + .WithMany("RelationUserRoleUserRoles") + .HasForeignKey("Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "IncludeRole") + .WithMany() + .HasForeignKey("IdInclude") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IncludeRole"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.RelationUserUserRole", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.UserRole", "UserRole") + .WithMany("RelationUsersUserRoles") + .HasForeignKey("IdUserRole") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + + b.Navigation("UserRole"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.ReportProperty", b => + { + b.HasOne("AsbCloudDb.Model.FileInfo", "File") + .WithMany() + .HasForeignKey("IdFile") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("File"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Schedule", b => + { + b.HasOne("AsbCloudDb.Model.Driller", "Driller") + .WithMany("Schedule") + .HasForeignKey("IdDriller") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_schedule_t_driller_id_driller"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Driller"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.SetpointsRequest", b => + { + b.HasOne("AsbCloudDb.Model.User", "Author") + .WithMany() + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany() + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Subsystems.SubsystemOperationTime", b => + { + b.HasOne("AsbCloudDb.Model.Subsystems.Subsystem", "Subsystem") + .WithMany() + .HasForeignKey("IdSubsystem") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Subsystem"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSaub", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSaub") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_saub_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryDataSpin", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("DataSpin") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_data_spin_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryEvent", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Events") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_event_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryMessage", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Messages") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_messages_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.TelemetryUser", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany("Users") + .HasForeignKey("IdTelemetry") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_telemetry_user_t_telemetry_id_fk"); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.HasOne("AsbCloudDb.Model.Company", "Company") + .WithMany("Users") + .HasForeignKey("IdCompany") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired() + .HasConstraintName("t_user_t_company_id_fk"); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserSetting", b => + { + b.HasOne("AsbCloudDb.Model.User", "User") + .WithMany() + .HasForeignKey("IdUser") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.HasOne("AsbCloudDb.Model.Cluster", "Cluster") + .WithMany("Wells") + .HasForeignKey("IdCluster") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_t_cluster_id_fk"); + + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithOne("Well") + .HasForeignKey("AsbCloudDb.Model.Well", "IdTelemetry") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("t_well_t_telemetry_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellType", "WellType") + .WithMany("Wells") + .HasForeignKey("IdWellType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cluster"); + + b.Navigation("Telemetry"); + + b.Navigation("WellType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellComposite", b => + { + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellComposites") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_id_fk"); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellComposites") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_t_well_section_type_id_fk"); + + b.HasOne("AsbCloudDb.Model.Well", "WellSrc") + .WithMany("WellCompositeSrcs") + .HasForeignKey("IdWellSrc") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("t_well_сomposite_src_t_well_id_fk"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + + b.Navigation("WellSrc"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellFinalDocument", b => + { + b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + 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.Navigation("Category"); + + b.Navigation("User"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperation", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "OperationCategory") + .WithMany() + .HasForeignKey("IdCategory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellOperation", "OperationPlan") + .WithMany() + .HasForeignKey("IdPlan"); + + b.HasOne("AsbCloudDb.Model.Well", "Well") + .WithMany("WellOperations") + .HasForeignKey("IdWell") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AsbCloudDb.Model.WellSectionType", "WellSectionType") + .WithMany("WellOperations") + .HasForeignKey("IdWellSectionType") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationCategory"); + + b.Navigation("OperationPlan"); + + b.Navigation("Well"); + + b.Navigation("WellSectionType"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellOperationCategory", b => + { + b.HasOne("AsbCloudDb.Model.WellOperationCategory", "Parent") + .WithMany() + .HasForeignKey("IdParent"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record1", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record1", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record50", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record50", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record60", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record60", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record61", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record61", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record7", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record7", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WITS.Record8", b => + { + b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry") + .WithMany() + .HasForeignKey("TelemetryId"); + + b.HasOne("AsbCloudDb.Model.WITS.RecordBase", null) + .WithOne() + .HasForeignKey("AsbCloudDb.Model.WITS.Record8", "IdTelemetry", "DateTime") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Telemetry"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Cluster", b => + { + b.Navigation("Wells"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Company", b => + { + b.Navigation("RelationCompaniesWells"); + + b.Navigation("Users"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.CompanyType", b => + { + b.Navigation("Companies"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Deposit", b => + { + b.Navigation("Clusters"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Driller", b => + { + b.Navigation("Schedule"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.DrillingProgramPart", b => + { + b.Navigation("RelatedUsers"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.FileInfo", b => + { + b.Navigation("FileMarks"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.MeasureCategory", b => + { + b.Navigation("Measures"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.NotificationCategory", b => + { + b.Navigation("Notifications"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Permission", b => + { + b.Navigation("RelationUserRolePermissions"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Telemetry", b => + { + b.Navigation("DataSaub"); + + b.Navigation("DataSpin"); + + b.Navigation("Events"); + + b.Navigation("Messages"); + + b.Navigation("Users"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.User", b => + { + b.Navigation("FileMarks"); + + b.Navigation("Files"); + + b.Navigation("RelationContactsWells"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.UserRole", b => + { + b.Navigation("RelationUserRolePermissions"); + + b.Navigation("RelationUserRoleUserRoles"); + + b.Navigation("RelationUsersUserRoles"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Well", b => + { + b.Navigation("DrillingProgramParts"); + + b.Navigation("ProcessMaps"); + + b.Navigation("RelationCompaniesWells"); + + b.Navigation("WellCompositeSrcs"); + + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellSectionType", b => + { + b.Navigation("WellComposites"); + + b.Navigation("WellOperations"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.WellType", b => + { + b.Navigation("Wells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs b/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs new file mode 100644 index 00000000..9ba161cd --- /dev/null +++ b/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs @@ -0,0 +1,77 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AsbCloudDb.Migrations +{ + public partial class Add_New_Permissons : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "t_permission", + columns: new[] { "id", "description", "name" }, + values: new object[,] + { + { 525, "Разрешение на редактирование РТК у завершенной скважины", "ProcessMap.editCompletedWell" }, + { 526, "Разрешение на редактирование операций у завершенной скважины", "WellOperation.editCompletedWell" } + }); + + migrationBuilder.InsertData( + table: "t_relation_user_role_permission", + columns: new[] { "id_permission", "id_user_role" }, + values: new object[,] + { + { 525, 1 }, + { 526, 1 }, + { 525, 2009 }, + { 526, 2009 }, + { 525, 2013 }, + { 526, 2013 } + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 525, 1 }); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 526, 1 }); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 525, 2009 }); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 526, 2009 }); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 525, 2013 }); + + migrationBuilder.DeleteData( + table: "t_relation_user_role_permission", + keyColumns: new[] { "id_permission", "id_user_role" }, + keyValues: new object[] { 526, 2013 }); + + migrationBuilder.DeleteData( + table: "t_permission", + keyColumn: "id", + keyValue: 525); + + migrationBuilder.DeleteData( + table: "t_permission", + keyColumn: "id", + keyValue: 526); + } + } +} diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index e55bff40..bc70e90f 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -2163,6 +2163,18 @@ namespace AsbCloudDb.Migrations Id = 522, Description = "Разрешить удаление всех настроек пользователя", Name = "UserSettings.delete" + }, + new + { + Id = 525, + Description = "Разрешение на редактирование РТК у завершенной скважины", + Name = "ProcessMap.editCompletedWell" + }, + new + { + Id = 526, + Description = "Разрешение на редактирование операций у завершенной скважины", + Name = "WellOperation.editCompletedWell" }); }); @@ -3052,6 +3064,26 @@ namespace AsbCloudDb.Migrations IdPermission = 204 }, new + { + IdUserRole = 2009, + IdPermission = 525 + }, + new + { + IdUserRole = 2009, + IdPermission = 526 + }, + new + { + IdUserRole = 2013, + IdPermission = 525 + }, + new + { + IdUserRole = 2013, + IdPermission = 526 + }, + new { IdUserRole = 1, IdPermission = 100 @@ -3750,6 +3782,16 @@ namespace AsbCloudDb.Migrations { IdUserRole = 1, IdPermission = 522 + }, + new + { + IdUserRole = 1, + IdPermission = 525 + }, + new + { + IdUserRole = 1, + IdPermission = 526 }); }); diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs index 611ea0c2..072ac55e 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs @@ -156,6 +156,9 @@ new() { Id = 521, Name = "HelpPage.edit", Description = "Разрешить создание справок по страницам"}, new() { Id = 522, Name = "UserSettings.delete", Description = "Разрешить удаление всех настроек пользователя"}, + + new (){ Id = 525, Name = "ProcessMap.editCompletedWell", Description = "Разрешение на редактирование РТК у завершенной скважины"}, + new (){ Id = 526, Name = "WellOperation.editCompletedWell", Description = "Разрешение на редактирование операций у завершенной скважины"} }; } } diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs b/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs index 1b5b3af1..1e4cbbf7 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs @@ -58,6 +58,9 @@ namespace AsbCloudDb.Model.DefaultData new (){ IdUserRole = 2005, IdPermission = 247}, new (){ IdUserRole = 2005, IdPermission = 205}, new (){ IdUserRole = 2005, IdPermission = 204}, new (){ IdUserRole = 2006, IdPermission = 243}, new (){ IdUserRole = 2006, IdPermission = 205}, new (){ IdUserRole = 2006, IdPermission = 204}, new (){ IdUserRole = 2007, IdPermission = 241}, new (){ IdUserRole = 2007, IdPermission = 205}, new (){ IdUserRole = 2007, IdPermission = 204}, + new (){ IdUserRole = 2009, IdPermission = 525}, new (){ IdUserRole = 2009, IdPermission = 526}, + new (){ IdUserRole = 2013, IdPermission = 525}, new (){ IdUserRole = 2013, IdPermission = 526}, + //new (){ IdUserRole = 1, IdPermission = 500}, new (){ IdUserRole = 1, IdPermission = 501}, new (){ IdUserRole = 1, IdPermission = 502}, new (){ IdUserRole = 1, IdPermission = 503}, new (){ IdUserRole = 1, IdPermission = 504}, new (){ IdUserRole = 1, IdPermission = 505}, new (){ IdUserRole = 1, IdPermission = 506}, new (){ IdUserRole = 1, IdPermission = 510}, new (){ IdUserRole = 1, IdPermission = 511}, new (){ IdUserRole = 1, IdPermission = 512}, new (){ IdUserRole = 1, IdPermission = 513}, new (){ IdUserRole = 1, IdPermission = 514}, new (){ IdUserRole = 1, IdPermission = 515}, }; var allPermissions = (new EntityFillerPermission()).GetData(); diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index bb894d63..6401a0cd 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -144,7 +144,7 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs index b44d7255..283709ff 100644 --- a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportMakerService.cs @@ -17,9 +17,9 @@ namespace AsbCloudInfrastructure.Services.ProcessMap const int headerRowsCount = 5; - private readonly IProcessMapReportService processMapService; + private readonly IProcessMapService processMapService; - public ProcessMapReportMakerService(IProcessMapReportService processMapService) + public ProcessMapReportMakerService(IProcessMapService processMapService) { this.processMapService = processMapService; } diff --git a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportService.cs b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs similarity index 96% rename from AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportService.cs rename to AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs index 177d7488..9b296f85 100644 --- a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapReportService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs @@ -12,14 +12,14 @@ using System.Threading.Tasks; namespace AsbCloudInfrastructure.Services.ProcessMap { - public partial class ProcessMapReportService : IProcessMapReportService + public partial class ProcessMapService : IProcessMapService { private readonly IWellService wellService; private readonly IWellOperationRepository wellOperationRepository; private readonly IProcessMapPlanRepository processMapPlanRepository; private readonly ITelemetryDataSaubService telemetryDataSaubService; - public ProcessMapReportService( + public ProcessMapService( IWellService wellService, IWellOperationRepository wellOperationRepository, IProcessMapPlanRepository processMapPlanRepository, @@ -54,6 +54,16 @@ namespace AsbCloudInfrastructure.Services.ProcessMap return result; } + public async Task DeleteAsync(int id, int idWell, CancellationToken token) + { + var processMap = await processMapPlanRepository.GetOrDefaultAsync(id, token); + + if (processMap?.IdWell != idWell) + throw new ArgumentInvalidException("Запись РТК принадлежит другой скважине", nameof(idWell)); + + return await processMapPlanRepository.DeleteAsync(id, token); + } + private IEnumerable CalcByIntervals(IEnumerable processMapPlan, TelemetryDataSaubStatDto[] telemetryDataStat) { var processMapIntervals = CalcDepthIntervals(processMapPlan); diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index b2d97a71..6eccb152 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -27,8 +27,9 @@ namespace AsbCloudWebApi.Controllers private readonly ITelemetryService telemetryService; private readonly IHubContext telemetryHubContext; private readonly IProcessMapReportMakerService processMapReportService; - private readonly IProcessMapReportService processMapService; + private readonly IProcessMapService processMapService; private readonly IProcessMapPlanImportService processMapPlanImportService; + private readonly IUserRepository userRepository; private const string SirnalRMethodGetDataName = "UpdateProcessMap"; @@ -36,10 +37,11 @@ namespace AsbCloudWebApi.Controllers IWellService wellService, IProcessMapPlanRepository repository, IProcessMapReportMakerService processMapReportService, - IProcessMapReportService processMapService, + IProcessMapService processMapService, ITelemetryService telemetryService, IHubContext telemetryHubContext, - IProcessMapPlanImportService processMapPlanImportService) + IProcessMapPlanImportService processMapPlanImportService, + IUserRepository userRepository) : base(wellService, repository) { this.telemetryService = telemetryService; @@ -47,6 +49,7 @@ namespace AsbCloudWebApi.Controllers this.processMapReportService = processMapReportService; this.processMapService = processMapService; this.processMapPlanImportService = processMapPlanImportService; + this.userRepository = userRepository; } @@ -139,6 +142,9 @@ namespace AsbCloudWebApi.Controllers [HttpPost] public override async Task> InsertAsync([FromBody] ProcessMapPlanDto value, CancellationToken token) { + if (!await CanUserEditProcessMapAsync(value.IdWell, token)) + return Forbid(); + value.IdUser = User.GetUserId() ?? -1; var result = await base.InsertAsync(value, token); await NotifyUsersBySignalR(value.IdWell, token); @@ -154,6 +160,9 @@ namespace AsbCloudWebApi.Controllers [HttpPut] public override async Task> UpdateAsync([FromBody] ProcessMapPlanDto value, CancellationToken token) { + if (!await CanUserEditProcessMapAsync(value.IdWell, token)) + return Forbid(); + value.IdUser = User.GetUserId() ?? -1; var result = await base.UpdateAsync(value, token); await NotifyUsersBySignalR(value.IdWell, token); @@ -188,10 +197,13 @@ namespace AsbCloudWebApi.Controllers CancellationToken cancellationToken) { int? idUser = User.GetUserId(); - + if (idUser is null) return Forbid(); + if (!await CanUserEditProcessMapAsync(idWell, cancellationToken)) + return Forbid(); + if (Path.GetExtension(file.FileName).ToLower() != ".xlsx") return BadRequest("Требуется xlsx файл."); @@ -239,6 +251,28 @@ namespace AsbCloudWebApi.Controllers return File(stream, "application/octet-stream", fileName); } + [HttpDelete("{id}/{idWell}")] + [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] + public async Task> DeleteAsync(int id, int idWell, CancellationToken cancellationToken) + { + if (!await CanUserEditProcessMapAsync(idWell, cancellationToken)) + return Forbid(); + + return await processMapService.DeleteAsync(id, idWell, cancellationToken); + } + + private async Task CanUserEditProcessMapAsync(int idWell, CancellationToken token) + { + var idUser = User.GetUserId(); + + var well = await wellService.GetOrDefaultAsync(idWell, token); + + if (!idUser.HasValue || well is null) + return false; + + return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "ProcessMap.editCompletedWell"); + } + private async Task NotifyUsersBySignalR(int idWell, CancellationToken token) { var dtos = await service.GetAllAsync(idWell, null, token); diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 0ab6f0c1..a3f6c13a 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -26,12 +26,16 @@ namespace AsbCloudWebApi.Controllers private readonly IWellOperationRepository operationRepository; private readonly IWellService wellService; private readonly IWellOperationImportService wellOperationImportService; + private readonly IUserRepository userRepository; - public WellOperationController(IWellOperationRepository operationService, IWellService wellService, IWellOperationImportService wellOperationImportService) + public WellOperationController(IWellOperationRepository operationService, IWellService wellService, + IWellOperationImportService wellOperationImportService, + IUserRepository userRepository) { this.operationRepository = operationService; this.wellService = wellService; this.wellOperationImportService = wellOperationImportService; + this.userRepository = userRepository; } /// @@ -199,7 +203,10 @@ namespace AsbCloudWebApi.Controllers [FromBody] IEnumerable values, CancellationToken token) { - if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) + if (!await CanUserAccessToWellAsync(idWell, token)) + return Forbid(); + + if (!await CanUserEditWellOperationsAsync(idWell, token)) return Forbid(); foreach (var value in values) @@ -229,7 +236,10 @@ namespace AsbCloudWebApi.Controllers public async Task UpdateAsync(int idWell, int idOperation, [FromBody] WellOperationDto value, CancellationToken token) { - if (!await CanUserAccessToWellAsync(idWell, token).ConfigureAwait(false)) + if (!await CanUserAccessToWellAsync(idWell, token)) + return Forbid(); + + if (!await CanUserEditWellOperationsAsync(idWell, token)) return Forbid(); value.IdWell = idWell; @@ -254,8 +264,10 @@ namespace AsbCloudWebApi.Controllers [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task DeleteAsync(int idWell, int idOperation, CancellationToken token) { - if (!await CanUserAccessToWellAsync(idWell, - token).ConfigureAwait(false)) + if (!await CanUserAccessToWellAsync(idWell, token)) + return Forbid(); + + if (!await CanUserEditWellOperationsAsync(idWell, token)) return Forbid(); var result = await operationRepository.DeleteAsync(new int[] { idOperation }, token) @@ -286,6 +298,12 @@ namespace AsbCloudWebApi.Controllers if (idCompany is null || idUser is null) return Forbid(); + if (!await CanUserAccessToWellAsync(idWell, token)) + return Forbid(); + + if (!await CanUserEditWellOperationsAsync(idWell, token)) + return Forbid(); + if (!await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, idWell, token).ConfigureAwait(false)) return Forbid(); @@ -376,6 +394,18 @@ namespace AsbCloudWebApi.Controllers return File(stream, "application/octet-stream", fileName); } + private async Task CanUserEditWellOperationsAsync(int idWell, CancellationToken token) + { + var idUser = User.GetUserId(); + + var well = await wellService.GetOrDefaultAsync(idWell, token); + + if (!idUser.HasValue || well is null) + return false; + + return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "WellOperation.editCompletedWell"); + } + private async Task CanUserAccessToWellAsync(int idWell, CancellationToken token) { int? idCompany = User.GetCompanyId(); From 675da0a5d921f2551b88aff9e17de639972a93ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 7 Sep 2023 12:21:54 +0500 Subject: [PATCH 12/25] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8=20+?= =?UTF-8?q?=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BE=D0=B9=20=D1=81=D1=85=D0=B5=D0=BC=D1=8B=20?= =?UTF-8?q?=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Data/Manuals/CatalogItemManualDto.cs | 25 ----- ...nualFolderDto.cs => ManualDirectoryDto.cs} | 15 +-- AsbCloudApp/Data/Manuals/ManualDto.cs | 13 ++- ...=> 20230907070954_Add_Manuals.Designer.cs} | 101 ++++++++---------- ...nuals.cs => 20230907070954_Add_Manuals.cs} | 91 +++++++--------- .../AsbCloudDbContextModelSnapshot.cs | 97 ++++++++--------- AsbCloudDb/Model/AsbCloudDbContext.cs | 8 +- .../DefaultData/EntityFillerFileCategory.cs | 5 +- .../DefaultData/EntityFillerPermission.cs | 2 +- AsbCloudDb/Model/FileCategory.cs | 5 - AsbCloudDb/Model/IAsbCloudDbContext.cs | 2 +- AsbCloudDb/Model/Manuals/Manual.cs | 28 +++-- AsbCloudDb/Model/Manuals/ManualDirectory.cs | 27 +++++ AsbCloudDb/Model/Manuals/ManualFolder.cs | 33 ------ 14 files changed, 192 insertions(+), 260 deletions(-) delete mode 100644 AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs rename AsbCloudApp/Data/Manuals/{ManualFolderDto.cs => ManualDirectoryDto.cs} (58%) rename AsbCloudDb/Migrations/{20230810052950_Add_Manuals.Designer.cs => 20230907070954_Add_Manuals.Designer.cs} (99%) rename AsbCloudDb/Migrations/{20230810052950_Add_Manuals.cs => 20230907070954_Add_Manuals.cs} (64%) create mode 100644 AsbCloudDb/Model/Manuals/ManualDirectory.cs delete mode 100644 AsbCloudDb/Model/Manuals/ManualFolder.cs diff --git a/AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs b/AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs deleted file mode 100644 index d4a766d1..00000000 --- a/AsbCloudApp/Data/Manuals/CatalogItemManualDto.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace AsbCloudApp.Data.Manuals; - -/// -/// Элемент каталога инструкций -/// -public class CatalogItemManualDto -{ - /// - /// DTO категории - /// - public FileCategoryDto Category { get; set; } = null!; - - /// - /// DTO инструкций хранящиеся без папки - /// - public IEnumerable ManualsWithoutFolder { get; set; } = Enumerable.Empty(); - - /// - /// DTO папок с инструкциями - /// - public IEnumerable Folders { get; set; } = Enumerable.Empty(); -} \ No newline at end of file diff --git a/AsbCloudApp/Data/Manuals/ManualFolderDto.cs b/AsbCloudApp/Data/Manuals/ManualDirectoryDto.cs similarity index 58% rename from AsbCloudApp/Data/Manuals/ManualFolderDto.cs rename to AsbCloudApp/Data/Manuals/ManualDirectoryDto.cs index 8eef923d..e0513cf9 100644 --- a/AsbCloudApp/Data/Manuals/ManualFolderDto.cs +++ b/AsbCloudApp/Data/Manuals/ManualDirectoryDto.cs @@ -4,9 +4,9 @@ using System.Linq; namespace AsbCloudApp.Data.Manuals; /// -/// DTO папки для хранения инструкций +/// Директория для хранения инструкций /// -public class ManualFolderDto : IId +public class ManualDirectoryDto : IId { /// public int Id { get; set; } @@ -17,19 +17,14 @@ public class ManualFolderDto : IId public string Name { get; set; } = null!; /// - /// Id родительской папки + /// Id родительской директории /// public int? IdParent { get; set; } - - /// - /// Id категории - /// - public int IdCategory { get; set; } /// - /// Вложенные папки + /// Вложенные директории /// - public IEnumerable Children { get; set; } = Enumerable.Empty(); + public IEnumerable Children { get; set; } = Enumerable.Empty(); /// /// Хранимые инструкции diff --git a/AsbCloudApp/Data/Manuals/ManualDto.cs b/AsbCloudApp/Data/Manuals/ManualDto.cs index 8c01f66c..bb89dfbe 100644 --- a/AsbCloudApp/Data/Manuals/ManualDto.cs +++ b/AsbCloudApp/Data/Manuals/ManualDto.cs @@ -3,7 +3,7 @@ using System; namespace AsbCloudApp.Data.Manuals; /// -/// DTO инструкции +/// Инструкция /// public class ManualDto : IId { @@ -21,12 +21,17 @@ public class ManualDto : IId public DateTime DateDownload { get; set; } /// - /// Id папки + /// Id автора /// - public int? IdFolder { get; set; } + public int IdAuthor { get; set; } + + /// + /// Id директории + /// + public int IdDirectory { get; set; } /// /// Id категории файла /// - public int? IdCategory { get; set; } + public int IdCategory { get; set; } } \ No newline at end of file diff --git a/AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs b/AsbCloudDb/Migrations/20230907070954_Add_Manuals.Designer.cs similarity index 99% rename from AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs rename to AsbCloudDb/Migrations/20230907070954_Add_Manuals.Designer.cs index 578d4680..4aed03e1 100644 --- a/AsbCloudDb/Migrations/20230810052950_Add_Manuals.Designer.cs +++ b/AsbCloudDb/Migrations/20230907070954_Add_Manuals.Designer.cs @@ -13,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AsbCloudDb.Migrations { [DbContext(typeof(AsbCloudDbContext))] - [Migration("20230810052950_Add_Manuals")] + [Migration("20230907070954_Add_Manuals")] partial class Add_Manuals { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -21,7 +21,7 @@ namespace AsbCloudDb.Migrations #pragma warning disable 612, 618 modelBuilder .UseCollation("Russian_Russia.1251") - .HasAnnotation("ProductVersion", "6.0.20") + .HasAnnotation("ProductVersion", "6.0.21") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); @@ -434,11 +434,6 @@ namespace AsbCloudDb.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("IdType") - .HasColumnType("integer") - .HasColumnName("type") - .HasComment("0 = Инструкции"); - b.Property("Name") .IsRequired() .HasColumnType("text") @@ -796,14 +791,7 @@ namespace AsbCloudDb.Migrations new { Id = 30000, - IdType = 0, - Name = "АСУ ТП" - }, - new - { - Id = 30001, - IdType = 0, - Name = "Технология бурения" + Name = "Инструкции" }); }); @@ -1097,36 +1085,43 @@ namespace AsbCloudDb.Migrations b.Property("DateDownload") .HasColumnType("timestamp with time zone") .HasColumnName("date_download") - .HasComment("Дата загрузки файла"); + .HasComment("Дата загрузки"); - b.Property("IdCategory") + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id автора"); + + b.Property("IdCategory") .HasColumnType("integer") .HasColumnName("id_category") - .HasComment("Категория"); + .HasComment("Id категории файла"); - b.Property("IdFolder") + b.Property("IdDirectory") .HasColumnType("integer") - .HasColumnName("id_folder") - .HasComment("Id папки инструкций"); + .HasColumnName("id_directory") + .HasComment("Id директории"); b.Property("Name") .IsRequired() .HasColumnType("text") .HasColumnName("name") - .HasComment("Название файла"); + .HasComment("Название"); b.HasKey("Id"); + b.HasIndex("IdAuthor"); + b.HasIndex("IdCategory"); - b.HasIndex("IdFolder"); + b.HasIndex("IdDirectory"); b.ToTable("t_manual"); b.HasComment("Инструкции"); }); - modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1135,31 +1130,24 @@ namespace AsbCloudDb.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("IdCategory") - .HasColumnType("integer") - .HasColumnName("id_category") - .HasComment("Категория"); - b.Property("IdParent") .HasColumnType("integer") .HasColumnName("id_parent") - .HasComment("Родительская папки"); + .HasComment("Id родительской директории"); b.Property("Name") .IsRequired() .HasColumnType("text") .HasColumnName("name") - .HasComment("Название папки"); + .HasComment("Название"); b.HasKey("Id"); - b.HasIndex("IdCategory"); - b.HasIndex("IdParent"); - b.ToTable("t_manual_folder"); + b.ToTable("t_manual_directory"); - b.HasComment("Папка для инструкций"); + b.HasComment("Директория для инструкций"); }); modelBuilder.Entity("AsbCloudDb.Model.Measure", b => @@ -2269,8 +2257,8 @@ namespace AsbCloudDb.Migrations new { Id = 524, - Description = "Разрешить просмотр инструкций", - Name = "Manual.view" + Description = "Разрешить получение инструкций", + Name = "Manual.get" }); }); @@ -7802,35 +7790,38 @@ namespace AsbCloudDb.Migrations modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => { - b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + b.HasOne("AsbCloudDb.Model.User", "Author") .WithMany() - .HasForeignKey("IdCategory"); + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Folder") - .WithMany("Manuals") - .HasForeignKey("IdFolder") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("Category"); - - b.Navigation("Folder"); - }); - - modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => - { b.HasOne("AsbCloudDb.Model.FileCategory", "Category") .WithMany() .HasForeignKey("IdCategory") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Parent") + b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Directory") + .WithMany("Manuals") + .HasForeignKey("IdDirectory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Category"); + + b.Navigation("Directory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => + { + b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Parent") .WithMany("Children") .HasForeignKey("IdParent") .OnDelete(DeleteBehavior.Cascade); - b.Navigation("Category"); - b.Navigation("Parent"); }); @@ -8459,7 +8450,7 @@ namespace AsbCloudDb.Migrations b.Navigation("FileMarks"); }); - modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => { b.Navigation("Children"); diff --git a/AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs b/AsbCloudDb/Migrations/20230907070954_Add_Manuals.cs similarity index 64% rename from AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs rename to AsbCloudDb/Migrations/20230907070954_Add_Manuals.cs index 0b384ab6..4ee906e3 100644 --- a/AsbCloudDb/Migrations/20230810052950_Add_Manuals.cs +++ b/AsbCloudDb/Migrations/20230907070954_Add_Manuals.cs @@ -10,40 +10,26 @@ namespace AsbCloudDb.Migrations { protected override void Up(MigrationBuilder migrationBuilder) { - migrationBuilder.AddColumn( - name: "type", - table: "t_file_category", - type: "integer", - nullable: true, - comment: "0 = Инструкции"); - migrationBuilder.CreateTable( - name: "t_manual_folder", + name: "t_manual_directory", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - name = table.Column(type: "text", nullable: false, comment: "Название папки"), - id_parent = table.Column(type: "integer", nullable: true, comment: "Родительская папки"), - id_category = table.Column(type: "integer", nullable: false, comment: "Категория") + name = table.Column(type: "text", nullable: false, comment: "Название"), + id_parent = table.Column(type: "integer", nullable: true, comment: "Id родительской директории") }, constraints: table => { - table.PrimaryKey("PK_t_manual_folder", x => x.id); + table.PrimaryKey("PK_t_manual_directory", x => x.id); table.ForeignKey( - name: "FK_t_manual_folder_t_file_category_id_category", - column: x => x.id_category, - principalTable: "t_file_category", - principalColumn: "id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_t_manual_folder_t_manual_folder_id_parent", + name: "FK_t_manual_directory_t_manual_directory_id_parent", column: x => x.id_parent, - principalTable: "t_manual_folder", + principalTable: "t_manual_directory", principalColumn: "id", onDelete: ReferentialAction.Cascade); }, - comment: "Папка для инструкций"); + comment: "Директория для инструкций"); migrationBuilder.CreateTable( name: "t_manual", @@ -51,10 +37,11 @@ namespace AsbCloudDb.Migrations { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - name = table.Column(type: "text", nullable: false, comment: "Название файла"), - date_download = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата загрузки файла"), - id_category = table.Column(type: "integer", nullable: true, comment: "Категория"), - id_folder = table.Column(type: "integer", nullable: true, comment: "Id папки инструкций") + name = table.Column(type: "text", nullable: false, comment: "Название"), + date_download = table.Column(type: "timestamp with time zone", nullable: false, comment: "Дата загрузки"), + id_directory = table.Column(type: "integer", nullable: false, comment: "Id директории"), + id_category = table.Column(type: "integer", nullable: false, comment: "Id категории файла"), + id_author = table.Column(type: "integer", nullable: false, comment: "Id автора") }, constraints: table => { @@ -63,11 +50,18 @@ namespace AsbCloudDb.Migrations name: "FK_t_manual_t_file_category_id_category", column: x => x.id_category, principalTable: "t_file_category", - principalColumn: "id"); + principalColumn: "id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_t_manual_t_manual_folder_id_folder", - column: x => x.id_folder, - principalTable: "t_manual_folder", + name: "FK_t_manual_t_manual_directory_id_directory", + column: x => x.id_directory, + principalTable: "t_manual_directory", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_t_manual_t_user_id_author", + column: x => x.id_author, + principalTable: "t_user", principalColumn: "id", onDelete: ReferentialAction.Cascade); }, @@ -75,12 +69,8 @@ namespace AsbCloudDb.Migrations migrationBuilder.InsertData( table: "t_file_category", - columns: new[] { "id", "type", "name", "short_name" }, - values: new object[,] - { - { 30000, 0, "АСУ ТП", null }, - { 30001, 0, "Технология бурения", null } - }); + columns: new[] { "id", "name", "short_name" }, + values: new object[] { 30000, "Инструкции", null }); migrationBuilder.InsertData( table: "t_permission", @@ -88,7 +78,7 @@ namespace AsbCloudDb.Migrations values: new object[,] { { 523, "Разрешить редактирование инструкций", "Manual.edit" }, - { 524, "Разрешить просмотр инструкций", "Manual.view" } + { 524, "Разрешить получение инструкций", "Manual.get" } }); migrationBuilder.InsertData( @@ -100,24 +90,24 @@ namespace AsbCloudDb.Migrations { 524, 1 } }); + migrationBuilder.CreateIndex( + name: "IX_t_manual_id_author", + table: "t_manual", + column: "id_author"); + migrationBuilder.CreateIndex( name: "IX_t_manual_id_category", table: "t_manual", column: "id_category"); migrationBuilder.CreateIndex( - name: "IX_t_manual_id_folder", + name: "IX_t_manual_id_directory", table: "t_manual", - column: "id_folder"); + column: "id_directory"); migrationBuilder.CreateIndex( - name: "IX_t_manual_folder_id_category", - table: "t_manual_folder", - column: "id_category"); - - migrationBuilder.CreateIndex( - name: "IX_t_manual_folder_id_parent", - table: "t_manual_folder", + name: "IX_t_manual_directory_id_parent", + table: "t_manual_directory", column: "id_parent"); } @@ -127,18 +117,13 @@ namespace AsbCloudDb.Migrations name: "t_manual"); migrationBuilder.DropTable( - name: "t_manual_folder"); + name: "t_manual_directory"); migrationBuilder.DeleteData( table: "t_file_category", keyColumn: "id", keyValue: 30000); - migrationBuilder.DeleteData( - table: "t_file_category", - keyColumn: "id", - keyValue: 30001); - migrationBuilder.DeleteData( table: "t_relation_user_role_permission", keyColumns: new[] { "id_permission", "id_user_role" }, @@ -158,10 +143,6 @@ namespace AsbCloudDb.Migrations table: "t_permission", keyColumn: "id", keyValue: 524); - - migrationBuilder.DropColumn( - name: "type", - table: "t_file_category"); } } } diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index 8e4119cc..5e03a24a 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -432,11 +432,6 @@ namespace AsbCloudDb.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("IdType") - .HasColumnType("integer") - .HasColumnName("type") - .HasComment("0 = Инструкции"); - b.Property("Name") .IsRequired() .HasColumnType("text") @@ -794,14 +789,7 @@ namespace AsbCloudDb.Migrations new { Id = 30000, - IdType = 0, - Name = "АСУ ТП" - }, - new - { - Id = 30001, - IdType = 0, - Name = "Технология бурения" + Name = "Инструкции" }); }); @@ -1095,36 +1083,43 @@ namespace AsbCloudDb.Migrations b.Property("DateDownload") .HasColumnType("timestamp with time zone") .HasColumnName("date_download") - .HasComment("Дата загрузки файла"); + .HasComment("Дата загрузки"); - b.Property("IdCategory") + b.Property("IdAuthor") + .HasColumnType("integer") + .HasColumnName("id_author") + .HasComment("Id автора"); + + b.Property("IdCategory") .HasColumnType("integer") .HasColumnName("id_category") - .HasComment("Категория"); + .HasComment("Id категории файла"); - b.Property("IdFolder") + b.Property("IdDirectory") .HasColumnType("integer") - .HasColumnName("id_folder") - .HasComment("Id папки инструкций"); + .HasColumnName("id_directory") + .HasComment("Id директории"); b.Property("Name") .IsRequired() .HasColumnType("text") .HasColumnName("name") - .HasComment("Название файла"); + .HasComment("Название"); b.HasKey("Id"); + b.HasIndex("IdAuthor"); + b.HasIndex("IdCategory"); - b.HasIndex("IdFolder"); + b.HasIndex("IdDirectory"); b.ToTable("t_manual"); b.HasComment("Инструкции"); }); - modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1133,31 +1128,24 @@ namespace AsbCloudDb.Migrations NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("IdCategory") - .HasColumnType("integer") - .HasColumnName("id_category") - .HasComment("Категория"); - b.Property("IdParent") .HasColumnType("integer") .HasColumnName("id_parent") - .HasComment("Родительская папки"); + .HasComment("Id родительской директории"); b.Property("Name") .IsRequired() .HasColumnType("text") .HasColumnName("name") - .HasComment("Название папки"); + .HasComment("Название"); b.HasKey("Id"); - b.HasIndex("IdCategory"); - b.HasIndex("IdParent"); - b.ToTable("t_manual_folder"); + b.ToTable("t_manual_directory"); - b.HasComment("Папка для инструкций"); + b.HasComment("Директория для инструкций"); }); modelBuilder.Entity("AsbCloudDb.Model.Measure", b => @@ -2267,8 +2255,8 @@ namespace AsbCloudDb.Migrations new { Id = 524, - Description = "Разрешить просмотр инструкций", - Name = "Manual.view" + Description = "Разрешить получение инструкций", + Name = "Manual.get" }); }); @@ -7800,35 +7788,38 @@ namespace AsbCloudDb.Migrations modelBuilder.Entity("AsbCloudDb.Model.Manuals.Manual", b => { - b.HasOne("AsbCloudDb.Model.FileCategory", "Category") + b.HasOne("AsbCloudDb.Model.User", "Author") .WithMany() - .HasForeignKey("IdCategory"); + .HasForeignKey("IdAuthor") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Folder") - .WithMany("Manuals") - .HasForeignKey("IdFolder") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("Category"); - - b.Navigation("Folder"); - }); - - modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => - { b.HasOne("AsbCloudDb.Model.FileCategory", "Category") .WithMany() .HasForeignKey("IdCategory") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("AsbCloudDb.Model.Manuals.ManualFolder", "Parent") + b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Directory") + .WithMany("Manuals") + .HasForeignKey("IdDirectory") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + + b.Navigation("Category"); + + b.Navigation("Directory"); + }); + + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => + { + b.HasOne("AsbCloudDb.Model.Manuals.ManualDirectory", "Parent") .WithMany("Children") .HasForeignKey("IdParent") .OnDelete(DeleteBehavior.Cascade); - b.Navigation("Category"); - b.Navigation("Parent"); }); @@ -8457,7 +8448,7 @@ namespace AsbCloudDb.Migrations b.Navigation("FileMarks"); }); - modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualFolder", b => + modelBuilder.Entity("AsbCloudDb.Model.Manuals.ManualDirectory", b => { b.Navigation("Children"); diff --git a/AsbCloudDb/Model/AsbCloudDbContext.cs b/AsbCloudDb/Model/AsbCloudDbContext.cs index d221a750..af24b47e 100644 --- a/AsbCloudDb/Model/AsbCloudDbContext.cs +++ b/AsbCloudDb/Model/AsbCloudDbContext.cs @@ -79,7 +79,7 @@ namespace AsbCloudDb.Model public DbSet Notifications => Set(); public DbSet NotificationCategories => Set(); public DbSet Manuals => Set(); - public DbSet ManualFolders => Set(); + public DbSet ManualDirectories => Set(); public AsbCloudDbContext() : base() @@ -392,16 +392,16 @@ namespace AsbCloudDb.Model entity.HasKey(x => new { x.IdWell, x.IdUser }); }); - modelBuilder.Entity() + modelBuilder.Entity() .HasOne(mf => mf.Parent) .WithMany(mf => mf.Children) .HasForeignKey(mf => mf.IdParent) .OnDelete(DeleteBehavior.Cascade); modelBuilder.Entity() - .HasOne(m => m.Folder) + .HasOne(m => m.Directory) .WithMany(f => f.Manuals) - .HasForeignKey(m => m.IdFolder) + .HasForeignKey(m => m.IdDirectory) .OnDelete(DeleteBehavior.Cascade); DefaultData.DefaultContextData.Fill(modelBuilder); diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs b/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs index 00e56c06..39ddc2eb 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerFileCategory.cs @@ -74,9 +74,8 @@ new () {Id = 10043, Name = "Фактические данные бурения (вставляются в паспорт скважины)"}, new () {Id = 20000, Name = "Справки по страницам"}, - - new() { Id = 30000, Name = "АСУ ТП", IdType = FileCategory.IdFileCategoryTypeManuals}, - new() { Id = 30001, Name = "Технология бурения", IdType = FileCategory.IdFileCategoryTypeManuals} + + new() { Id = 30000, Name = "Инструкции"}, }; } } diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs index 9d12d3b4..20064bb7 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerPermission.cs @@ -158,7 +158,7 @@ new() { Id = 522, Name = "UserSettings.delete", Description = "Разрешить удаление всех настроек пользователя"}, new() { Id = 523, Name = "Manual.edit", Description = "Разрешить редактирование инструкций" }, - new() { Id = 524, Name = "Manual.view", Description = "Разрешить просмотр инструкций"} + new() { Id = 524, Name = "Manual.get", Description = "Разрешить получение инструкций"} }; } } diff --git a/AsbCloudDb/Model/FileCategory.cs b/AsbCloudDb/Model/FileCategory.cs index 5aba28d6..ca47394c 100644 --- a/AsbCloudDb/Model/FileCategory.cs +++ b/AsbCloudDb/Model/FileCategory.cs @@ -7,8 +7,6 @@ namespace AsbCloudDb.Model [Table("t_file_category"), Comment("Категории файлов")] public class FileCategory : IId { - public const int IdFileCategoryTypeManuals = 0; - [Key] [Column("id")] public int Id { get; set; } @@ -18,8 +16,5 @@ namespace AsbCloudDb.Model [Column("short_name"), Comment("Короткое название категории")] public string? ShortName { get; set; } - - [Column("type"), Comment("0 = Инструкции")] - public int? IdType { get; set; } } } \ No newline at end of file diff --git a/AsbCloudDb/Model/IAsbCloudDbContext.cs b/AsbCloudDb/Model/IAsbCloudDbContext.cs index 5a23ec89..645d4d1f 100644 --- a/AsbCloudDb/Model/IAsbCloudDbContext.cs +++ b/AsbCloudDb/Model/IAsbCloudDbContext.cs @@ -72,7 +72,7 @@ namespace AsbCloudDb.Model DbSet Notifications { get; } DbSet NotificationCategories { get; } DbSet Manuals { get; } - DbSet ManualFolders { get; } + DbSet ManualDirectories { get; } DatabaseFacade Database { get; } Task RefreshMaterializedViewAsync(string mwName, CancellationToken token); diff --git a/AsbCloudDb/Model/Manuals/Manual.cs b/AsbCloudDb/Model/Manuals/Manual.cs index 29bc1371..35b091b5 100644 --- a/AsbCloudDb/Model/Manuals/Manual.cs +++ b/AsbCloudDb/Model/Manuals/Manual.cs @@ -12,21 +12,27 @@ public class Manual : IId [Column("id")] public int Id { get; set; } - [Column("name"), Comment("Название файла")] + [Column("name"), Comment("Название")] public string Name { get; set; } = null!; - [Column("date_download"), Comment("Дата загрузки файла")] + [Column("date_download"), Comment("Дата загрузки")] public DateTime DateDownload { get; set; } - - [Column("id_category"), Comment("Категория")] - public int? IdCategory { get; set; } - [ForeignKey(nameof(IdCategory))] - public virtual FileCategory? Category { get; set; } + [Column("id_directory"), Comment("Id директории")] + public int IdDirectory { get; set; } - [Column("id_folder"), Comment("Id папки инструкций")] - public int? IdFolder { get; set; } + [Column("id_category"), Comment("Id категории файла")] + public int IdCategory { get; set; } - [ForeignKey(nameof(IdFolder))] - public virtual ManualFolder? Folder { get; set; } + [Column("id_author"), Comment("Id автора")] + public int IdAuthor { get; set; } + + [ForeignKey(nameof(IdDirectory))] + public virtual ManualDirectory Directory { get; set; } = null!; + + [ForeignKey(nameof(IdCategory))] + public virtual FileCategory Category { get; set; } = null!; + + [ForeignKey(nameof(IdAuthor))] + public virtual User Author { get; set; } = null!; } \ No newline at end of file diff --git a/AsbCloudDb/Model/Manuals/ManualDirectory.cs b/AsbCloudDb/Model/Manuals/ManualDirectory.cs new file mode 100644 index 00000000..b553eb67 --- /dev/null +++ b/AsbCloudDb/Model/Manuals/ManualDirectory.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudDb.Model.Manuals; + +[Table("t_manual_directory"), Comment("Директория для инструкций")] +public class ManualDirectory : IId +{ + [Key] + [Column("id")] + public int Id { get; set; } + + [Column("name"), Comment("Название")] + public string Name { get; set; } = null!; + + [Column("id_parent"), Comment("Id родительской директории")] + public int? IdParent { get; set; } + + [ForeignKey(nameof(IdParent))] + public virtual ManualDirectory? Parent { get; set; } + + public virtual ICollection? Children { get; set; } + + public virtual ICollection? Manuals { get; set; } +} \ No newline at end of file diff --git a/AsbCloudDb/Model/Manuals/ManualFolder.cs b/AsbCloudDb/Model/Manuals/ManualFolder.cs deleted file mode 100644 index a3ea9647..00000000 --- a/AsbCloudDb/Model/Manuals/ManualFolder.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Microsoft.EntityFrameworkCore; - -namespace AsbCloudDb.Model.Manuals; - -[Table("t_manual_folder"), Comment("Папка для инструкций")] -public class ManualFolder : IId -{ - [Key] - [Column("id")] - public int Id { get; set; } - - [Column("name"), Comment("Название папки")] - public string Name { get; set; } = null!; - - [Column("id_parent"), Comment("Родительская папки")] - public int? IdParent { get; set; } - - [ForeignKey(nameof(IdParent))] - public virtual ManualFolder? Parent { get; set; } - - [Column("id_category"), Comment("Категория")] - public int IdCategory { get; set; } - - [ForeignKey(nameof(IdCategory))] - public virtual FileCategory Category { get; set; } = null!; - - public virtual ICollection? Children { get; set; } - - public virtual ICollection? Manuals { get; set; } -} \ No newline at end of file From 380776c3a9a15cb87416521e93a3eff34ceac3d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Fri, 8 Sep 2023 10:22:58 +0500 Subject: [PATCH 13/25] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/IFileCategoryRepository.cs | 21 ------- .../IManualDirectoryRepository.cs | 37 +++++++++++ .../Repositories/IManualFolderRepository.cs | 31 --------- AsbCloudApp/Repositories/IManualRepository.cs | 21 ------- AsbCloudInfrastructure/DependencyInjection.cs | 7 ++- .../Repository/FileCategoryRepository.cs | 32 ---------- .../Repository/FileStorageRepository.cs | 8 +-- .../Repository/ManualDirectoryRepository.cs | 62 ++++++++++++++++++ .../Repository/ManualFolderRepository.cs | 63 ------------------- .../Repository/ManualRepository.cs | 33 ---------- 10 files changed, 106 insertions(+), 209 deletions(-) delete mode 100644 AsbCloudApp/Repositories/IFileCategoryRepository.cs create mode 100644 AsbCloudApp/Repositories/IManualDirectoryRepository.cs delete mode 100644 AsbCloudApp/Repositories/IManualFolderRepository.cs delete mode 100644 AsbCloudApp/Repositories/IManualRepository.cs delete mode 100644 AsbCloudInfrastructure/Repository/FileCategoryRepository.cs create mode 100644 AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs delete mode 100644 AsbCloudInfrastructure/Repository/ManualFolderRepository.cs delete mode 100644 AsbCloudInfrastructure/Repository/ManualRepository.cs diff --git a/AsbCloudApp/Repositories/IFileCategoryRepository.cs b/AsbCloudApp/Repositories/IFileCategoryRepository.cs deleted file mode 100644 index 7e64b024..00000000 --- a/AsbCloudApp/Repositories/IFileCategoryRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data; -using AsbCloudApp.Services; - -namespace AsbCloudApp.Repositories; - -/// -/// Репозиторий для работы с категориями файлов -/// -public interface IFileCategoryRepository : ICrudRepository -{ - /// - /// Получение всех записей по идентификатору типа - /// - /// - /// - /// - Task> GetAllAsync(int idType, CancellationToken cancellationToken); -} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IManualDirectoryRepository.cs b/AsbCloudApp/Repositories/IManualDirectoryRepository.cs new file mode 100644 index 00000000..0db9d90f --- /dev/null +++ b/AsbCloudApp/Repositories/IManualDirectoryRepository.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Services; + +namespace AsbCloudApp.Repositories; + +/// +/// Репозиторий для работы с директориямиы хранящими инструкциями +/// +public interface IManualDirectoryRepository : ICrudRepository +{ + /// + /// Получение дерева директорий + /// + /// + /// + Task> GetTreeAsync(CancellationToken cancellationToken); + + /// + /// Получение одной директории по параметрам + /// + /// + /// + /// + /// + Task GetOrDefaultAsync(string name, int? idParent, CancellationToken cancellationToken); + + /// + /// Проверка директории на существование + /// + /// + /// + /// + Task IsExistsAsync(int id, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IManualFolderRepository.cs b/AsbCloudApp/Repositories/IManualFolderRepository.cs deleted file mode 100644 index d7b86182..00000000 --- a/AsbCloudApp/Repositories/IManualFolderRepository.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data.Manuals; -using AsbCloudApp.Services; - -namespace AsbCloudApp.Repositories; - -/// -/// Репозиторий для работы с папки хранящими инструкциями -/// -public interface IManualFolderRepository : ICrudRepository -{ - /// - /// Получение дерева каталога папок - /// - /// - /// - /// - Task> GetTreeAsync(int idCategory, CancellationToken cancellationToken); - - /// - /// Получение одной папки по параметрам - /// - /// - /// - /// - /// - /// - Task GetOrDefaultAsync(string name, int? idParent, int idCategory, CancellationToken cancellationToken); -} \ No newline at end of file diff --git a/AsbCloudApp/Repositories/IManualRepository.cs b/AsbCloudApp/Repositories/IManualRepository.cs deleted file mode 100644 index d5d98c04..00000000 --- a/AsbCloudApp/Repositories/IManualRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data.Manuals; -using AsbCloudApp.Services; - -namespace AsbCloudApp.Repositories; - -/// -/// Репозиторий для инструкций -/// -public interface IManualRepository : ICrudRepository -{ - /// - /// Получение инструкций, которые не добавлены в папку - /// - /// - /// - /// - Task> GetManualsWithoutFolderAsync(int idCategory, CancellationToken cancellationToken); -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/DependencyInjection.cs b/AsbCloudInfrastructure/DependencyInjection.cs index 6b72eea2..1ff736f5 100644 --- a/AsbCloudInfrastructure/DependencyInjection.cs +++ b/AsbCloudInfrastructure/DependencyInjection.cs @@ -23,8 +23,10 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; +using AsbCloudApp.Data.Manuals; using AsbCloudApp.Services.AutoGeneratedDailyReports; using AsbCloudApp.Services.Notifications; +using AsbCloudDb.Model.Manuals; using AsbCloudInfrastructure.Services.AutoGeneratedDailyReports; namespace AsbCloudInfrastructure @@ -222,10 +224,9 @@ namespace AsbCloudInfrastructure services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient, CrudRepositoryBase>(); services.AddTransient(); diff --git a/AsbCloudInfrastructure/Repository/FileCategoryRepository.cs b/AsbCloudInfrastructure/Repository/FileCategoryRepository.cs deleted file mode 100644 index 703817e4..00000000 --- a/AsbCloudInfrastructure/Repository/FileCategoryRepository.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data; -using AsbCloudApp.Repositories; -using AsbCloudDb.Model; -using Mapster; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Caching.Memory; - -namespace AsbCloudInfrastructure.Repository; - -public class FileCategoryRepository : CrudCacheRepositoryBase, IFileCategoryRepository -{ - public FileCategoryRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache) : base(dbContext, memoryCache) - { - } - - public FileCategoryRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache, - Func, IQueryable> makeQuery) : base(dbContext, memoryCache, makeQuery) - { - } - - public async Task> GetAllAsync(int idType, CancellationToken cancellationToken) - { - return await dbContext.FileCategories.Where(f => f.IdType == idType) - .Select(f => f.Adapt()) - .ToArrayAsync(cancellationToken); - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs index ea6268eb..30729144 100644 --- a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs +++ b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs @@ -36,17 +36,15 @@ public class FileStorageRepository : IFileStorageRepository public void DeleteDirectory(string path) { - var fullPath = Path.Combine(RootPath, path); - - if (!Directory.Exists(fullPath)) + if (!Directory.Exists(path)) return; - foreach (var file in Directory.GetFiles(fullPath)) + foreach (var file in Directory.GetFiles(path)) { File.Delete(file); } - Directory.Delete(fullPath, true); + Directory.Delete(path, true); } public void DeleteFile(string fileName) diff --git a/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs b/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs new file mode 100644 index 00000000..6bae4f28 --- /dev/null +++ b/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Repositories; +using AsbCloudDb.Model; +using AsbCloudDb.Model.Manuals; +using Mapster; +using Microsoft.EntityFrameworkCore; + +namespace AsbCloudInfrastructure.Repository; + +public class ManualDirectoryRepository : CrudRepositoryBase, IManualDirectoryRepository +{ + public ManualDirectoryRepository(IAsbCloudDbContext context) : base(context) + { + } + + public async Task> GetTreeAsync(CancellationToken cancellationToken) + { + var directories = await dbContext.ManualDirectories + .Include(m => m.Manuals) + .Include(m => m.Parent) + .AsNoTracking() + .ToArrayAsync(cancellationToken); + + return BuildTree(directories).Select(x => x.Adapt()); + } + + public async Task GetOrDefaultAsync(string name, int? idParent, CancellationToken cancellationToken) + { + var entity = await dbContext.ManualDirectories + .AsNoTracking() + .FirstOrDefaultAsync(m => m.Name == name && + m.IdParent == idParent, cancellationToken); + + if (entity is null) + return null; + + return Convert(entity); + } + + public Task IsExistsAsync(int id, CancellationToken cancellationToken) => + dbContext.ManualDirectories.AnyAsync(d => d.Id == id, cancellationToken); + + private IEnumerable BuildTree(IEnumerable directories) + { + var directoryDict = directories.ToDictionary(f => f.Id); + + foreach (var directory in directories) + { + if (directory.IdParent.HasValue && directoryDict.TryGetValue(directory.IdParent.Value, out var parent)) + { + parent.Children ??= new List(); + parent.Children.Add(directory); + } + } + + return directories.Where(f => f.IdParent == null); + } +} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs b/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs deleted file mode 100644 index 456dca13..00000000 --- a/AsbCloudInfrastructure/Repository/ManualFolderRepository.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data.Manuals; -using AsbCloudApp.Repositories; -using AsbCloudDb.Model; -using AsbCloudDb.Model.Manuals; -using Mapster; -using Microsoft.EntityFrameworkCore; - -namespace AsbCloudInfrastructure.Repository; - -public class ManualFolderRepository : CrudRepositoryBase, IManualFolderRepository -{ - public ManualFolderRepository(IAsbCloudDbContext context) : base(context) - { - } - - public async Task> GetTreeAsync(int idCategory, - CancellationToken cancellationToken) - { - var folders = await dbContext.ManualFolders - .Where(m => m.IdCategory == idCategory) - .AsNoTracking() - .Include(m => m.Manuals) - .Include(m => m.Parent) - .ToArrayAsync(cancellationToken); - - return BuildTree(folders).Select(x => x.Adapt()); - } - - public async Task GetOrDefaultAsync(string name, int? idParent, int idCategory, - CancellationToken cancellationToken) - { - var entity = await dbContext.ManualFolders - .AsNoTracking() - .FirstOrDefaultAsync(m => m.Name == name && - m.IdCategory == idCategory && - m.IdParent == idParent, cancellationToken); - - if (entity is null) - return null; - - return Convert(entity); - } - - private IEnumerable BuildTree(IEnumerable folders) - { - var folderDict = folders.ToDictionary(f => f.Id); - - foreach (var folder in folders) - { - if (folder.IdParent.HasValue && folderDict.TryGetValue(folder.IdParent.Value, out var parent)) - { - parent.Children ??= new List(); - parent.Children.Add(folder); - } - } - - return folders.Where(f => f.IdParent == null); - } -} \ No newline at end of file diff --git a/AsbCloudInfrastructure/Repository/ManualRepository.cs b/AsbCloudInfrastructure/Repository/ManualRepository.cs deleted file mode 100644 index a23d8714..00000000 --- a/AsbCloudInfrastructure/Repository/ManualRepository.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Data.Manuals; -using AsbCloudApp.Repositories; -using AsbCloudDb.Model; -using AsbCloudDb.Model.Manuals; -using Mapster; -using Microsoft.EntityFrameworkCore; - -namespace AsbCloudInfrastructure.Repository; - -public class ManualRepository : CrudRepositoryBase, IManualRepository -{ - public ManualRepository(IAsbCloudDbContext context) : base(context) - { - } - - public ManualRepository(IAsbCloudDbContext context, Func, IQueryable> makeQuery) - : base(context, makeQuery) - { - } - - public async Task> GetManualsWithoutFolderAsync(int idCategory, CancellationToken cancellationToken) - { - return await dbContext.Manuals.Where(m => m.IdCategory == idCategory && - m.IdFolder == null) - .Select(m => m.Adapt()) - .ToArrayAsync(cancellationToken); - } -} \ No newline at end of file From eaf0885675c7f7bd2209e197a7ad56de74c99fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Fri, 8 Sep 2023 10:38:51 +0500 Subject: [PATCH 14/25] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=20=D0=B8=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Services/IManualCatalogService.cs | 30 ++-- .../Services/ManualCatalogService.cs | 145 +++++++----------- 2 files changed, 67 insertions(+), 108 deletions(-) diff --git a/AsbCloudApp/Services/IManualCatalogService.cs b/AsbCloudApp/Services/IManualCatalogService.cs index 598de63e..a38bd49b 100644 --- a/AsbCloudApp/Services/IManualCatalogService.cs +++ b/AsbCloudApp/Services/IManualCatalogService.cs @@ -1,8 +1,6 @@ -using System.Collections.Generic; using System.IO; using System.Threading; using System.Threading.Tasks; -using AsbCloudApp.Data.Manuals; namespace AsbCloudApp.Services; @@ -14,42 +12,39 @@ public interface IManualCatalogService /// /// Сохранение файла /// - /// - /// + /// + /// /// /// /// /// - Task SaveFileAsync(int? idCategory, int? idFolder, string name, Stream stream, - CancellationToken cancellationToken); + Task SaveFileAsync(int idDirectory, int idAuthor, string name, Stream stream, CancellationToken cancellationToken); /// - /// Добавление новой папки + /// Добавление директории /// /// /// - /// /// /// - Task AddFolderAsync(string name, int? idParent, int idCategory, - CancellationToken cancellationToken); + Task AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken); /// - /// Обновление папки + /// Обновление директории /// /// /// /// /// - Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken); + Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken); /// - /// Удаление папки + /// Удаление директории /// /// /// /// - Task DeleteFolderAsync(int id, CancellationToken cancellationToken); + Task DeleteDirectoryAsync(int id, CancellationToken cancellationToken); /// /// Удаление файла @@ -66,11 +61,4 @@ public interface IManualCatalogService /// /// Task<(Stream stream, string fileName)?> GetFileAsync(int id, CancellationToken cancellationToken); - - /// - /// Получение каталога - /// - /// - /// - Task> GetCatalogAsync(CancellationToken cancellationToken); } \ No newline at end of file diff --git a/AsbCloudInfrastructure/Services/ManualCatalogService.cs b/AsbCloudInfrastructure/Services/ManualCatalogService.cs index 545a114e..66d989f6 100644 --- a/AsbCloudInfrastructure/Services/ManualCatalogService.cs +++ b/AsbCloudInfrastructure/Services/ManualCatalogService.cs @@ -8,13 +8,14 @@ using AsbCloudApp.Data.Manuals; using AsbCloudApp.Exceptions; using AsbCloudApp.Repositories; using AsbCloudApp.Services; -using AsbCloudDb.Model; using Microsoft.Extensions.Configuration; namespace AsbCloudInfrastructure.Services; public class ManualCatalogService : IManualCatalogService { + private const int IdFileCategory = 30000; + private readonly IEnumerable validExtensions = new[] { ".pdf", @@ -23,28 +24,24 @@ public class ManualCatalogService : IManualCatalogService private readonly string directoryFiles; private readonly IFileStorageRepository fileStorageRepository; - private readonly IManualFolderRepository manualFolderRepository; - private readonly IManualRepository manualRepository; - private readonly IFileCategoryRepository fileCategoryRepository; + private readonly IManualDirectoryRepository manualDirectoryRepository; + private readonly ICrudRepository manualRepository; public ManualCatalogService(IFileStorageRepository fileStorageRepository, - IManualFolderRepository manualFolderRepository, - IManualRepository manualRepository, - IFileCategoryRepository fileCategoryRepository, + IManualDirectoryRepository manualDirectoryRepository, + ICrudRepository manualRepository, IConfiguration configuration) { this.fileStorageRepository = fileStorageRepository; - this.manualFolderRepository = manualFolderRepository; + this.manualDirectoryRepository = manualDirectoryRepository; this.manualRepository = manualRepository; - this.fileCategoryRepository = fileCategoryRepository; directoryFiles = configuration.GetValue("DirectoryManualFiles"); if (string.IsNullOrWhiteSpace(directoryFiles)) directoryFiles = "manuals"; } - public async Task SaveFileAsync(int? idCategory, int? idFolder, string name, Stream stream, - CancellationToken cancellationToken) + public async Task SaveFileAsync(int idDirectory, int idAuthor, string name, Stream stream, CancellationToken cancellationToken) { var extension = Path.GetExtension(name); @@ -53,74 +50,65 @@ public class ManualCatalogService : IManualCatalogService $"Невозможно загрузить файл с расширением '{extension}'. Допустимые форматы файлов: {string.Join(", ", validExtensions)}", extension); - var path = await BuildFilePathAsync(idCategory, idFolder, name, cancellationToken); + var path = await BuildFilePathAsync(idDirectory, name, cancellationToken); - await fileStorageRepository.SaveFileAsync(path, - stream, - cancellationToken); + await fileStorageRepository.SaveFileAsync(path, stream, cancellationToken); var manual = new ManualDto { Name = name, DateDownload = DateTime.UtcNow, - IdFolder = idFolder, - IdCategory = idCategory + IdDirectory = idDirectory, + IdCategory = IdFileCategory, + IdAuthor = idAuthor }; return await manualRepository.InsertAsync(manual, cancellationToken); } - public async Task AddFolderAsync(string name, int? idParent, int idCategory, - CancellationToken cancellationToken) + public async Task AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken) { - if (idParent.HasValue) - { - var parent = await manualFolderRepository.GetOrDefaultAsync(idParent.Value, cancellationToken) - ?? throw new ArgumentInvalidException("Родительской папки не существует", nameof(idParent)); + if (idParent.HasValue && !await manualDirectoryRepository.IsExistsAsync(idParent.Value, cancellationToken)) + throw new ArgumentInvalidException("Родительской директории не существует", nameof(idParent)); - if (parent.IdCategory != idCategory) - throw new ArgumentInvalidException("Категория родительской папки не соответствует текущей категории", - nameof(idCategory)); - } - - var manualFolder = new ManualFolderDto + var directory = new ManualDirectoryDto { Name = name, IdParent = idParent, - IdCategory = idCategory, }; - if (await IsExistFolderAsync(manualFolder, cancellationToken)) - throw new ArgumentInvalidException("Папка с таким названием уже существует", name); - - return await manualFolderRepository.InsertAsync(manualFolder, cancellationToken); + if (await IsExistDirectoryAsync(directory, cancellationToken)) + throw new ArgumentInvalidException("Директория с таким названием уже существует", name); + + return await manualDirectoryRepository.InsertAsync(directory, cancellationToken); } - public async Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken) + public async Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken) { - var folder = await manualFolderRepository.GetOrDefaultAsync(id, cancellationToken) - ?? throw new ArgumentInvalidException($"Папки с Id: {id} не сущесвует", nameof(id)); + var directory = await manualDirectoryRepository.GetOrDefaultAsync(id, cancellationToken) + ?? throw new ArgumentInvalidException($"Директории с Id: {id} не существует", nameof(id)); - folder.Name = name; + directory.Name = name; - if (await IsExistFolderAsync(folder, cancellationToken)) - throw new ArgumentInvalidException("Папка с таким названием уже существует", name); + if (await IsExistDirectoryAsync(directory, cancellationToken)) + throw new ArgumentInvalidException("Директория с таким названием уже существует", name); - await manualFolderRepository.UpdateAsync(folder, cancellationToken); + await manualDirectoryRepository.UpdateAsync(directory, cancellationToken); } - - public async Task DeleteFolderAsync(int id, CancellationToken cancellationToken) + public async Task DeleteDirectoryAsync(int id, CancellationToken cancellationToken) { - var folder = await manualFolderRepository.GetOrDefaultAsync(id, cancellationToken); + var directory = await manualDirectoryRepository.GetOrDefaultAsync(id, cancellationToken); - if (folder is null) + if (directory is null) return 0; - var path = Path.Combine(directoryFiles, folder.IdCategory.ToString(), folder.Id.ToString()); + var path = fileStorageRepository.MakeFilePath(directoryFiles, IdFileCategory.ToString(), + await BuildDirectoryPathAsync(id, cancellationToken)); + fileStorageRepository.DeleteDirectory(path); - return await manualFolderRepository.DeleteAsync(folder.Id, cancellationToken); + return await manualDirectoryRepository.DeleteAsync(directory.Id, cancellationToken); } public async Task DeleteFileAsync(int id, CancellationToken cancellationToken) @@ -130,9 +118,8 @@ public class ManualCatalogService : IManualCatalogService if (manual is null) return 0; - var filePath = await BuildFilePathAsync(manual.IdCategory, manual.IdFolder, manual.Name, - cancellationToken); - + var filePath = await BuildFilePathAsync(manual.IdDirectory, manual.Name, cancellationToken); + fileStorageRepository.DeleteFile(filePath); return await manualRepository.DeleteAsync(manual.Id, cancellationToken); @@ -145,58 +132,42 @@ public class ManualCatalogService : IManualCatalogService if (manual is null) return null; - var path = await BuildFilePathAsync(manual.IdCategory, manual.IdFolder, manual.Name, cancellationToken); - - var fileStream = new FileStream(Path.GetFullPath(path), FileMode.Open); - + var path = await BuildFilePathAsync(manual.IdDirectory, manual.Name, cancellationToken); + var fileStream = new FileStream(path, FileMode.Open); return (fileStream, manual.Name); } - public async Task> GetCatalogAsync(CancellationToken cancellationToken) + private async Task IsExistDirectoryAsync(ManualDirectoryDto directory, CancellationToken cancellationToken) { - var catalogItems = new List(); - - var categories = await fileCategoryRepository.GetAllAsync(FileCategory.IdFileCategoryTypeManuals, + var existingDirectory = await manualDirectoryRepository.GetOrDefaultAsync(directory.Name, directory.IdParent, cancellationToken); - foreach (var category in categories) - { - catalogItems.Add(new CatalogItemManualDto() - { - Category = category, - ManualsWithoutFolder = await manualRepository.GetManualsWithoutFolderAsync(category.Id, cancellationToken), - Folders = await manualFolderRepository.GetTreeAsync(category.Id, cancellationToken) - }); - } - - return catalogItems; + return existingDirectory is not null && directory.Id != existingDirectory.Id; } - private async Task IsExistFolderAsync(ManualFolderDto folder, CancellationToken cancellationToken) + private async Task BuildDirectoryPathAsync(int idDirectory, CancellationToken cancellationToken) { - var existingFolder = await manualFolderRepository.GetOrDefaultAsync(folder.Name, folder.IdParent, - folder.IdCategory, - cancellationToken); + var directiories = await manualDirectoryRepository.GetAllAsync(cancellationToken); - return existingFolder is not null && folder.Id != existingFolder.Id; - } + var directory = directiories.FirstOrDefault(d => d.Id == idDirectory) + ?? throw new ArgumentInvalidException($"Директории с Id: {idDirectory} не существует", nameof(idDirectory)); - private async Task BuildFilePathAsync(int? idCategory, int? idFolder, string name, - CancellationToken cancellationToken) - { - if (idFolder.HasValue) + var pathSegments = new List { directory.Id }; + + while (directory.IdParent.HasValue) { - var folder = await manualFolderRepository.GetOrDefaultAsync(idFolder.Value, cancellationToken) - ?? throw new ArgumentInvalidException($"Папки с Id: {idFolder} не сущесвует", nameof(idFolder)); + directory = directiories.FirstOrDefault(d => d.Id == directory.IdParent.Value); - return fileStorageRepository.MakeFilePath(directoryFiles, Path.Combine(folder.IdCategory.ToString(), - folder.IdParent.ToString() ?? string.Empty, - folder.Id.ToString()), name); + pathSegments.Insert(0, directory.Id); } - if (!idCategory.HasValue) - throw new ArgumentInvalidException("Не указан идентификатор категории", nameof(idCategory)); + return string.Join("/", pathSegments); + } - return fileStorageRepository.MakeFilePath(directoryFiles, idCategory.Value.ToString(), name); + private async Task BuildFilePathAsync(int idDirectory, string name, CancellationToken cancellationToken) + { + var directoryPath = await BuildDirectoryPathAsync(idDirectory, cancellationToken); + + return fileStorageRepository.MakeFilePath(directoryFiles, IdFileCategory.ToString(), Path.Combine(directoryPath, name)); } } \ No newline at end of file From d597bf729f86c24d09b7472163f95d0e6d4bc2ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Fri, 8 Sep 2023 10:39:54 +0500 Subject: [PATCH 15/25] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B5=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ManualController.cs | 62 ++++------ .../Controllers/ManualDirectoryController.cs | 113 ++++++++++++++++++ .../Controllers/ManualFolderController.cs | 94 --------------- 3 files changed, 133 insertions(+), 136 deletions(-) create mode 100644 AsbCloudWebApi/Controllers/ManualDirectoryController.cs delete mode 100644 AsbCloudWebApi/Controllers/ManualFolderController.cs diff --git a/AsbCloudWebApi/Controllers/ManualController.cs b/AsbCloudWebApi/Controllers/ManualController.cs index e43f973a..34818353 100644 --- a/AsbCloudWebApi/Controllers/ManualController.cs +++ b/AsbCloudWebApi/Controllers/ManualController.cs @@ -1,10 +1,9 @@ -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; -using AsbCloudApp.Data.Manuals; using AsbCloudApp.Repositories; using AsbCloudApp.Services; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -12,6 +11,7 @@ namespace AsbCloudWebApi.Controllers; [ApiController] [Route("api/[controller]")] +[Authorize] public class ManualController : ControllerBase { private readonly IManualCatalogService manualCatalogService; @@ -27,8 +27,7 @@ public class ManualController : ControllerBase /// /// Сохранение файла /// - /// Необязательный параметр. 30000 - АСУ ТП, 30001 - Технология бурения - /// Необязательный параметр. Id папки + /// Id директории /// Загружаемый файл /// /// @@ -37,23 +36,22 @@ public class ManualController : ControllerBase [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status403Forbidden)] - public async Task SaveFileAsync( - [Range(minimum: 30000, maximum: 30001, ErrorMessage = "Категория файла недопустима. Допустимые: 30000, 30001")] - int? idCategory, - int? idFolder, + public async Task SaveFileAsync(int idDirectory, [Required] IFormFile file, CancellationToken cancellationToken) { - if(!CanUserAccess("Manual.edit")) + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) return Forbid(); - + using var fileStream = file.OpenReadStream(); - var id = await manualCatalogService.SaveFileAsync(idCategory, idFolder, file.FileName, fileStream, cancellationToken); + var id = await manualCatalogService.SaveFileAsync(idDirectory, idUser.Value, file.FileName, fileStream, cancellationToken); return Ok(id); } - + /// /// Получение файла /// @@ -67,14 +65,16 @@ public class ManualController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetFileAsync(int id, CancellationToken cancellationToken) { - if(!CanUserAccess("Manual.view")) + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.get")) return Forbid(); - + var file = await manualCatalogService.GetFileAsync(id, cancellationToken); - + if (!file.HasValue) return NoContent(); - + return File(file.Value.stream, "application/octet-stream", file.Value.fileName); } @@ -90,33 +90,11 @@ public class ManualController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task DeleteFileAsync(int id, CancellationToken cancellationToken) { - if(!CanUserAccess("Manual.edit")) + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) return Forbid(); - + return Ok(await manualCatalogService.DeleteFileAsync(id, cancellationToken)); } - - /// - /// Получение каталога с инструкциями - /// - /// - /// - [HttpGet] - [Permission] - [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - public async Task GetCatalogAsync(CancellationToken cancellationToken) - { - if(!CanUserAccess("Manual.view")) - return Forbid(); - - return Ok(await manualCatalogService.GetCatalogAsync(cancellationToken)); - } - - private bool CanUserAccess(string permission) - { - var idUser = User.GetUserId(); - - return idUser.HasValue && userRepository.HasPermission(idUser.Value, permission); - } } \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ManualDirectoryController.cs b/AsbCloudWebApi/Controllers/ManualDirectoryController.cs new file mode 100644 index 00000000..cad8e60a --- /dev/null +++ b/AsbCloudWebApi/Controllers/ManualDirectoryController.cs @@ -0,0 +1,113 @@ +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Repositories; +using AsbCloudApp.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +namespace AsbCloudWebApi.Controllers; + +[ApiController] +[Route("api/[controller]")] +[Authorize] +public class ManualDirectoryController : ControllerBase +{ + private readonly IManualDirectoryRepository manualDirectoryRepository; + private readonly IManualCatalogService manualCatalogService; + private readonly IUserRepository userRepository; + + public ManualDirectoryController(IManualDirectoryRepository manualDirectoryRepository, + IManualCatalogService manualCatalogService, + IUserRepository userRepository) + { + this.manualDirectoryRepository = manualDirectoryRepository; + this.manualCatalogService = manualCatalogService; + this.userRepository = userRepository; + } + + /// + /// Создание директории + /// + /// Название + /// Необязательный параметр. Id родительской директории + /// + /// + [HttpPost] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken) + { + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) + return Forbid(); + + return Ok(await manualCatalogService.AddDirectoryAsync(name, idParent, cancellationToken)); + } + + /// + /// Обновление директории + /// + /// + /// Новое название директории + /// + /// + [HttpPut] + [Permission] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken) + { + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) + return Forbid(); + + await manualCatalogService.UpdateDirectoryAsync(id, name, cancellationToken); + + return Ok(); + } + + /// + /// Удаление директории + /// + /// Идентификатор директории + /// + /// + [HttpDelete] + [Permission] + [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task DeleteDirectoryAsync(int id, CancellationToken cancellationToken) + { + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) + return Forbid(); + + return Ok(await manualCatalogService.DeleteDirectoryAsync(id, cancellationToken)); + } + + /// + /// Получение дерева категорий + /// + /// + /// + [HttpGet] + [Permission] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status403Forbidden)] + public async Task GetAsync(CancellationToken cancellationToken) + { + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.get")) + return Forbid(); + + return Ok(await manualDirectoryRepository.GetTreeAsync(cancellationToken)); + } +} \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ManualFolderController.cs b/AsbCloudWebApi/Controllers/ManualFolderController.cs deleted file mode 100644 index fa97aef7..00000000 --- a/AsbCloudWebApi/Controllers/ManualFolderController.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Threading; -using System.Threading.Tasks; -using AsbCloudApp.Repositories; -using AsbCloudApp.Services; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -namespace AsbCloudWebApi.Controllers; - -[ApiController] -[Route("api/[controller]")] -public class ManualFolderController : ControllerBase -{ - private readonly IManualCatalogService manualCatalogService; - private readonly IUserRepository userRepository; - - public ManualFolderController(IManualCatalogService manualCatalogService, - IUserRepository userRepository) - { - this.manualCatalogService = manualCatalogService; - this.userRepository = userRepository; - } - - /// - /// Создание папки - /// - /// Название - /// Необязательный параметр. Id родительской папки - /// Id категории. 30000 - АСУ ТП, 30001 - Технология бурения - /// - /// - [HttpPost] - [Permission] - [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - public async Task AddFolderAsync(string name, int? idParent, - [Required(ErrorMessage = "Обязательный параметр")] - [Range(minimum: 30000, maximum: 30001, ErrorMessage = "Категория файла недопустима. Допустимые: 30000, 30001")] - int idCategory, - CancellationToken cancellationToken) - { - if (!CanUserAccess()) - return Forbid(); - - return Ok(await manualCatalogService.AddFolderAsync(name, idParent, idCategory, cancellationToken)); - } - - /// - /// Обновление папки - /// - /// - /// Новое название папки - /// - /// - [HttpPut] - [Permission] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - public async Task UpdateFolderAsync(int id, string name, CancellationToken cancellationToken) - { - if (!CanUserAccess()) - return Forbid(); - - await manualCatalogService.UpdateFolderAsync(id, name, cancellationToken); - - return Ok(); - } - - /// - /// Удаление папки - /// - /// - /// - /// - [HttpDelete] - [Permission] - [ProducesResponseType(typeof(int), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - public async Task DeleteFolderAsync(int id, CancellationToken cancellationToken) - { - if (!CanUserAccess()) - return Forbid(); - - return Ok(await manualCatalogService.DeleteFolderAsync(id, cancellationToken)); - } - - private bool CanUserAccess() - { - var idUser = User.GetUserId(); - - return idUser.HasValue && userRepository.HasPermission(idUser.Value, "Manual.edit"); - } -} \ No newline at end of file From 7293dc11e333f1d05299b6afeda1e7311e230223 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Mon, 11 Sep 2023 12:27:48 +0500 Subject: [PATCH 16/25] TelemetryDataBaseService Add GetAsync method with new request --- AsbCloudApp/Requests/TelemetryRequest.cs | 59 +++++++++++++++++++ AsbCloudApp/Services/ITelemetryDataService.cs | 2 + .../Services/SAUB/TelemetryDataBaseService.cs | 54 ++++++++++++++++- .../SAUB/TelemetryDataBaseController.cs | 31 ++++++++++ 4 files changed, 143 insertions(+), 3 deletions(-) create mode 100644 AsbCloudApp/Requests/TelemetryRequest.cs diff --git a/AsbCloudApp/Requests/TelemetryRequest.cs b/AsbCloudApp/Requests/TelemetryRequest.cs new file mode 100644 index 00000000..66b43cb5 --- /dev/null +++ b/AsbCloudApp/Requests/TelemetryRequest.cs @@ -0,0 +1,59 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace AsbCloudApp.Requests; + +/// +/// Параметры запроса телеметрии +/// +public class TelemetryDataRequest +{ + /// + /// Максимально допустимое кол-во строк данных + /// + public const int MaxTake = 3072; + + /// + /// greater or equal then Date + /// + public DateTimeOffset? GeDate { get; set; } + + /// + /// less or equal then Date + /// + public DateTimeOffset? LeDate { get; set; } + + /// + /// Делитель для прореживания выборки. + /// + /// 1 - без прореживания (default); + /// 2 - каждое 2-е значение; + /// 10 - каждое 10-е значение; + /// + /// + [Range(0, 300)] + public int Divider { get; set; } = 1; + + /// + /// сортировка/выравнивание данных в запросе по дате + /// + /// 0 - более ранние данные вперед; + /// 1 - более поздние данные вперед; + /// + /// + [Range(0, 1)] + public int Order { get; set; } = 0; + + /// + /// Пропустить с начала + /// + [Range(0, int.MaxValue)] + public int Skip { get; set; } = 0; + + /// + /// Кол-во возвращаемых, но не больше MaxTake + /// + [Range(1, MaxTake)] + public int Take { get; set; } = 1024; + +} diff --git a/AsbCloudApp/Services/ITelemetryDataService.cs b/AsbCloudApp/Services/ITelemetryDataService.cs index c1704509..a2034c7f 100644 --- a/AsbCloudApp/Services/ITelemetryDataService.cs +++ b/AsbCloudApp/Services/ITelemetryDataService.cs @@ -1,4 +1,5 @@ using AsbCloudApp.Data; +using AsbCloudApp.Requests; using System; using System.Collections.Generic; using System.Threading; @@ -25,6 +26,7 @@ namespace AsbCloudApp.Services Task> GetAsync(int idWell, DateTime dateBegin = default, double intervalSec = 600d, int approxPointsCount = 1024, CancellationToken token = default); + Task> GetAsync(int idWell, TelemetryDataRequest request, CancellationToken token); /// /// Получение статистики за период diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs index 8d76ee70..634e2cd1 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs @@ -1,4 +1,5 @@ using AsbCloudApp.Data; +using AsbCloudApp.Exceptions; using AsbCloudApp.Services; using AsbCloudDb; using AsbCloudDb.Model; @@ -137,10 +138,57 @@ namespace AsbCloudInfrastructure.Services.SAUB } var entities = await query - .OrderBy(d => d.DateTime) .AsNoTracking() - .ToListAsync(token) - .ConfigureAwait(false); + .ToArrayAsync(token); + + var dtos = entities.Select(e => Convert(e, timezone.Hours)); + + return dtos; + } + + /// + public virtual async Task> GetAsync(int idWell, AsbCloudApp.Requests.TelemetryDataRequest request, CancellationToken token) + { + var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell); + if (telemetry is null) + return Enumerable.Empty(); + + var timezone = telemetryService.GetTimezone(telemetry.Id); + + var dbSet = db.Set(); + + var query = dbSet + .Where(d => d.IdTelemetry == telemetry.Id) + .AsNoTracking(); + + if (request.GeDate.HasValue) + query = query.Where(d => d.DateTime >= request.GeDate); + + if (request.LeDate.HasValue) + query = query.Where(d => d.DateTime >= request.LeDate); + + if (request.Divider > 1) + query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0); + + switch (request.Order) + { + case 1:// Поздние вперед + query = query + .OrderByDescending(d => d.DateTime) + .Skip(request.Skip) + .Take(request.Take) + .OrderBy(d => d.DateTime); + break; + default:// Ранние вперед + query = query + .OrderBy(d => d.DateTime) + .Skip(request.Skip) + .Take(request.Take); + break; + } + + var entities = await query + .ToArrayAsync(token); var dtos = entities.Select(e => Convert(e, timezone.Hours)); diff --git a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs index f80693a1..cd9eb7b5 100644 --- a/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs +++ b/AsbCloudWebApi/Controllers/SAUB/TelemetryDataBaseController.cs @@ -1,4 +1,5 @@ using AsbCloudApp.Data; +using AsbCloudApp.Requests; using AsbCloudApp.Services; using AsbCloudWebApi.SignalR; using Microsoft.AspNetCore.Authorization; @@ -96,6 +97,36 @@ namespace AsbCloudWebApi.Controllers.SAUB return Ok(content); } + /// + /// Новая версия. Возвращает данные САУБ по скважине. + /// По умолчанию за последние 10 минут. + /// + /// id скважины + /// + /// Токен завершения задачи + /// + [HttpGet("{idWell}/data")] + [Permission] + public virtual async Task>> GetData2Async(int idWell, + [FromQuery]TelemetryDataRequest request, + CancellationToken token) + { + int? idCompany = User.GetCompanyId(); + + if (idCompany is null) + return Forbid(); + + bool isCompanyOwnsWell = await wellService.IsCompanyInvolvedInWellAsync((int)idCompany, + idWell, token).ConfigureAwait(false); + + if (!isCompanyOwnsWell) + return Forbid(); + + var content = await telemetryDataService.GetAsync(idWell, request, token); + + return Ok(content); + } + /// /// Возвращает диапазон дат за которые есть телеметрия за период времени /// From 1c1a33aeeea738c91b1b5ac6d9e3cf75e3a6a3cb Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Mon, 11 Sep 2023 13:48:47 +0500 Subject: [PATCH 17/25] TelemetryDataBaseService.GetAsync Add cache --- .../Services/SAUB/TelemetryDataBaseService.cs | 4 ++ .../Services/SAUB/TelemetryDataCache.cs | 50 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs index 634e2cd1..cdb0daf7 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs @@ -155,6 +155,10 @@ namespace AsbCloudInfrastructure.Services.SAUB var timezone = telemetryService.GetTimezone(telemetry.Id); + var cache = telemetryDataCache.GetOrDefault(telemetry.Id, request); + if(cache is not null) + return cache; + var dbSet = db.Set(); var query = dbSet diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs index 53089f17..6b468682 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs @@ -11,6 +11,7 @@ using Microsoft.Extensions.DependencyInjection; using AsbCloudInfrastructure.Background; using System.Threading; using AsbCloudApp.Data; +using AsbCloudApp.Requests; namespace AsbCloudInfrastructure.Services.SAUB { @@ -228,5 +229,54 @@ namespace AsbCloudInfrastructure.Services.SAUB }; return item; } + + public IEnumerable? GetOrDefault(int idTelemetry, TelemetryDataRequest request) + { + if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem)) + return null; + + IEnumerable data = cacheItem.LastData; + + if (!data.Any()) + return null; + + if (request.GeDate.HasValue) + { + if (data.First().DateTime > request.GeDate.Value) + return null; + + data = data.Where(d => d.DateTime >= request.GeDate); + } + else + { + if (request.Order == 0) + return null; + } + + if (request.LeDate.HasValue) + data = data.Where(d => d.DateTime >= request.LeDate); + + if (request.Divider > 1) + data = data.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0); + + switch (request.Order) + { + case 1: // Поздние вперед + data = data + .OrderByDescending(d => d.DateTime) + .Skip(request.Skip) + .Take(request.Take) + .OrderBy(d => d.DateTime); + break; + default: // Ранние вперед + data = data + .OrderBy(d => d.DateTime) + .Skip(request.Skip) + .Take(request.Take); + break; + } + + return data; + } } } From 5e0ab46e578aab13b238aee92787d57bc45bc6a2 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Mon, 11 Sep 2023 15:21:36 +0500 Subject: [PATCH 18/25] Fix TelemetryDataBaseService.GetAsync Db dateTime timezone TimestampBehavior --- .../Services/SAUB/TelemetryDataBaseService.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs index cdb0daf7..bfb173da 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs @@ -166,10 +166,16 @@ namespace AsbCloudInfrastructure.Services.SAUB .AsNoTracking(); if (request.GeDate.HasValue) - query = query.Where(d => d.DateTime >= request.GeDate); + { + var geDate = request.GeDate.Value.UtcDateTime; + query = query.Where(d => d.DateTime >= geDate); + } if (request.LeDate.HasValue) - query = query.Where(d => d.DateTime >= request.LeDate); + { + var leDate = request.LeDate.Value.UtcDateTime; + query = query.Where(d => d.DateTime <= leDate); + } if (request.Divider > 1) query = query.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0); From c0db1a02d3fab6b8c2835b277bcd6e7c0459e465 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Tue, 12 Sep 2023 16:22:01 +0500 Subject: [PATCH 19/25] TelemetryDataCache.GetOrDefault(..) Fix Timezone issue --- .../Services/SAUB/TelemetryDataCache.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs index 6b468682..c99b6c95 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataCache.cs @@ -22,6 +22,7 @@ namespace AsbCloudInfrastructure.Services.SAUB { public TDto? FirstByDate { get; init; } public CyclycArray LastData { get; init; } = null!; + public double TimezoneHours { get; init; } = 5; } private IServiceProvider provider = null!; @@ -226,6 +227,7 @@ namespace AsbCloudInfrastructure.Services.SAUB { FirstByDate = first, LastData = cacheItem, + TimezoneHours = hoursOffset, }; return item; } @@ -234,7 +236,7 @@ namespace AsbCloudInfrastructure.Services.SAUB { if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem)) return null; - + IEnumerable data = cacheItem.LastData; if (!data.Any()) @@ -242,19 +244,23 @@ namespace AsbCloudInfrastructure.Services.SAUB if (request.GeDate.HasValue) { - if (data.First().DateTime > request.GeDate.Value) + var geDate = request.GeDate.Value.ToRemoteDateTime(cacheItem.TimezoneHours); + if (data.First().DateTime > geDate) return null; - data = data.Where(d => d.DateTime >= request.GeDate); + data = data.Where(d => d.DateTime >= geDate); } else { if (request.Order == 0) return null; - } + } - if (request.LeDate.HasValue) + if (request.LeDate.HasValue) + { + var leDate = request.LeDate.Value.ToRemoteDateTime(cacheItem.TimezoneHours); data = data.Where(d => d.DateTime >= request.LeDate); + } if (request.Divider > 1) data = data.Where((d) => (((d.DateTime.DayOfYear * 24 + d.DateTime.Hour) * 60 + d.DateTime.Minute) * 60 + d.DateTime.Second) % request.Divider == 0); From adeaab52c487165235ba42dd73cae6d0c692be31 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Tue, 12 Sep 2023 17:49:24 +0500 Subject: [PATCH 20/25] WellboreService.GetWellboresAsync(..) fix timezones --- AsbCloudInfrastructure/Services/WellboreService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Services/WellboreService.cs b/AsbCloudInfrastructure/Services/WellboreService.cs index 79ef8a3c..5e0e439e 100644 --- a/AsbCloudInfrastructure/Services/WellboreService.cs +++ b/AsbCloudInfrastructure/Services/WellboreService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -58,8 +59,8 @@ public class WellboreService : IWellboreService Id = group.Key, Name = sections[group.Key].Caption, Well = well.Adapt(), - DateStart = group.Min(operation => operation.DateStart), - DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)), + DateStart = group.Min(operation => operation.DateStart).ToUtcDateTimeOffset(well.Timezone.Hours).ToOffset(TimeSpan.FromHours(well.Timezone.Hours)), + DateEnd = group.Max(operation => operation.DateStart.AddHours(operation.DurationHours)).ToUtcDateTimeOffset(well.Timezone.Hours).ToOffset(TimeSpan.FromHours(well.Timezone.Hours)), DepthStart = group.Min(operation => operation.DepthStart), DepthEnd = group.Max(operation => operation.DepthEnd), }); From 1d2b81b724d52f1086e0ab7f09e5e59b56e2016a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 13 Sep 2023 09:11:57 +0500 Subject: [PATCH 21/25] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавленный метод удаления в предыдущем коммите, являлся избыточным. --- AsbCloudApp/Services/IProcessMapService.cs | 9 --------- .../Services/ProcessMap/ProcessMapService.cs | 10 ---------- AsbCloudWebApi/Controllers/ProcessMapController.cs | 10 ---------- 3 files changed, 29 deletions(-) diff --git a/AsbCloudApp/Services/IProcessMapService.cs b/AsbCloudApp/Services/IProcessMapService.cs index 25e1d2f1..3534b2e2 100644 --- a/AsbCloudApp/Services/IProcessMapService.cs +++ b/AsbCloudApp/Services/IProcessMapService.cs @@ -17,14 +17,5 @@ namespace AsbCloudApp.Services /// /// Task> GetProcessMapReportAsync(int idWell, CancellationToken token); - - /// - /// Удаление записи РТК - /// - /// - /// - /// - /// - Task DeleteAsync(int id, int idWell, CancellationToken token); } } diff --git a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs index 9b296f85..a2193fd3 100644 --- a/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs +++ b/AsbCloudInfrastructure/Services/ProcessMap/ProcessMapService.cs @@ -54,16 +54,6 @@ namespace AsbCloudInfrastructure.Services.ProcessMap return result; } - public async Task DeleteAsync(int id, int idWell, CancellationToken token) - { - var processMap = await processMapPlanRepository.GetOrDefaultAsync(id, token); - - if (processMap?.IdWell != idWell) - throw new ArgumentInvalidException("Запись РТК принадлежит другой скважине", nameof(idWell)); - - return await processMapPlanRepository.DeleteAsync(id, token); - } - private IEnumerable CalcByIntervals(IEnumerable processMapPlan, TelemetryDataSaubStatDto[] telemetryDataStat) { var processMapIntervals = CalcDepthIntervals(processMapPlan); diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index 6eccb152..18110908 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -250,16 +250,6 @@ namespace AsbCloudWebApi.Controllers var fileName = $"РТК-план по скважине {well.Caption} куст {well.Cluster}.xlsx"; return File(stream, "application/octet-stream", fileName); } - - [HttpDelete("{id}/{idWell}")] - [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] - public async Task> DeleteAsync(int id, int idWell, CancellationToken cancellationToken) - { - if (!await CanUserEditProcessMapAsync(idWell, cancellationToken)) - return Forbid(); - - return await processMapService.DeleteAsync(id, idWell, cancellationToken); - } private async Task CanUserEditProcessMapAsync(int idWell, CancellationToken token) { From e451c0662cebfcc8e3f32ca0038121cbb04b3265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 13 Sep 2023 11:42:44 +0500 Subject: [PATCH 22/25] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D1=80=D0=B5=D0=B2=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Поправил инициализацию ролей и прав 2. Поправил проверки в контроллере на редактирование РТК и ГГД 3. Пересоздал миграцию --- ...913063219_Add_New_Permissions.Designer.cs} | 26 ++--------------- ... => 20230913063219_Add_New_Permissions.cs} | 28 ++----------------- .../AsbCloudDbContextModelSnapshot.cs | 20 ------------- .../EntityFillerRelationUserRolePermission.cs | 4 --- .../Controllers/ProcessMapController.cs | 7 +++-- .../Controllers/WellOperationController.cs | 5 +++- 6 files changed, 14 insertions(+), 76 deletions(-) rename AsbCloudDb/Migrations/{20230905071606_Add_New_Permissons.Designer.cs => 20230913063219_Add_New_Permissions.Designer.cs} (99%) rename AsbCloudDb/Migrations/{20230905071606_Add_New_Permissons.cs => 20230913063219_Add_New_Permissions.cs} (62%) diff --git a/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs b/AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.Designer.cs similarity index 99% rename from AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs rename to AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.Designer.cs index a7730041..c94465b6 100644 --- a/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.Designer.cs +++ b/AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.Designer.cs @@ -13,15 +13,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace AsbCloudDb.Migrations { [DbContext(typeof(AsbCloudDbContext))] - [Migration("20230905071606_Add_New_Permissons")] - partial class Add_New_Permissons + [Migration("20230913063219_Add_New_Permissions")] + partial class Add_New_Permissions { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .UseCollation("Russian_Russia.1251") - .HasAnnotation("ProductVersion", "6.0.21") + .HasAnnotation("ProductVersion", "6.0.22") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack"); @@ -3066,26 +3066,6 @@ namespace AsbCloudDb.Migrations IdPermission = 204 }, new - { - IdUserRole = 2009, - IdPermission = 525 - }, - new - { - IdUserRole = 2009, - IdPermission = 526 - }, - new - { - IdUserRole = 2013, - IdPermission = 525 - }, - new - { - IdUserRole = 2013, - IdPermission = 526 - }, - new { IdUserRole = 1, IdPermission = 100 diff --git a/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs b/AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.cs similarity index 62% rename from AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs rename to AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.cs index 9ba161cd..d6dc3d17 100644 --- a/AsbCloudDb/Migrations/20230905071606_Add_New_Permissons.cs +++ b/AsbCloudDb/Migrations/20230913063219_Add_New_Permissions.cs @@ -4,7 +4,7 @@ namespace AsbCloudDb.Migrations { - public partial class Add_New_Permissons : Migration + public partial class Add_New_Permissions : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -23,11 +23,7 @@ namespace AsbCloudDb.Migrations values: new object[,] { { 525, 1 }, - { 526, 1 }, - { 525, 2009 }, - { 526, 2009 }, - { 525, 2013 }, - { 526, 2013 } + { 526, 1 } }); } @@ -43,26 +39,6 @@ namespace AsbCloudDb.Migrations keyColumns: new[] { "id_permission", "id_user_role" }, keyValues: new object[] { 526, 1 }); - migrationBuilder.DeleteData( - table: "t_relation_user_role_permission", - keyColumns: new[] { "id_permission", "id_user_role" }, - keyValues: new object[] { 525, 2009 }); - - migrationBuilder.DeleteData( - table: "t_relation_user_role_permission", - keyColumns: new[] { "id_permission", "id_user_role" }, - keyValues: new object[] { 526, 2009 }); - - migrationBuilder.DeleteData( - table: "t_relation_user_role_permission", - keyColumns: new[] { "id_permission", "id_user_role" }, - keyValues: new object[] { 525, 2013 }); - - migrationBuilder.DeleteData( - table: "t_relation_user_role_permission", - keyColumns: new[] { "id_permission", "id_user_role" }, - keyValues: new object[] { 526, 2013 }); - migrationBuilder.DeleteData( table: "t_permission", keyColumn: "id", diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index bc70e90f..f5269452 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -3064,26 +3064,6 @@ namespace AsbCloudDb.Migrations IdPermission = 204 }, new - { - IdUserRole = 2009, - IdPermission = 525 - }, - new - { - IdUserRole = 2009, - IdPermission = 526 - }, - new - { - IdUserRole = 2013, - IdPermission = 525 - }, - new - { - IdUserRole = 2013, - IdPermission = 526 - }, - new { IdUserRole = 1, IdPermission = 100 diff --git a/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs b/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs index 1e4cbbf7..72a560d3 100644 --- a/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs +++ b/AsbCloudDb/Model/DefaultData/EntityFillerRelationUserRolePermission.cs @@ -58,10 +58,6 @@ namespace AsbCloudDb.Model.DefaultData new (){ IdUserRole = 2005, IdPermission = 247}, new (){ IdUserRole = 2005, IdPermission = 205}, new (){ IdUserRole = 2005, IdPermission = 204}, new (){ IdUserRole = 2006, IdPermission = 243}, new (){ IdUserRole = 2006, IdPermission = 205}, new (){ IdUserRole = 2006, IdPermission = 204}, new (){ IdUserRole = 2007, IdPermission = 241}, new (){ IdUserRole = 2007, IdPermission = 205}, new (){ IdUserRole = 2007, IdPermission = 204}, - new (){ IdUserRole = 2009, IdPermission = 525}, new (){ IdUserRole = 2009, IdPermission = 526}, - new (){ IdUserRole = 2013, IdPermission = 525}, new (){ IdUserRole = 2013, IdPermission = 526}, - - //new (){ IdUserRole = 1, IdPermission = 500}, new (){ IdUserRole = 1, IdPermission = 501}, new (){ IdUserRole = 1, IdPermission = 502}, new (){ IdUserRole = 1, IdPermission = 503}, new (){ IdUserRole = 1, IdPermission = 504}, new (){ IdUserRole = 1, IdPermission = 505}, new (){ IdUserRole = 1, IdPermission = 506}, new (){ IdUserRole = 1, IdPermission = 510}, new (){ IdUserRole = 1, IdPermission = 511}, new (){ IdUserRole = 1, IdPermission = 512}, new (){ IdUserRole = 1, IdPermission = 513}, new (){ IdUserRole = 1, IdPermission = 514}, new (){ IdUserRole = 1, IdPermission = 515}, }; var allPermissions = (new EntityFillerPermission()).GetData(); foreach ( var permission in allPermissions) diff --git a/AsbCloudWebApi/Controllers/ProcessMapController.cs b/AsbCloudWebApi/Controllers/ProcessMapController.cs index 18110908..1f5fbd6f 100644 --- a/AsbCloudWebApi/Controllers/ProcessMapController.cs +++ b/AsbCloudWebApi/Controllers/ProcessMapController.cs @@ -254,12 +254,15 @@ namespace AsbCloudWebApi.Controllers private async Task CanUserEditProcessMapAsync(int idWell, CancellationToken token) { var idUser = User.GetUserId(); + + if (!idUser.HasValue) + return false; var well = await wellService.GetOrDefaultAsync(idWell, token); - if (!idUser.HasValue || well is null) + if (well is null) return false; - + return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "ProcessMap.editCompletedWell"); } diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index a3f6c13a..d2a619c4 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -397,10 +397,13 @@ namespace AsbCloudWebApi.Controllers private async Task CanUserEditWellOperationsAsync(int idWell, CancellationToken token) { var idUser = User.GetUserId(); + + if (!idUser.HasValue) + return false; var well = await wellService.GetOrDefaultAsync(idWell, token); - if (!idUser.HasValue || well is null) + if (well is null) return false; return well.IdState != 2 || userRepository.HasPermission(idUser.Value, "WellOperation.editCompletedWell"); From f68cb10d4b389a62acdadeaac7fc302f79deba96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 14 Sep 2023 11:25:58 +0500 Subject: [PATCH 23/25] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs | 2 +- AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs index aae23758..ec15a73a 100644 --- a/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs +++ b/AsbCloudDb/Migrations/AsbCloudDbContextModelSnapshot.cs @@ -3831,7 +3831,7 @@ namespace AsbCloudDb.Migrations { IdUserRole = 1, IdPermission = 526 - },); + }); }); modelBuilder.Entity("AsbCloudDb.Model.RelationUserRoleUserRole", b => diff --git a/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs b/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs index 6bae4f28..a5c94944 100644 --- a/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs +++ b/AsbCloudInfrastructure/Repository/ManualDirectoryRepository.cs @@ -44,7 +44,7 @@ public class ManualDirectoryRepository : CrudRepositoryBase IsExistsAsync(int id, CancellationToken cancellationToken) => dbContext.ManualDirectories.AnyAsync(d => d.Id == id, cancellationToken); - private IEnumerable BuildTree(IEnumerable directories) + private static IEnumerable BuildTree(IEnumerable directories) { var directoryDict = directories.ToDictionary(f => f.Id); From f6bc677a683101c1475334b275e648f34d631d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Thu, 14 Sep 2023 11:33:46 +0500 Subject: [PATCH 24/25] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Поправил удаление директории 2. Вынес проверку прав в отдельный метод --- .../Repositories/IFileStorageRepository.cs | 3 +- .../Repository/FileStorageRepository.cs | 17 +++++++---- .../Services/ManualCatalogService.cs | 11 +++++-- .../Controllers/ManualController.cs | 27 ++++++++++------- .../Controllers/ManualDirectoryController.cs | 29 +++++++++---------- 5 files changed, 51 insertions(+), 36 deletions(-) diff --git a/AsbCloudApp/Repositories/IFileStorageRepository.cs b/AsbCloudApp/Repositories/IFileStorageRepository.cs index 37ebb125..1f511f31 100644 --- a/AsbCloudApp/Repositories/IFileStorageRepository.cs +++ b/AsbCloudApp/Repositories/IFileStorageRepository.cs @@ -51,7 +51,8 @@ namespace AsbCloudApp.Repositories /// Удаление директории /// /// - void DeleteDirectory(string path); + /// + void DeleteDirectory(string path, bool isRecursive); /// /// Удаление всех файлов с диска о которых нет информации в базе diff --git a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs index 30729144..7fad445b 100644 --- a/AsbCloudInfrastructure/Repository/FileStorageRepository.cs +++ b/AsbCloudInfrastructure/Repository/FileStorageRepository.cs @@ -1,4 +1,5 @@ -using AsbCloudApp.Data; +using System; +using AsbCloudApp.Data; using AsbCloudApp.Repositories; using System.Collections.Generic; using System.IO; @@ -34,17 +35,21 @@ public class FileStorageRepository : IFileStorageRepository } } - public void DeleteDirectory(string path) + public void DeleteDirectory(string path, bool isRecursive) { if (!Directory.Exists(path)) return; - - foreach (var file in Directory.GetFiles(path)) + + if (!isRecursive) { - File.Delete(file); + var files = Directory.GetFiles(path); + var directories = Directory.GetDirectories(path); + + if (files.Length != 0 || directories.Length != 0) + throw new InvalidOperationException("Директория не пуста и не может быть удалена"); } - Directory.Delete(path, true); + Directory.Delete(path, isRecursive); } public void DeleteFile(string fileName) diff --git a/AsbCloudInfrastructure/Services/ManualCatalogService.cs b/AsbCloudInfrastructure/Services/ManualCatalogService.cs index 66d989f6..eb98d76d 100644 --- a/AsbCloudInfrastructure/Services/ManualCatalogService.cs +++ b/AsbCloudInfrastructure/Services/ManualCatalogService.cs @@ -105,9 +105,16 @@ public class ManualCatalogService : IManualCatalogService var path = fileStorageRepository.MakeFilePath(directoryFiles, IdFileCategory.ToString(), await BuildDirectoryPathAsync(id, cancellationToken)); - - fileStorageRepository.DeleteDirectory(path); + try + { + fileStorageRepository.DeleteDirectory(path, true); + } + catch (InvalidOperationException ex) + { + throw new ArgumentInvalidException(ex.Message, nameof(id)); + } + return await manualDirectoryRepository.DeleteAsync(directory.Id, cancellationToken); } diff --git a/AsbCloudWebApi/Controllers/ManualController.cs b/AsbCloudWebApi/Controllers/ManualController.cs index 34818353..f68d8d6b 100644 --- a/AsbCloudWebApi/Controllers/ManualController.cs +++ b/AsbCloudWebApi/Controllers/ManualController.cs @@ -1,6 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Exceptions; using AsbCloudApp.Repositories; using AsbCloudApp.Services; using Microsoft.AspNetCore.Authorization; @@ -41,9 +42,11 @@ public class ManualController : ControllerBase CancellationToken cancellationToken) { var idUser = User.GetUserId(); - - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) - return Forbid(); + + if(!idUser.HasValue) + throw new ForbidException("Не удается вас опознать"); + + CanUserAccessToManual("Manual.edit"); using var fileStream = file.OpenReadStream(); @@ -65,10 +68,7 @@ public class ManualController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetFileAsync(int id, CancellationToken cancellationToken) { - var idUser = User.GetUserId(); - - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.get")) - return Forbid(); + CanUserAccessToManual("Manual.get"); var file = await manualCatalogService.GetFileAsync(id, cancellationToken); @@ -90,11 +90,16 @@ public class ManualController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task DeleteFileAsync(int id, CancellationToken cancellationToken) { - var idUser = User.GetUserId(); - - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) - return Forbid(); + CanUserAccessToManual("Manual.edit"); return Ok(await manualCatalogService.DeleteFileAsync(id, cancellationToken)); } + + private void CanUserAccessToManual(string permissionName) + { + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, permissionName)) + throw new ForbidException("У вас недостаточно прав"); + } } \ No newline at end of file diff --git a/AsbCloudWebApi/Controllers/ManualDirectoryController.cs b/AsbCloudWebApi/Controllers/ManualDirectoryController.cs index cad8e60a..0e448e01 100644 --- a/AsbCloudWebApi/Controllers/ManualDirectoryController.cs +++ b/AsbCloudWebApi/Controllers/ManualDirectoryController.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using AsbCloudApp.Data.Manuals; +using AsbCloudApp.Exceptions; using AsbCloudApp.Repositories; using AsbCloudApp.Services; using Microsoft.AspNetCore.Authorization; @@ -41,11 +42,8 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken) { - var idUser = User.GetUserId(); + CanUserAccessToManualDirectory("Manual.edit"); - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) - return Forbid(); - return Ok(await manualCatalogService.AddDirectoryAsync(name, idParent, cancellationToken)); } @@ -62,11 +60,8 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken) { - var idUser = User.GetUserId(); + CanUserAccessToManualDirectory("Manual.edit"); - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) - return Forbid(); - await manualCatalogService.UpdateDirectoryAsync(id, name, cancellationToken); return Ok(); @@ -84,11 +79,8 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task DeleteDirectoryAsync(int id, CancellationToken cancellationToken) { - var idUser = User.GetUserId(); + CanUserAccessToManualDirectory("Manual.edit"); - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.edit")) - return Forbid(); - return Ok(await manualCatalogService.DeleteDirectoryAsync(id, cancellationToken)); } @@ -103,11 +95,16 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetAsync(CancellationToken cancellationToken) { - var idUser = User.GetUserId(); - - if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, "Manual.get")) - return Forbid(); + CanUserAccessToManualDirectory("Manual.get"); return Ok(await manualDirectoryRepository.GetTreeAsync(cancellationToken)); } + + private void CanUserAccessToManualDirectory(string permissionName) + { + var idUser = User.GetUserId(); + + if (!idUser.HasValue || !userRepository.HasPermission(idUser.Value, permissionName)) + throw new ForbidException("У вас недостаточно прав"); + } } \ No newline at end of file From 2903762f0ee0d31f4db0b2c95ee4c2ac07bc7b04 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Thu, 14 Sep 2023 12:01:35 +0500 Subject: [PATCH 25/25] rename assertion methods --- AsbCloudWebApi/Controllers/ManualController.cs | 8 ++++---- .../Controllers/ManualDirectoryController.cs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AsbCloudWebApi/Controllers/ManualController.cs b/AsbCloudWebApi/Controllers/ManualController.cs index f68d8d6b..6da171a5 100644 --- a/AsbCloudWebApi/Controllers/ManualController.cs +++ b/AsbCloudWebApi/Controllers/ManualController.cs @@ -46,7 +46,7 @@ public class ManualController : ControllerBase if(!idUser.HasValue) throw new ForbidException("Не удается вас опознать"); - CanUserAccessToManual("Manual.edit"); + AssertUserHasAccessToManual("Manual.edit"); using var fileStream = file.OpenReadStream(); @@ -68,7 +68,7 @@ public class ManualController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetFileAsync(int id, CancellationToken cancellationToken) { - CanUserAccessToManual("Manual.get"); + AssertUserHasAccessToManual("Manual.get"); var file = await manualCatalogService.GetFileAsync(id, cancellationToken); @@ -90,12 +90,12 @@ public class ManualController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task DeleteFileAsync(int id, CancellationToken cancellationToken) { - CanUserAccessToManual("Manual.edit"); + AssertUserHasAccessToManual("Manual.edit"); return Ok(await manualCatalogService.DeleteFileAsync(id, cancellationToken)); } - private void CanUserAccessToManual(string permissionName) + private void AssertUserHasAccessToManual(string permissionName) { var idUser = User.GetUserId(); diff --git a/AsbCloudWebApi/Controllers/ManualDirectoryController.cs b/AsbCloudWebApi/Controllers/ManualDirectoryController.cs index 0e448e01..73c247ac 100644 --- a/AsbCloudWebApi/Controllers/ManualDirectoryController.cs +++ b/AsbCloudWebApi/Controllers/ManualDirectoryController.cs @@ -42,7 +42,7 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task AddDirectoryAsync(string name, int? idParent, CancellationToken cancellationToken) { - CanUserAccessToManualDirectory("Manual.edit"); + AssertUserHasAccessToManualDirectory("Manual.edit"); return Ok(await manualCatalogService.AddDirectoryAsync(name, idParent, cancellationToken)); } @@ -60,7 +60,7 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task UpdateDirectoryAsync(int id, string name, CancellationToken cancellationToken) { - CanUserAccessToManualDirectory("Manual.edit"); + AssertUserHasAccessToManualDirectory("Manual.edit"); await manualCatalogService.UpdateDirectoryAsync(id, name, cancellationToken); @@ -79,7 +79,7 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task DeleteDirectoryAsync(int id, CancellationToken cancellationToken) { - CanUserAccessToManualDirectory("Manual.edit"); + AssertUserHasAccessToManualDirectory("Manual.edit"); return Ok(await manualCatalogService.DeleteDirectoryAsync(id, cancellationToken)); } @@ -95,12 +95,12 @@ public class ManualDirectoryController : ControllerBase [ProducesResponseType(StatusCodes.Status403Forbidden)] public async Task GetAsync(CancellationToken cancellationToken) { - CanUserAccessToManualDirectory("Manual.get"); + AssertUserHasAccessToManualDirectory("Manual.get"); return Ok(await manualDirectoryRepository.GetTreeAsync(cancellationToken)); } - private void CanUserAccessToManualDirectory(string permissionName) + private void AssertUserHasAccessToManualDirectory(string permissionName) { var idUser = User.GetUserId();