diff --git a/Libs/YPermitin.FIASToolSet.DistributionLoader/FIASDistributionLoader.cs b/Libs/YPermitin.FIASToolSet.DistributionLoader/FIASDistributionLoader.cs index ac0e990..de64e25 100644 --- a/Libs/YPermitin.FIASToolSet.DistributionLoader/FIASDistributionLoader.cs +++ b/Libs/YPermitin.FIASToolSet.DistributionLoader/FIASDistributionLoader.cs @@ -46,6 +46,8 @@ public FIASDistributionLoader( _classifierDataRepository = classifierDataRepository; } + #region Manage + public async Task ActiveInstallationExists() { var activeInstallations = await _fiasInstallationManagerService.GetInstallations( @@ -63,19 +65,12 @@ public async Task> FixStuckInstallationExists() foreach (var activeInstallation in activeInstallations) { - if (activeInstallation.StartDate != null) - { - var startTimeLeft = DateTime.UtcNow - (DateTime)activeInstallation.StartDate; - if (startTimeLeft.TotalHours >= 4) - { - activeInstallation.StartDate = null; - activeInstallation.FinishDate = null; - activeInstallation.StatusId = FIASVersionInstallationStatus.New; - _fiasInstallationManagerService.UpdateInstallation(activeInstallation); + activeInstallation.StartDate = null; + activeInstallation.FinishDate = null; + activeInstallation.StatusId = FIASVersionInstallationStatus.New; + _fiasInstallationManagerService.UpdateInstallation(activeInstallation); - stuckInstallations.Add(activeInstallation); - } - } + stuckInstallations.Add(activeInstallation); } await _fiasInstallationManagerService.SaveAsync(); @@ -240,6 +235,7 @@ public async Task SetInstallationToStatusNew() _installation.FinishDate = null; _fiasInstallationManagerService.UpdateInstallation(_installation); await _fiasInstallationManagerService.SaveAsync(); + _fiasInstallationManagerService.ClearChangeTracking(); } public async Task SetInstallationToStatusInstalling() @@ -248,6 +244,7 @@ public async Task SetInstallationToStatusInstalling() _installation.StartDate = DateTime.UtcNow; _fiasInstallationManagerService.UpdateInstallation(_installation); await _fiasInstallationManagerService.SaveAsync(); + _fiasInstallationManagerService.ClearChangeTracking(); } public async Task SetInstallationToStatusInstalled() @@ -256,8 +253,80 @@ public async Task SetInstallationToStatusInstalled() _installation.FinishDate = DateTime.UtcNow; _fiasInstallationManagerService.UpdateInstallation(_installation); await _fiasInstallationManagerService.SaveAsync(); + _fiasInstallationManagerService.ClearChangeTracking(); + } + + /// + /// Проверка был ли регион уже загружен + /// + /// Истина, если регион уже загружен. Ложь в противном случае. + public async Task RegionWasLoaded(int regionCode) + { + var regionInstallation = await _fiasInstallationManagerService + .GetVersionInstallationRegion(_installation.Id, regionCode); + + if (regionInstallation == null) + { + return false; + } + + return regionInstallation.StatusId == FIASVersionInstallationStatus.Installed; } + + /// + /// Установка статуса установки региона на "Устанавливается" + /// + public async Task SetRegionInstallationStatusToInstalling(int regionCode) + { + var regionInstallation = await _fiasInstallationManagerService + .GetVersionInstallationRegion(_installation.Id, regionCode); + if (regionInstallation == null) + { + regionInstallation = new FIASVersionInstallationRegion(); + regionInstallation.FIASVersionInstallationId = _installation.Id; + regionInstallation.RegionCode = regionCode; + _fiasInstallationManagerService.AddInstallationRegion(regionInstallation); + } + else + { + _fiasInstallationManagerService.UpdateInstallationRegion(regionInstallation); + } + + regionInstallation.StatusId = FIASVersionInstallationStatus.Installing; + + await _fiasInstallationManagerService.SaveAsync(); + _fiasInstallationManagerService.ClearChangeTracking(); + } + + /// + /// Установка статуса установки региона на "Установлено" + /// + public async Task SetRegionInstallationStatusToInstalled(int regionCode) + { + var regionInstallation = await _fiasInstallationManagerService + .GetVersionInstallationRegion(_installation.Id, regionCode); + + if (regionInstallation == null) + { + regionInstallation = new FIASVersionInstallationRegion(); + regionInstallation.FIASVersionInstallationId = _installation.Id; + regionInstallation.RegionCode = regionCode; + _fiasInstallationManagerService.AddInstallationRegion(regionInstallation); + } + else + { + _fiasInstallationManagerService.UpdateInstallationRegion(regionInstallation); + } + + regionInstallation.StatusId = FIASVersionInstallationStatus.Installed; + + await _fiasInstallationManagerService.SaveAsync(); + _fiasInstallationManagerService.ClearChangeTracking(); + } + + #endregion + #region BaseCatalogs public async Task LoadAddressObjectTypes() @@ -2847,6 +2916,8 @@ public async Task LoadObjectsRegistry(Region region) #endregion + #region Service + private IFIASDistributionReader GetDistributionReader() { if (_distributionDirectory == null || !Directory.Exists(_distributionDirectory)) @@ -3731,4 +3802,6 @@ private async Task SaveObjectsRegistryPortion(ListОбъект асинхронной операции Task SetInstallationToStatusInstalled(); + /// + /// Проверка был ли регион уже загружен + /// + /// Истина, если регион уже загружен. Ложь в противном случае. + Task RegionWasLoaded(int regionCode); + + /// + /// Установка статуса установки региона на "Устанавливается" + /// + Task SetRegionInstallationStatusToInstalling(int regionCode); + + /// + /// Установка статуса установки региона на "Установлено" + /// + Task SetRegionInstallationStatusToInstalled(int regionCode); + #region BaseCatalogs /// diff --git a/Libs/YPermitin.FIASToolSet.DistributionLoader/YPermitin.FIASToolSet.DistributionLoader.xml b/Libs/YPermitin.FIASToolSet.DistributionLoader/YPermitin.FIASToolSet.DistributionLoader.xml index b638199..e887744 100644 --- a/Libs/YPermitin.FIASToolSet.DistributionLoader/YPermitin.FIASToolSet.DistributionLoader.xml +++ b/Libs/YPermitin.FIASToolSet.DistributionLoader/YPermitin.FIASToolSet.DistributionLoader.xml @@ -41,6 +41,22 @@ Регион для удаления каталога данных + + + Проверка был ли регион уже загружен + + Истина, если регион уже загружен. Ложь в противном случае. + + + + Установка статуса установки региона на "Устанавливается" + + + + + Установка статуса установки региона на "Установлено" + + Загрузка адресных объектов по региону @@ -236,6 +252,22 @@ Объект асинхронной операции + + + Проверка был ли регион уже загружен + + Истина, если регион уже загружен. Ложь в противном случае. + + + + Установка статуса установки региона на "Устанавливается" + + + + + Установка статуса установки региона на "Установлено" + + Загрузка типов адресных объектов diff --git a/Libs/YPermitin.FIASToolSet.Jobs/JobItems/InstallAndUpdateFIASJob.cs b/Libs/YPermitin.FIASToolSet.Jobs/JobItems/InstallAndUpdateFIASJob.cs index 8c6d683..366575c 100644 --- a/Libs/YPermitin.FIASToolSet.Jobs/JobItems/InstallAndUpdateFIASJob.cs +++ b/Libs/YPermitin.FIASToolSet.Jobs/JobItems/InstallAndUpdateFIASJob.cs @@ -14,7 +14,7 @@ namespace YPermitin.FIASToolSet.Jobs.JobItems; [DisallowConcurrentExecution] public class InstallAndUpdateFIASJob : IJob { - private readonly ILogger _logger; + private readonly ILogger _logger; private readonly IServiceProvider _provider; private readonly IConfiguration _configuration; @@ -25,7 +25,7 @@ public class InstallAndUpdateFIASJob : IJob public InstallAndUpdateFIASJob( IServiceProvider provider, - ILogger logger, + ILogger logger, IConfiguration configuration) { _logger = logger; @@ -148,6 +148,13 @@ await loader.DownloadAndExtractDistribution(args => foreach (var availableRegion in availableRegions) { + bool regionWasLoaded = await loader.RegionWasLoaded(availableRegion.Code); + if (regionWasLoaded) + { + _logger.LogWarning($"Регион с кодом \"{availableRegion.Code}\" уже был загружен. Пропускаем обработки файлов данных."); + continue; + } + try { loader.ExtractDataForRegion(availableRegion); @@ -157,6 +164,8 @@ await loader.DownloadAndExtractDistribution(args => _logger.LogError($"Не найден регион с кодом ${availableRegion.Code} среди доступных регионов в дистрибутиве ФИАС. Загрузка пропущена."); continue; } + + await loader.SetRegionInstallationStatusToInstalling(availableRegion.Code); await loader.LoadNormativeDocuments(availableRegion); await loader.LoadAddressObjects(availableRegion); @@ -177,6 +186,8 @@ await loader.DownloadAndExtractDistribution(args => await loader.LoadChangeHistory(availableRegion); await loader.LoadObjectsRegistry(availableRegion); + await loader.SetRegionInstallationStatusToInstalled(availableRegion.Code); + if (_removeExtractedDistributionFiles) { loader.RemoveDistributionRegionDirectory(availableRegion); diff --git a/Libs/YPermitin.FIASToolSet.Storage.Core/Models/Versions/FIASVersionInstallationRegion.cs b/Libs/YPermitin.FIASToolSet.Storage.Core/Models/Versions/FIASVersionInstallationRegion.cs new file mode 100644 index 0000000..0ca734b --- /dev/null +++ b/Libs/YPermitin.FIASToolSet.Storage.Core/Models/Versions/FIASVersionInstallationRegion.cs @@ -0,0 +1,39 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace YPermitin.FIASToolSet.Storage.Core.Models.Versions; + +/// +/// Информация о состоянии установки / обновления региона дистрибутива ФИАС +/// +public class FIASVersionInstallationRegion +{ + /// + /// Идентификатор шага + /// + public Guid Id { get; set; } + + /// + /// Установка версия ФИАС + /// + [ForeignKey("FIASVersionInstallationId")] + public FIASVersionInstallation FIASVersionInstallation { get; set; } + /// + /// Идентификатор установки версии ФИАС + /// + public Guid FIASVersionInstallationId { get; set; } + + /// + /// Статус установки данных региона дистрибутива ФИАС + /// + [ForeignKey("StatusId")] + public FIASVersionInstallationStatus Status { get; set; } + /// + /// Идентификатор статуса установки данных региона дистрибутива ФИАС + /// + public Guid StatusId { get; set; } + + /// + /// Код региона + /// + public int RegionCode { get; set; } +} \ No newline at end of file diff --git a/Libs/YPermitin.FIASToolSet.Storage.Core/Services/IFIASInstallationManagerRepository.cs b/Libs/YPermitin.FIASToolSet.Storage.Core/Services/IFIASInstallationManagerRepository.cs index 25f51e3..c49e415 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.Core/Services/IFIASInstallationManagerRepository.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.Core/Services/IFIASInstallationManagerRepository.cs @@ -28,8 +28,21 @@ Task> GetInstallations(Guid? statusId = null, Guid #endregion + #region FIASVersionInstallationRegion + + Task> GetVersionInstallationRegions(Guid installationId); + + Task GetVersionInstallationRegion(Guid installationId, int regionCode); + + void AddInstallationRegion(FIASVersionInstallationRegion installationRegion); + + void UpdateInstallationRegion(FIASVersionInstallationRegion installationRegion); + + #endregion + Task BeginTransactionAsync(); Task CommitTransactionAsync(); Task RollbackTransactionAsync(); Task SaveAsync(); + void ClearChangeTracking(); } \ No newline at end of file diff --git a/Libs/YPermitin.FIASToolSet.Storage.Core/YPermitin.FIASToolSet.Storage.Core.xml b/Libs/YPermitin.FIASToolSet.Storage.Core/YPermitin.FIASToolSet.Storage.Core.xml index 0b88178..3fbe85f 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.Core/YPermitin.FIASToolSet.Storage.Core.xml +++ b/Libs/YPermitin.FIASToolSet.Storage.Core/YPermitin.FIASToolSet.Storage.Core.xml @@ -1291,6 +1291,41 @@ Дата начала установки + + + Информация о состоянии установки / обновления региона дистрибутива ФИАС + + + + + Идентификатор шага + + + + + Установка версия ФИАС + + + + + Идентификатор установки версии ФИАС + + + + + Статус установки данных региона дистрибутива ФИАС + + + + + Идентификатор статуса установки данных региона дистрибутива ФИАС + + + + + Код региона + + Статус установки версии ФИАС diff --git a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/DbContexts/FIASToolSetServiceContext.cs b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/DbContexts/FIASToolSetServiceContext.cs index c1dea6a..7a895f7 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/DbContexts/FIASToolSetServiceContext.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/DbContexts/FIASToolSetServiceContext.cs @@ -16,7 +16,8 @@ public class FIASToolSetServiceContext : DbContext public DbSet FIASVersionInstallations { get; set; } public DbSet FIASVersionInstallationsTypes { get; set; } public DbSet FIASVersionInstallationSteps { get; set; } - + public DbSet FIASVersionInstallationRegions { get; set; } + #endregion #region Notification @@ -228,6 +229,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasMaxLength(512); #endregion + + #region FIASVersionInstallationRegion + + modelBuilder.Entity() + .HasKey(e => e.Id); + modelBuilder.Entity() + .HasIndex(e => new { e.RegionCode, e.FIASVersionInstallationId }) + .IsUnique(); + + #endregion #region AddressObjectType diff --git a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/20231126054214_AddedRegionInstallationState.Designer.cs b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/20231126054214_AddedRegionInstallationState.Designer.cs new file mode 100644 index 0000000..d528fa4 --- /dev/null +++ b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/20231126054214_AddedRegionInstallationState.Designer.cs @@ -0,0 +1,1686 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using YPermitin.FIASToolSet.Storage.PostgreSQL.DbContexts; + +#nullable disable + +namespace YPermitin.FIASToolSet.Storage.PostgreSQL.Migrations +{ + [DbContext(typeof(FIASToolSetServiceContext))] + [Migration("20231126054214_AddedRegionInstallationState")] + partial class AddedRegionInstallationState + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.AddressObjectType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Level") + .HasColumnType("integer"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ShortName") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASAddressObjectTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ApartmentType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ShortName") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASApartmentTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ShortName") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASHouseTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocKind", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.HasKey("Id"); + + b.ToTable("FIASNormativeDocKinds"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASNormativeDocTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ObjectLevel", b => + { + b.Property("Level") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Level"); + + b.ToTable("FIASObjectLevels"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASOperationTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Code") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASParameterTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.RoomType", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASRoomTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObject", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsActual") + .HasColumnType("boolean"); + + b.Property("LevelId") + .HasColumnType("integer"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeName") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("LevelId"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASAddressObjects"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectAdmHierarchy", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("AreaCode") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("CityCode") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("ParentObjectId") + .HasColumnType("integer"); + + b.Property("Path") + .HasColumnType("text"); + + b.Property("PlaceCode") + .HasColumnType("integer"); + + b.Property("PlanCode") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("RegionCode") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("StreetCode") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASAddressObjectsAdmHierarchy"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectDivision", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChildId") + .HasColumnType("integer"); + + b.Property("ParentId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("FIASAddressObjectDivisions"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectParameter", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChangeIdEnd") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASAddressObjectParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Apartment", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ApartmentTypeId") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsActual") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("Number") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("ApartmentTypeId"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASApartments"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ApartmentParameter", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChangeIdEnd") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASApartmentParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlace", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsActual") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("Number") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASCarPlaces"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlaceParameter", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChangeIdEnd") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASCarPlaceParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ChangeHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AddressObjectGuid") + .HasColumnType("uuid"); + + b.Property("ChangeDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("NormativeDocId") + .HasColumnType("integer"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.HasIndex("ObjectId", "AddressObjectGuid", "ChangeId") + .IsUnique(); + + b.ToTable("FIASChangeHistory"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.House", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("AddedHouseNumber1") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("AddedHouseNumber2") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("AddedHouseTypeId1") + .HasColumnType("integer"); + + b.Property("AddedHouseTypeId2") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("HouseNumber") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("HouseTypeId") + .HasColumnType("integer"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsActual") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("AddedHouseTypeId1"); + + b.HasIndex("AddedHouseTypeId2"); + + b.HasIndex("HouseTypeId"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASHouses"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.HouseParameter", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChangeIdEnd") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASHouseParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.MunHierarchy", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("OKTMO") + .HasColumnType("text"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("ParentObjectId") + .HasColumnType("integer"); + + b.Property("Path") + .HasColumnType("text"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("FIASMunHierarchy"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.NormativeDocument", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("AccDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Comment") + .HasColumnType("text"); + + b.Property("Date") + .HasColumnType("timestamp without time zone"); + + b.Property("KindId") + .HasColumnType("integer"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Number") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("OrgName") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("RegDate") + .HasColumnType("timestamp without time zone"); + + b.Property("RegNumber") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("KindId"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASNormativeDocuments"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ObjectRegistry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("CreateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("LevelId") + .HasColumnType("integer"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("LevelId"); + + b.HasIndex("ObjectId", "ObjectGuid", "ChangeId") + .IsUnique(); + + b.ToTable("FIASObjectsRegistry"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Room", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsActual") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("RoomNumber") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("RoomTypeId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.HasIndex("RoomTypeId"); + + b.ToTable("FIASRooms"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.RoomParameter", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChangeIdEnd") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASRoomParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Stead", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("IsActual") + .HasColumnType("boolean"); + + b.Property("NextAddressObjectId") + .HasColumnType("integer"); + + b.Property("Number") + .HasMaxLength(250) + .HasColumnType("character varying(250)"); + + b.Property("ObjectGuid") + .HasColumnType("uuid"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("OperationTypeId") + .HasColumnType("integer"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASSteads"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.SteadParameter", b => + { + b.Property("Id") + .HasColumnType("integer"); + + b.Property("ChangeId") + .HasColumnType("integer"); + + b.Property("ChangeIdEnd") + .HasColumnType("integer"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ObjectId") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("TypeId") + .HasColumnType("integer"); + + b.Property("UpdateDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASSteadParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Content") + .HasColumnType("text"); + + b.Property("FIASVersionId") + .HasColumnType("uuid"); + + b.Property("NotificationTypeId") + .HasColumnType("uuid"); + + b.Property("Period") + .HasColumnType("timestamp without time zone"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionId"); + + b.HasIndex("NotificationTypeId"); + + b.HasIndex("StatusId", "Period", "Id"); + + b.ToTable("NotificationsQueues"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("NotificationsStatuses"); + + b.HasData( + new + { + Id = new Guid("fbb1221b-9a20-4672-b872-730810dbd7d5"), + Name = "Added" + }, + new + { + Id = new Guid("f9ae7dcd-f55a-4810-8e96-62e1c0ad1923"), + Name = "Sent" + }, + new + { + Id = new Guid("7d3064ab-45fb-48c0-ac44-a91d1b2369b1"), + Name = "Canceled" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.HasKey("Id"); + + b.ToTable("NotificationType"); + + b.HasData( + new + { + Id = new Guid("50be368c-0f06-483a-a5b8-2de9113a4f27"), + Name = "New version of FIAS" + }, + new + { + Id = new Guid("749041e9-f51d-48b7-abe0-14ba50436431"), + Name = "Custom" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Date") + .HasColumnType("timestamp without time zone"); + + b.Property("FIASDbfComplete") + .HasColumnType("text"); + + b.Property("FIASDbfDelta") + .HasColumnType("text"); + + b.Property("FIASXmlComplete") + .HasColumnType("text"); + + b.Property("FIASXmlDelta") + .HasColumnType("text"); + + b.Property("GARFIASXmlComplete") + .HasColumnType("text"); + + b.Property("GARFIASXmlDelta") + .HasColumnType("text"); + + b.Property("KLADR47zComplete") + .HasColumnType("text"); + + b.Property("KLADR4ArjComplete") + .HasColumnType("text"); + + b.Property("Period") + .HasColumnType("timestamp without time zone"); + + b.Property("TextVersion") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("VersionId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("Period", "Id"); + + b.ToTable("FIASVersions"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Created") + .HasColumnType("timestamp without time zone"); + + b.Property("FIASVersionId") + .HasColumnType("uuid"); + + b.Property("FinishDate") + .HasColumnType("timestamp without time zone"); + + b.Property("InstallationTypeId") + .HasColumnType("uuid"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionId"); + + b.HasIndex("InstallationTypeId"); + + b.HasIndex("StatusId", "Created", "Id"); + + b.ToTable("FIASVersionInstallations"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("FIASVersionInstallationId") + .HasColumnType("uuid"); + + b.Property("RegionCode") + .HasColumnType("integer"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionInstallationId"); + + b.HasIndex("StatusId"); + + b.HasIndex("RegionCode", "FIASVersionInstallationId") + .IsUnique(); + + b.ToTable("FIASVersionInstallationRegions"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("FIASVersionInstallationStatuses"); + + b.HasData( + new + { + Id = new Guid("090cc6b8-a5c3-451c-b8fd-e5522ba9ce6a"), + Name = "New" + }, + new + { + Id = new Guid("4dba445f-ff47-4071-b9ae-6d3c56d6fe7d"), + Name = "Installing" + }, + new + { + Id = new Guid("b0473a78-2743-4f64-b2ea-683b97cc55c5"), + Name = "Installed" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStep", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("EndDate") + .HasColumnType("timestamp without time zone"); + + b.Property("FIASVersionInstallationId") + .HasColumnType("uuid"); + + b.Property("FileFullName") + .HasMaxLength(512) + .HasColumnType("character varying(512)"); + + b.Property("PercentageCompleted") + .HasColumnType("integer"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.Property("TotalItemsLoaded") + .HasColumnType("bigint"); + + b.Property("TotalItemsToLoad") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionInstallationId"); + + b.HasIndex("StatusId"); + + b.ToTable("FIASVersionInstallationSteps"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Name") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("FIASVersionInstallationsTypes"); + + b.HasData( + new + { + Id = new Guid("e4c31e19-cb2d-47cd-b96e-08a0876ac4f6"), + Name = "Full" + }, + new + { + Id = new Guid("4dba445f-ff47-4071-b9ae-6d3c56d6fe7d"), + Name = "Update" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObject", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ObjectLevel", "Level") + .WithMany() + .HasForeignKey("LevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Level"); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Apartment", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ApartmentType", "ApartmentType") + .WithMany() + .HasForeignKey("ApartmentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApartmentType"); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ApartmentParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlace", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlaceParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ChangeHistory", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.House", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", "AddedHouseType1") + .WithMany() + .HasForeignKey("AddedHouseTypeId1"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", "AddedHouseType2") + .WithMany() + .HasForeignKey("AddedHouseTypeId2"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", "HouseType") + .WithMany() + .HasForeignKey("HouseTypeId"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AddedHouseType1"); + + b.Navigation("AddedHouseType2"); + + b.Navigation("HouseType"); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.HouseParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.NormativeDocument", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocKind", "NormativeDocKind") + .WithMany() + .HasForeignKey("KindId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocType", "NormativeDocType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NormativeDocKind"); + + b.Navigation("NormativeDocType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ObjectRegistry", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ObjectLevel", "Level") + .WithMany() + .HasForeignKey("LevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Level"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Room", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.RoomType", "RoomType") + .WithMany() + .HasForeignKey("RoomTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + + b.Navigation("RoomType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.RoomParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Stead", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.SteadParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationQueue", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersion", "FIASVersion") + .WithMany() + .HasForeignKey("FIASVersionId"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationType", "NotificationType") + .WithMany() + .HasForeignKey("NotificationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersion"); + + b.Navigation("NotificationType"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersion", "FIASVersion") + .WithMany() + .HasForeignKey("FIASVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationType", "InstallationType") + .WithMany() + .HasForeignKey("InstallationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersion"); + + b.Navigation("InstallationType"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") + .WithMany() + .HasForeignKey("FIASVersionInstallationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersionInstallation"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStep", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") + .WithMany() + .HasForeignKey("FIASVersionInstallationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersionInstallation"); + + b.Navigation("Status"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/20231126054214_AddedRegionInstallationState.cs b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/20231126054214_AddedRegionInstallationState.cs new file mode 100644 index 0000000..cb8515e --- /dev/null +++ b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/20231126054214_AddedRegionInstallationState.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace YPermitin.FIASToolSet.Storage.PostgreSQL.Migrations +{ + /// + public partial class AddedRegionInstallationState : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "FIASVersionInstallationRegions", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + FIASVersionInstallationId = table.Column(type: "uuid", nullable: false), + StatusId = table.Column(type: "uuid", nullable: false), + RegionCode = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FIASVersionInstallationRegions", x => x.Id); + table.ForeignKey( + name: "FK_FIASVersionInstallationRegions_FIASVersionInstallationStatu~", + column: x => x.StatusId, + principalTable: "FIASVersionInstallationStatuses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FIASVersionInstallationRegions_FIASVersionInstallations_FIA~", + column: x => x.FIASVersionInstallationId, + principalTable: "FIASVersionInstallations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_FIASVersionInstallationRegions_FIASVersionInstallationId", + table: "FIASVersionInstallationRegions", + column: "FIASVersionInstallationId"); + + migrationBuilder.CreateIndex( + name: "IX_FIASVersionInstallationRegions_RegionCode_FIASVersionInstal~", + table: "FIASVersionInstallationRegions", + columns: new[] { "RegionCode", "FIASVersionInstallationId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_FIASVersionInstallationRegions_StatusId", + table: "FIASVersionInstallationRegions", + column: "StatusId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "FIASVersionInstallationRegions"); + } + } +} diff --git a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/FIASToolSetServiceContextModelSnapshot.cs b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/FIASToolSetServiceContextModelSnapshot.cs index 964dc15..7770674 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/FIASToolSetServiceContextModelSnapshot.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Migrations/FIASToolSetServiceContextModelSnapshot.cs @@ -1247,6 +1247,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("FIASVersionInstallations"); }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("FIASVersionInstallationId") + .HasColumnType("uuid"); + + b.Property("RegionCode") + .HasColumnType("integer"); + + b.Property("StatusId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionInstallationId"); + + b.HasIndex("StatusId"); + + b.HasIndex("RegionCode", "FIASVersionInstallationId") + .IsUnique(); + + b.ToTable("FIASVersionInstallationRegions"); + }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", b => { b.Property("Id") @@ -1613,6 +1640,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Status"); }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") + .WithMany() + .HasForeignKey("FIASVersionInstallationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersionInstallation"); + + b.Navigation("Status"); + }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStep", b => { b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") diff --git a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Services/FIASInstallationManagerRepository.cs b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Services/FIASInstallationManagerRepository.cs index e008cc7..2f1682c 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Services/FIASInstallationManagerRepository.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/Services/FIASInstallationManagerRepository.cs @@ -125,4 +125,39 @@ public void UpdateInstallationStep(FIASVersionInstallationStep installationStep) } #endregion + + #region FIASVersionInstallationRegion + + public async Task> GetVersionInstallationRegions(Guid installationId) + { + var steps = await _context.FIASVersionInstallationRegions + .Where(e => e.FIASVersionInstallationId == installationId) + .AsNoTracking() + .ToListAsync(); + + return steps; + } + + public async Task GetVersionInstallationRegion(Guid installationId, int regionCode) + { + var foundStep = await _context.FIASVersionInstallationRegions + .Where(e => e.FIASVersionInstallationId == installationId) + .Where(e => e.RegionCode == regionCode) + .AsNoTracking() + .FirstOrDefaultAsync(); + + return foundStep; + } + + public void AddInstallationRegion(FIASVersionInstallationRegion installationRegion) + { + _context.Entry(installationRegion).State = EntityState.Added; + } + + public void UpdateInstallationRegion(FIASVersionInstallationRegion installationRegion) + { + _context.Entry(installationRegion).State = EntityState.Modified; + } + + #endregion } \ No newline at end of file diff --git a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/YPermitin.FIASToolSet.Storage.PostgreSQL.xml b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/YPermitin.FIASToolSet.Storage.PostgreSQL.xml index b6da708..9cf2100 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/YPermitin.FIASToolSet.Storage.PostgreSQL.xml +++ b/Libs/YPermitin.FIASToolSet.Storage.PostgreSQL/YPermitin.FIASToolSet.Storage.PostgreSQL.xml @@ -112,5 +112,17 @@ + + + + + + + + + + + + diff --git a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/DbContexts/FIASToolSetServiceContext.cs b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/DbContexts/FIASToolSetServiceContext.cs index 57a5b3a..d48c715 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/DbContexts/FIASToolSetServiceContext.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/DbContexts/FIASToolSetServiceContext.cs @@ -16,6 +16,7 @@ public class FIASToolSetServiceContext : DbContext public DbSet FIASVersionInstallations { get; set; } public DbSet FIASVersionInstallationsTypes { get; set; } public DbSet FIASVersionInstallationSteps { get; set; } + public DbSet FIASVersionInstallationRegions { get; set; } #endregion @@ -229,6 +230,16 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) #endregion + #region FIASVersionInstallationRegion + + modelBuilder.Entity() + .HasKey(e => e.Id); + modelBuilder.Entity() + .HasIndex(e => new { e.RegionCode, e.FIASVersionInstallationId }) + .IsUnique(); + + #endregion + #region AddressObjectType modelBuilder.Entity() diff --git a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/20231126061450_AddedRegionInstallationState.Designer.cs b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/20231126061450_AddedRegionInstallationState.Designer.cs new file mode 100644 index 0000000..10c17a7 --- /dev/null +++ b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/20231126061450_AddedRegionInstallationState.Designer.cs @@ -0,0 +1,1686 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using YPermitin.FIASToolSet.Storage.SQLServer.DbContexts; + +#nullable disable + +namespace YPermitin.FIASToolSet.Storage.SQLServer.Migrations +{ + [DbContext(typeof(FIASToolSetServiceContext))] + [Migration("20231126061450_AddedRegionInstallationState")] + partial class AddedRegionInstallationState + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.AddressObjectType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ShortName") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASAddressObjectTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ApartmentType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ShortName") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASApartmentTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ShortName") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASHouseTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocKind", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.ToTable("FIASNormativeDocKinds"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASNormativeDocTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ObjectLevel", b => + { + b.Property("Level") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Level"); + + b.ToTable("FIASObjectLevels"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASOperationTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Code") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASParameterTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.RoomType", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASRoomTypes"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObject", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActual") + .HasColumnType("bit"); + + b.Property("LevelId") + .HasColumnType("int"); + + b.Property("Name") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("LevelId"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASAddressObjects"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectAdmHierarchy", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("AreaCode") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("CityCode") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("ParentObjectId") + .HasColumnType("int"); + + b.Property("Path") + .HasColumnType("nvarchar(max)"); + + b.Property("PlaceCode") + .HasColumnType("int"); + + b.Property("PlanCode") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("RegionCode") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("StreetCode") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASAddressObjectsAdmHierarchy"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectDivision", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChildId") + .HasColumnType("int"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("FIASAddressObjectDivisions"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectParameter", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChangeIdEnd") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASAddressObjectParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Apartment", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ApartmentTypeId") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActual") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("Number") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("ApartmentTypeId"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASApartments"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ApartmentParameter", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChangeIdEnd") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASApartmentParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlace", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActual") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("Number") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASCarPlaces"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlaceParameter", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChangeIdEnd") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASCarPlaceParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ChangeHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AddressObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeDate") + .HasColumnType("datetime2"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("NormativeDocId") + .HasColumnType("int"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.HasIndex("ObjectId", "AddressObjectGuid", "ChangeId") + .IsUnique(); + + b.ToTable("FIASChangeHistory"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.House", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("AddedHouseNumber1") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AddedHouseNumber2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AddedHouseTypeId1") + .HasColumnType("int"); + + b.Property("AddedHouseTypeId2") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("HouseNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("HouseTypeId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActual") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("AddedHouseTypeId1"); + + b.HasIndex("AddedHouseTypeId2"); + + b.HasIndex("HouseTypeId"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASHouses"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.HouseParameter", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChangeIdEnd") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASHouseParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.MunHierarchy", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("OKTMO") + .HasColumnType("nvarchar(max)"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("ParentObjectId") + .HasColumnType("int"); + + b.Property("Path") + .HasColumnType("nvarchar(max)"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("FIASMunHierarchy"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.NormativeDocument", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("AccDate") + .HasColumnType("datetime2"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("KindId") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Number") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("OrgName") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("RegDate") + .HasColumnType("datetime2"); + + b.Property("RegNumber") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("KindId"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASNormativeDocuments"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ObjectRegistry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("CreateDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("LevelId") + .HasColumnType("int"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("LevelId"); + + b.HasIndex("ObjectId", "ObjectGuid", "ChangeId") + .IsUnique(); + + b.ToTable("FIASObjectsRegistry"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Room", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActual") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("RoomNumber") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RoomTypeId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.HasIndex("RoomTypeId"); + + b.ToTable("FIASRooms"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.RoomParameter", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChangeIdEnd") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASRoomParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Stead", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsActual") + .HasColumnType("bit"); + + b.Property("NextAddressObjectId") + .HasColumnType("int"); + + b.Property("Number") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("ObjectGuid") + .HasColumnType("uniqueidentifier"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("OperationTypeId") + .HasColumnType("int"); + + b.Property("PreviousAddressObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperationTypeId"); + + b.ToTable("FIASSteads"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.SteadParameter", b => + { + b.Property("Id") + .HasColumnType("int"); + + b.Property("ChangeId") + .HasColumnType("int"); + + b.Property("ChangeIdEnd") + .HasColumnType("int"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("ObjectId") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("TypeId") + .HasColumnType("int"); + + b.Property("UpdateDate") + .HasColumnType("datetime2"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TypeId"); + + b.ToTable("FIASSteadParameters"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("FIASVersionId") + .HasColumnType("uniqueidentifier"); + + b.Property("NotificationTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("Period") + .HasColumnType("datetime2"); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionId"); + + b.HasIndex("NotificationTypeId"); + + b.HasIndex("StatusId", "Period", "Id"); + + b.ToTable("NotificationsQueues"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("NotificationsStatuses"); + + b.HasData( + new + { + Id = new Guid("fbb1221b-9a20-4672-b872-730810dbd7d5"), + Name = "Added" + }, + new + { + Id = new Guid("f9ae7dcd-f55a-4810-8e96-62e1c0ad1923"), + Name = "Sent" + }, + new + { + Id = new Guid("7d3064ab-45fb-48c0-ac44-a91d1b2369b1"), + Name = "Canceled" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("NotificationType"); + + b.HasData( + new + { + Id = new Guid("50be368c-0f06-483a-a5b8-2de9113a4f27"), + Name = "New version of FIAS" + }, + new + { + Id = new Guid("749041e9-f51d-48b7-abe0-14ba50436431"), + Name = "Custom" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("FIASDbfComplete") + .HasColumnType("nvarchar(max)"); + + b.Property("FIASDbfDelta") + .HasColumnType("nvarchar(max)"); + + b.Property("FIASXmlComplete") + .HasColumnType("nvarchar(max)"); + + b.Property("FIASXmlDelta") + .HasColumnType("nvarchar(max)"); + + b.Property("GARFIASXmlComplete") + .HasColumnType("nvarchar(max)"); + + b.Property("GARFIASXmlDelta") + .HasColumnType("nvarchar(max)"); + + b.Property("KLADR47zComplete") + .HasColumnType("nvarchar(max)"); + + b.Property("KLADR4ArjComplete") + .HasColumnType("nvarchar(max)"); + + b.Property("Period") + .HasColumnType("datetime2"); + + b.Property("TextVersion") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VersionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Period", "Id"); + + b.ToTable("FIASVersions"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("FIASVersionId") + .HasColumnType("uniqueidentifier"); + + b.Property("FinishDate") + .HasColumnType("datetime2"); + + b.Property("InstallationTypeId") + .HasColumnType("uniqueidentifier"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionId"); + + b.HasIndex("InstallationTypeId"); + + b.HasIndex("StatusId", "Created", "Id"); + + b.ToTable("FIASVersionInstallations"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FIASVersionInstallationId") + .HasColumnType("uniqueidentifier"); + + b.Property("RegionCode") + .HasColumnType("int"); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionInstallationId"); + + b.HasIndex("StatusId"); + + b.HasIndex("RegionCode", "FIASVersionInstallationId") + .IsUnique(); + + b.ToTable("FIASVersionInstallationRegions"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("FIASVersionInstallationStatuses"); + + b.HasData( + new + { + Id = new Guid("090cc6b8-a5c3-451c-b8fd-e5522ba9ce6a"), + Name = "New" + }, + new + { + Id = new Guid("4dba445f-ff47-4071-b9ae-6d3c56d6fe7d"), + Name = "Installing" + }, + new + { + Id = new Guid("b0473a78-2743-4f64-b2ea-683b97cc55c5"), + Name = "Installed" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStep", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EndDate") + .HasColumnType("datetime2"); + + b.Property("FIASVersionInstallationId") + .HasColumnType("uniqueidentifier"); + + b.Property("FileFullName") + .HasMaxLength(512) + .HasColumnType("nvarchar(512)"); + + b.Property("PercentageCompleted") + .HasColumnType("int"); + + b.Property("StartDate") + .HasColumnType("datetime2"); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.Property("TotalItemsLoaded") + .HasColumnType("bigint"); + + b.Property("TotalItemsToLoad") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionInstallationId"); + + b.HasIndex("StatusId"); + + b.ToTable("FIASVersionInstallationSteps"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("FIASVersionInstallationsTypes"); + + b.HasData( + new + { + Id = new Guid("e4c31e19-cb2d-47cd-b96e-08a0876ac4f6"), + Name = "Full" + }, + new + { + Id = new Guid("4dba445f-ff47-4071-b9ae-6d3c56d6fe7d"), + Name = "Update" + }); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObject", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ObjectLevel", "Level") + .WithMany() + .HasForeignKey("LevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Level"); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.AddressObjectParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Apartment", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ApartmentType", "ApartmentType") + .WithMany() + .HasForeignKey("ApartmentTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ApartmentType"); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ApartmentParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlace", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.CarPlaceParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ChangeHistory", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.House", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", "AddedHouseType1") + .WithMany() + .HasForeignKey("AddedHouseTypeId1"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", "AddedHouseType2") + .WithMany() + .HasForeignKey("AddedHouseTypeId2"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.HouseType", "HouseType") + .WithMany() + .HasForeignKey("HouseTypeId"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AddedHouseType1"); + + b.Navigation("AddedHouseType2"); + + b.Navigation("HouseType"); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.HouseParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.NormativeDocument", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocKind", "NormativeDocKind") + .WithMany() + .HasForeignKey("KindId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.NormativeDocType", "NormativeDocType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NormativeDocKind"); + + b.Navigation("NormativeDocType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.ObjectRegistry", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ObjectLevel", "Level") + .WithMany() + .HasForeignKey("LevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Level"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Room", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.RoomType", "RoomType") + .WithMany() + .HasForeignKey("RoomTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + + b.Navigation("RoomType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.RoomParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.Stead", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.OperationType", "OperationType") + .WithMany() + .HasForeignKey("OperationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OperationType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.ClassifierData.SteadParameter", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.BaseCatalogs.ParameterType", "ParameterType") + .WithMany() + .HasForeignKey("TypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ParameterType"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationQueue", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersion", "FIASVersion") + .WithMany() + .HasForeignKey("FIASVersionId"); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationType", "NotificationType") + .WithMany() + .HasForeignKey("NotificationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Notifications.NotificationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersion"); + + b.Navigation("NotificationType"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersion", "FIASVersion") + .WithMany() + .HasForeignKey("FIASVersionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationType", "InstallationType") + .WithMany() + .HasForeignKey("InstallationTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersion"); + + b.Navigation("InstallationType"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") + .WithMany() + .HasForeignKey("FIASVersionInstallationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersionInstallation"); + + b.Navigation("Status"); + }); + + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStep", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") + .WithMany() + .HasForeignKey("FIASVersionInstallationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersionInstallation"); + + b.Navigation("Status"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/20231126061450_AddedRegionInstallationState.cs b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/20231126061450_AddedRegionInstallationState.cs new file mode 100644 index 0000000..a5a49ab --- /dev/null +++ b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/20231126061450_AddedRegionInstallationState.cs @@ -0,0 +1,64 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace YPermitin.FIASToolSet.Storage.SQLServer.Migrations +{ + /// + public partial class AddedRegionInstallationState : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "FIASVersionInstallationRegions", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + FIASVersionInstallationId = table.Column(type: "uniqueidentifier", nullable: false), + StatusId = table.Column(type: "uniqueidentifier", nullable: false), + RegionCode = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_FIASVersionInstallationRegions", x => x.Id); + table.ForeignKey( + name: "FK_FIASVersionInstallationRegions_FIASVersionInstallationStatuses_StatusId", + column: x => x.StatusId, + principalTable: "FIASVersionInstallationStatuses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_FIASVersionInstallationRegions_FIASVersionInstallations_FIASVersionInstallationId", + column: x => x.FIASVersionInstallationId, + principalTable: "FIASVersionInstallations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_FIASVersionInstallationRegions_FIASVersionInstallationId", + table: "FIASVersionInstallationRegions", + column: "FIASVersionInstallationId"); + + migrationBuilder.CreateIndex( + name: "IX_FIASVersionInstallationRegions_RegionCode_FIASVersionInstallationId", + table: "FIASVersionInstallationRegions", + columns: new[] { "RegionCode", "FIASVersionInstallationId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_FIASVersionInstallationRegions_StatusId", + table: "FIASVersionInstallationRegions", + column: "StatusId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "FIASVersionInstallationRegions"); + } + } +} diff --git a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/FIASToolSetServiceContextModelSnapshot.cs b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/FIASToolSetServiceContextModelSnapshot.cs index 88232f8..7704e5a 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/FIASToolSetServiceContextModelSnapshot.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Migrations/FIASToolSetServiceContextModelSnapshot.cs @@ -1247,6 +1247,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("FIASVersionInstallations"); }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("FIASVersionInstallationId") + .HasColumnType("uniqueidentifier"); + + b.Property("RegionCode") + .HasColumnType("int"); + + b.Property("StatusId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("FIASVersionInstallationId"); + + b.HasIndex("StatusId"); + + b.HasIndex("RegionCode", "FIASVersionInstallationId") + .IsUnique(); + + b.ToTable("FIASVersionInstallationRegions"); + }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", b => { b.Property("Id") @@ -1613,6 +1640,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Status"); }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationRegion", b => + { + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") + .WithMany() + .HasForeignKey("FIASVersionInstallationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStatus", "Status") + .WithMany() + .HasForeignKey("StatusId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("FIASVersionInstallation"); + + b.Navigation("Status"); + }); + modelBuilder.Entity("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallationStep", b => { b.HasOne("YPermitin.FIASToolSet.Storage.Core.Models.Versions.FIASVersionInstallation", "FIASVersionInstallation") diff --git a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Services/FIASInstallationManagerRepository.cs b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Services/FIASInstallationManagerRepository.cs index 7c6b724..755edae 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Services/FIASInstallationManagerRepository.cs +++ b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/Services/FIASInstallationManagerRepository.cs @@ -125,4 +125,39 @@ public void UpdateInstallationStep(FIASVersionInstallationStep installationStep) } #endregion + + #region FIASVersionInstallationRegion + + public async Task> GetVersionInstallationRegions(Guid installationId) + { + var steps = await _context.FIASVersionInstallationRegions + .Where(e => e.FIASVersionInstallationId == installationId) + .AsNoTracking() + .ToListAsync(); + + return steps; + } + + public async Task GetVersionInstallationRegion(Guid installationId, int regionCode) + { + var foundStep = await _context.FIASVersionInstallationRegions + .Where(e => e.FIASVersionInstallationId == installationId) + .Where(e => e.RegionCode == regionCode) + .AsNoTracking() + .FirstOrDefaultAsync(); + + return foundStep; + } + + public void AddInstallationRegion(FIASVersionInstallationRegion installationRegion) + { + _context.Entry(installationRegion).State = EntityState.Added; + } + + public void UpdateInstallationRegion(FIASVersionInstallationRegion installationRegion) + { + _context.Entry(installationRegion).State = EntityState.Modified; + } + + #endregion } \ No newline at end of file diff --git a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/YPermitin.FIASToolSet.Storage.SQLServer.xml b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/YPermitin.FIASToolSet.Storage.SQLServer.xml index 8096903..6fb0307 100644 --- a/Libs/YPermitin.FIASToolSet.Storage.SQLServer/YPermitin.FIASToolSet.Storage.SQLServer.xml +++ b/Libs/YPermitin.FIASToolSet.Storage.SQLServer/YPermitin.FIASToolSet.Storage.SQLServer.xml @@ -28,5 +28,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 53ace59..6667379 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Для окружение разработчика необходимы: -* [.NET 6 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) +* [.NET 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) * [Visual Studio 2022](https://visualstudio.microsoft.com/ru/vs/) * [PostgreSQL 12/13/14](https://www.postgresql.org/download/) @@ -50,7 +50,7 @@ ## Развертывание проекта -Установите ASP.NET Core Runtime и PostgreSQL (12/13/14), после чего опубликуйте приложение "YPermitin.FIASToolSet.API". Подробнее о публикации ASP.NET Core приложений читайте в [официальной документации](https://docs.microsoft.com/ru-ru/aspnet/core/host-and-deploy/?view=aspnetcore-6.0). +Установите ASP.NET Core Runtime и PostgreSQL (12+), после чего опубликуйте приложение "YPermitin.FIASToolSet.API". Подробнее о публикации ASP.NET Core приложений читайте в [официальной документации](https://docs.microsoft.com/ru-ru/aspnet/core/host-and-deploy/?view=aspnetcore-6.0). ### appsettings.json @@ -124,11 +124,9 @@ ## Планы на будущее -* Добавить загрузку и обновление данных классификатора ФИАС с максимальной скоростью загрузки и минимальным потреблением ресурсов. * Добавить возможность хранения классификатора ФИАС в ClickHouse. * Реализовать API для работы с данными ФИАС. * Сделать пример использования API в [веб-приложении TinyDevTools](https://tinydevtools.ru/fias). -* Добавить поддержку Docker для развертывания приложения. ## Лицензия, благодарности и послесловие