From 93b382c06309e025340ef9638c99b8a3f12269e9 Mon Sep 17 00:00:00 2001 From: Iliyan Iliev Date: Tue, 30 Jun 2020 11:54:25 +0300 Subject: [PATCH 1/2] Closes #20 --- ...MAVN.Service.AdminManagement.Client.csproj | 4 +- ...MAVN.Service.AdminManagement.Domain.csproj | 2 +- ...vice.AdminManagement.DomainServices.csproj | 8 +- .../AdminManagementContext.cs | 8 +- ...e.AdminManagement.MsSqlRepositories.csproj | 8 +- ...0190529105517_InitialMigration.Designer.cs | 56 ----------- .../20190529105517_InitialMigration.cs | 51 ---------- .../20190717082827_IndexRemoval.Designer.cs | 53 ----------- .../Migrations/20190717082827_IndexRemoval.cs | 25 ----- .../20191006191402_SensitiveData.Designer.cs | 49 ---------- .../20191006191402_SensitiveData.cs | 87 ----------------- .../20191112073458_AdminState.Designer.cs | 52 ---------- .../Migrations/20191112073458_AdminState.cs | 25 ----- ...124033_IsActiveDefaultValueFix.Designer.cs | 54 ----------- .../20191127124033_IsActiveDefaultValueFix.cs | 31 ------ .../20191203090540_Permissions.Designer.cs | 84 ---------------- .../Migrations/20191203090540_Permissions.cs | 74 --------------- .../20200425081712_AddEmailVerification.cs | 40 -------- ....cs => 20200630082819_Initial.Designer.cs} | 47 +++++---- .../Migrations/20200630082819_Initial.cs | 95 +++++++++++++++++++ .../AdminManagementContextModelSnapshot.cs | 43 +++++---- .../Repositories/AdminUsersRepository.cs | 4 +- .../EmailVerificationCodeRepository.cs | 15 +-- .../Repositories/PermissionsRepository.cs | 6 +- src/MAVN.Service.AdminManagement/Dockerfile | 2 +- .../MAVN.Service.AdminManagement.csproj | 10 +- .../Modules/DataLayerModule.cs | 6 +- ...dminManagement.DomainServices.Tests.csproj | 6 +- ...nManagement.MsSqlRepositories.Tests.csproj | 4 +- .../MAVN.Service.AdminManagement.Tests.csproj | 4 +- 30 files changed, 195 insertions(+), 758 deletions(-) delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.Designer.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.Designer.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.Designer.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.Designer.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.Designer.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.Designer.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.cs delete mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.cs rename src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/{20200425081712_AddEmailVerification.Designer.cs => 20200630082819_Initial.Designer.cs} (67%) create mode 100644 src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.cs diff --git a/client/MAVN.Service.AdminManagement.Client/MAVN.Service.AdminManagement.Client.csproj b/client/MAVN.Service.AdminManagement.Client/MAVN.Service.AdminManagement.Client.csproj index 5cd3655..c60ddaf 100644 --- a/client/MAVN.Service.AdminManagement.Client/MAVN.Service.AdminManagement.Client.csproj +++ b/client/MAVN.Service.AdminManagement.Client/MAVN.Service.AdminManagement.Client.csproj @@ -11,8 +11,8 @@ $(OutputPath)$(AssemblyName).xml - - + + \ No newline at end of file diff --git a/src/MAVN.Service.AdminManagement.Domain/MAVN.Service.AdminManagement.Domain.csproj b/src/MAVN.Service.AdminManagement.Domain/MAVN.Service.AdminManagement.Domain.csproj index be91d14..dca39a2 100644 --- a/src/MAVN.Service.AdminManagement.Domain/MAVN.Service.AdminManagement.Domain.csproj +++ b/src/MAVN.Service.AdminManagement.Domain/MAVN.Service.AdminManagement.Domain.csproj @@ -1,6 +1,6 @@ - netcoreapp2.2 + netcoreapp3.1 1.0.0 diff --git a/src/MAVN.Service.AdminManagement.DomainServices/MAVN.Service.AdminManagement.DomainServices.csproj b/src/MAVN.Service.AdminManagement.DomainServices/MAVN.Service.AdminManagement.DomainServices.csproj index a646019..4c2c1b9 100644 --- a/src/MAVN.Service.AdminManagement.DomainServices/MAVN.Service.AdminManagement.DomainServices.csproj +++ b/src/MAVN.Service.AdminManagement.DomainServices/MAVN.Service.AdminManagement.DomainServices.csproj @@ -1,18 +1,18 @@ - netcoreapp2.2 + netcoreapp3.1 1.0.0 - + - + - + diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/AdminManagementContext.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/AdminManagementContext.cs index 8e90947..2ecf720 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/AdminManagementContext.cs +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/AdminManagementContext.cs @@ -1,14 +1,14 @@ -using System; +using System; using System.Data.Common; using JetBrains.Annotations; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.AdminManagement.Domain.Enums; using MAVN.Service.AdminManagement.MsSqlRepositories.Entities; using Microsoft.EntityFrameworkCore; namespace MAVN.Service.AdminManagement.MsSqlRepositories { - public class AdminManagementContext : MsSqlContext + public class AdminManagementContext : PostgreSQLContext { private const string Schema = "admin_users"; @@ -31,7 +31,7 @@ public AdminManagementContext(DbConnection dbConnection) { } - protected override void OnLykkeModelCreating(ModelBuilder modelBuilder) + protected override void OnMAVNModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasIndex(c => c.EmailHash) diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/MAVN.Service.AdminManagement.MsSqlRepositories.csproj b/src/MAVN.Service.AdminManagement.MsSqlRepositories/MAVN.Service.AdminManagement.MsSqlRepositories.csproj index 2f20a21..9973190 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/MAVN.Service.AdminManagement.MsSqlRepositories.csproj +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/MAVN.Service.AdminManagement.MsSqlRepositories.csproj @@ -1,14 +1,14 @@ - netcoreapp2.2 + netcoreapp3.1 1.0.0 - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.Designer.cs deleted file mode 100644 index e9aa004..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.Designer.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(AdminManagementContext))] - [Migration("20190529105517_InitialMigration")] - partial class InitialMigration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.AdminUsers.Entities.AdminUserEntity", b => - { - b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); - - b.Property("Email") - .IsRequired() - .HasColumnName("email"); - - b.Property("FirstName") - .HasColumnName("first_name"); - - b.Property("LastName") - .HasColumnName("last_name"); - - b.Property("RegisteredAt") - .HasColumnName("registered_at"); - - b.HasKey("AdminUserId"); - - b.HasIndex("AdminUserId") - .IsUnique(); - - b.HasIndex("Email") - .IsUnique(); - - b.ToTable("AdminUser"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.cs deleted file mode 100644 index 5d94e35..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190529105517_InitialMigration.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class InitialMigration : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "admin_users"); - - migrationBuilder.CreateTable( - name: "AdminUser", - schema: "admin_users", - columns: table => new - { - admin_id = table.Column(nullable: false), - email = table.Column(nullable: false), - first_name = table.Column(nullable: true), - last_name = table.Column(nullable: true), - registered_at = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AdminUser", x => x.admin_id); - }); - - migrationBuilder.CreateIndex( - name: "IX_AdminUser_admin_id", - schema: "admin_users", - table: "AdminUser", - column: "admin_id", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_AdminUser_email", - schema: "admin_users", - table: "AdminUser", - column: "email", - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AdminUser", - schema: "admin_users"); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.Designer.cs deleted file mode 100644 index 335d2f9..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.Designer.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(AdminManagementContext))] - [Migration("20190717082827_IndexRemoval")] - partial class IndexRemoval - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.AdminUsers.Entities.AdminUserEntity", b => - { - b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); - - b.Property("Email") - .IsRequired() - .HasColumnName("email"); - - b.Property("FirstName") - .HasColumnName("first_name"); - - b.Property("LastName") - .HasColumnName("last_name"); - - b.Property("RegisteredAt") - .HasColumnName("registered_at"); - - b.HasKey("AdminUserId"); - - b.HasIndex("Email") - .IsUnique(); - - b.ToTable("AdminUser"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.cs deleted file mode 100644 index 3b27c8a..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20190717082827_IndexRemoval.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class IndexRemoval : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AdminUser_admin_id", - schema: "admin_users", - table: "AdminUser"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateIndex( - name: "IX_AdminUser_admin_id", - schema: "admin_users", - table: "AdminUser", - column: "admin_id", - unique: true); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.Designer.cs deleted file mode 100644 index e586e57..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.Designer.cs +++ /dev/null @@ -1,49 +0,0 @@ -// -using System; -using MAVN.Service.AdminManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(AdminManagementContext))] - [Migration("20191006191402_SensitiveData")] - partial class SensitiveData - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.AdminUserEntity", b => - { - b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); - - b.Property("EmailHash") - .IsRequired() - .HasColumnName("email_hash") - .HasColumnType("char(64)"); - - b.Property("RegisteredAt") - .HasColumnName("registered_at"); - - b.HasKey("AdminUserId"); - - b.HasIndex("EmailHash") - .IsUnique(); - - b.ToTable("AdminUser"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.cs deleted file mode 100644 index 3fd558d..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191006191402_SensitiveData.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class SensitiveData : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AdminUser_email", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.RenameColumn( - name: "email", - schema: "admin_users", - table: "AdminUser", - newName: "email_hash"); - - migrationBuilder.AlterColumn( - name: "email_hash", - schema: "admin_users", - table: "AdminUser", - type: "char(64)", - nullable: false, - oldClrType: typeof(string)); - - migrationBuilder.DropColumn( - name: "first_name", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.DropColumn( - name: "last_name", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.CreateIndex( - name: "IX_AdminUser_email_hash", - schema: "admin_users", - table: "AdminUser", - column: "email_hash", - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_AdminUser_email_hash", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.RenameColumn( - name: "email_hash", - schema: "admin_users", - table: "AdminUser", - newName: "email"); - - migrationBuilder.AlterColumn( - name: "email", - schema: "admin_users", - table: "AdminUser", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string)); - - migrationBuilder.AddColumn( - name: "first_name", - schema: "admin_users", - table: "AdminUser", - nullable: true); - - migrationBuilder.AddColumn( - name: "last_name", - schema: "admin_users", - table: "AdminUser", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_AdminUser_email", - schema: "admin_users", - table: "AdminUser", - column: "email", - unique: true); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.Designer.cs deleted file mode 100644 index 3e67297..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.Designer.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -using System; -using MAVN.Service.AdminManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(AdminManagementContext))] - [Migration("20191112073458_AdminState")] - partial class AdminState - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.AdminUserEntity", b => - { - b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); - - b.Property("EmailHash") - .IsRequired() - .HasColumnName("email_hash") - .HasColumnType("char(64)"); - - b.Property("IsActive") - .HasColumnName("is_active"); - - b.Property("RegisteredAt") - .HasColumnName("registered_at"); - - b.HasKey("AdminUserId"); - - b.HasIndex("EmailHash") - .IsUnique(); - - b.ToTable("AdminUser"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.cs deleted file mode 100644 index cadd48e..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191112073458_AdminState.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class AdminState : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "is_active", - schema: "admin_users", - table: "AdminUser", - nullable: false, - defaultValue: false); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "is_active", - schema: "admin_users", - table: "AdminUser"); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.Designer.cs deleted file mode 100644 index da8010c..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.Designer.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -using System; -using MAVN.Service.AdminManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(AdminManagementContext))] - [Migration("20191127124033_IsActiveDefaultValueFix")] - partial class IsActiveDefaultValueFix - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.AdminUserEntity", b => - { - b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); - - b.Property("EmailHash") - .IsRequired() - .HasColumnName("email_hash") - .HasColumnType("char(64)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnName("is_active") - .HasDefaultValue(true); - - b.Property("RegisteredAt") - .HasColumnName("registered_at"); - - b.HasKey("AdminUserId"); - - b.HasIndex("EmailHash") - .IsUnique(); - - b.ToTable("AdminUser"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.cs deleted file mode 100644 index 1ea1ec3..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191127124033_IsActiveDefaultValueFix.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class IsActiveDefaultValueFix : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "is_active", - schema: "admin_users", - table: "AdminUser", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool)); - - migrationBuilder.Sql("UPDATE [admin_users].[AdminUser] SET [admin_users].[AdminUser].[is_active] = 'true'"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "is_active", - schema: "admin_users", - table: "AdminUser", - nullable: false, - oldClrType: typeof(bool), - oldDefaultValue: true); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.Designer.cs deleted file mode 100644 index 2a81cf0..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.Designer.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -using System; -using MAVN.Service.AdminManagement.MsSqlRepositories; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - [DbContext(typeof(AdminManagementContext))] - [Migration("20191203090540_Permissions")] - partial class Permissions - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.AdminUserEntity", b => - { - b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); - - b.Property("EmailHash") - .IsRequired() - .HasColumnName("email_hash") - .HasColumnType("char(64)"); - - b.Property("IsDisabled") - .ValueGeneratedOnAdd() - .HasColumnName("is_disabled") - .HasDefaultValue(false); - - b.Property("RegisteredAt") - .HasColumnName("registered_at"); - - b.Property("UseCustomPermissions") - .ValueGeneratedOnAdd() - .HasColumnName("use_custom_permissions") - .HasDefaultValue(false); - - b.HasKey("AdminUserId"); - - b.HasIndex("EmailHash") - .IsUnique(); - - b.ToTable("AdminUser"); - }); - - modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.PermissionEntity", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id"); - - b.Property("AdminUserId") - .IsRequired() - .HasColumnName("admin_id"); - - b.Property("Level") - .IsRequired() - .HasColumnName("level"); - - b.Property("Type") - .IsRequired() - .HasColumnName("type"); - - b.HasKey("Id"); - - b.HasIndex("AdminUserId"); - - b.ToTable("permissions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.cs deleted file mode 100644 index 232e444..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20191203090540_Permissions.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class Permissions : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "is_active", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.AddColumn( - name: "is_disabled", - schema: "admin_users", - table: "AdminUser", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "use_custom_permissions", - schema: "admin_users", - table: "AdminUser", - nullable: false, - defaultValue: false); - - migrationBuilder.CreateTable( - name: "permissions", - schema: "admin_users", - columns: table => new - { - id = table.Column(nullable: false), - admin_id = table.Column(nullable: false), - type = table.Column(nullable: false), - level = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_permissions", x => x.id); - }); - - migrationBuilder.CreateIndex( - name: "IX_permissions_admin_id", - schema: "admin_users", - table: "permissions", - column: "admin_id"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "permissions", - schema: "admin_users"); - - migrationBuilder.DropColumn( - name: "is_disabled", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.DropColumn( - name: "use_custom_permissions", - schema: "admin_users", - table: "AdminUser"); - - migrationBuilder.AddColumn( - name: "is_active", - schema: "admin_users", - table: "AdminUser", - nullable: false, - defaultValue: true); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.cs deleted file mode 100644 index b0c695d..0000000 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations -{ - public partial class AddEmailVerification : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "email_verification_codes", - schema: "admin_users", - columns: table => new - { - admin_id = table.Column(nullable: false), - code = table.Column(nullable: false), - is_verified = table.Column(nullable: false), - expire_date = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_email_verification_codes", x => x.admin_id); - }); - - migrationBuilder.CreateIndex( - name: "IX_email_verification_codes_code", - schema: "admin_users", - table: "email_verification_codes", - column: "code", - unique: true); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "email_verification_codes", - schema: "admin_users"); - } - } -} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.Designer.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.Designer.cs similarity index 67% rename from src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.Designer.cs rename to src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.Designer.cs index e4590a2..242e6c3 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200425081712_AddEmailVerification.Designer.cs +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.Designer.cs @@ -3,30 +3,30 @@ using MAVN.Service.AdminManagement.MsSqlRepositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations { [DbContext(typeof(AdminManagementContext))] - [Migration("20200425081712_AddEmailVerification")] - partial class AddEmailVerification + [Migration("20200630082819_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.AdminUserEntity", b => { b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); + .HasColumnName("admin_id") + .HasColumnType("text"); b.Property("EmailHash") .IsRequired() @@ -36,14 +36,17 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("IsDisabled") .ValueGeneratedOnAdd() .HasColumnName("is_disabled") + .HasColumnType("boolean") .HasDefaultValue(false); b.Property("RegisteredAt") - .HasColumnName("registered_at"); + .HasColumnName("registered_at") + .HasColumnType("timestamp without time zone"); b.Property("UseCustomPermissions") .ValueGeneratedOnAdd() .HasColumnName("use_custom_permissions") + .HasColumnType("boolean") .HasDefaultValue(false); b.HasKey("AdminUserId"); @@ -57,18 +60,21 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.EmailVerificationCodeEntity", b => { b.Property("AdminId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); + .HasColumnName("admin_id") + .HasColumnType("text"); b.Property("ExpireDate") - .HasColumnName("expire_date"); + .HasColumnName("expire_date") + .HasColumnType("timestamp without time zone"); b.Property("IsVerified") - .HasColumnName("is_verified"); + .HasColumnName("is_verified") + .HasColumnType("boolean"); b.Property("VerificationCode") .IsRequired() - .HasColumnName("code"); + .HasColumnName("code") + .HasColumnType("text"); b.HasKey("AdminId"); @@ -81,20 +87,23 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.PermissionEntity", b => { b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id"); + .HasColumnName("id") + .HasColumnType("text"); b.Property("AdminUserId") .IsRequired() - .HasColumnName("admin_id"); + .HasColumnName("admin_id") + .HasColumnType("text"); b.Property("Level") .IsRequired() - .HasColumnName("level"); + .HasColumnName("level") + .HasColumnType("text"); b.Property("Type") .IsRequired() - .HasColumnName("type"); + .HasColumnName("type") + .HasColumnType("text"); b.HasKey("Id"); diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.cs new file mode 100644 index 0000000..c5a7507 --- /dev/null +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/20200630082819_Initial.cs @@ -0,0 +1,95 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "admin_users"); + + migrationBuilder.CreateTable( + name: "AdminUser", + schema: "admin_users", + columns: table => new + { + admin_id = table.Column(nullable: false), + email_hash = table.Column(type: "char(64)", nullable: false), + registered_at = table.Column(nullable: false), + is_disabled = table.Column(nullable: false, defaultValue: false), + use_custom_permissions = table.Column(nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AdminUser", x => x.admin_id); + }); + + migrationBuilder.CreateTable( + name: "email_verification_codes", + schema: "admin_users", + columns: table => new + { + admin_id = table.Column(nullable: false), + code = table.Column(nullable: false), + is_verified = table.Column(nullable: false), + expire_date = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_email_verification_codes", x => x.admin_id); + }); + + migrationBuilder.CreateTable( + name: "permissions", + schema: "admin_users", + columns: table => new + { + id = table.Column(nullable: false), + admin_id = table.Column(nullable: false), + type = table.Column(nullable: false), + level = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_permissions", x => x.id); + }); + + migrationBuilder.CreateIndex( + name: "IX_AdminUser_email_hash", + schema: "admin_users", + table: "AdminUser", + column: "email_hash", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_email_verification_codes_code", + schema: "admin_users", + table: "email_verification_codes", + column: "code", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_permissions_admin_id", + schema: "admin_users", + table: "permissions", + column: "admin_id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AdminUser", + schema: "admin_users"); + + migrationBuilder.DropTable( + name: "email_verification_codes", + schema: "admin_users"); + + migrationBuilder.DropTable( + name: "permissions", + schema: "admin_users"); + } + } +} diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/AdminManagementContextModelSnapshot.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/AdminManagementContextModelSnapshot.cs index 6600150..0a0938d 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/AdminManagementContextModelSnapshot.cs +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Migrations/AdminManagementContextModelSnapshot.cs @@ -3,8 +3,8 @@ using MAVN.Service.AdminManagement.MsSqlRepositories; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace MAVN.Service.AdminManagement.MsSqlRepositories.Migrations { @@ -16,15 +16,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("admin_users") - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn) + .HasAnnotation("ProductVersion", "3.1.5") + .HasAnnotation("Relational:MaxIdentifierLength", 63); modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.AdminUserEntity", b => { b.Property("AdminUserId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); + .HasColumnName("admin_id") + .HasColumnType("text"); b.Property("EmailHash") .IsRequired() @@ -34,14 +34,17 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("IsDisabled") .ValueGeneratedOnAdd() .HasColumnName("is_disabled") + .HasColumnType("boolean") .HasDefaultValue(false); b.Property("RegisteredAt") - .HasColumnName("registered_at"); + .HasColumnName("registered_at") + .HasColumnType("timestamp without time zone"); b.Property("UseCustomPermissions") .ValueGeneratedOnAdd() .HasColumnName("use_custom_permissions") + .HasColumnType("boolean") .HasDefaultValue(false); b.HasKey("AdminUserId"); @@ -55,18 +58,21 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.EmailVerificationCodeEntity", b => { b.Property("AdminId") - .ValueGeneratedOnAdd() - .HasColumnName("admin_id"); + .HasColumnName("admin_id") + .HasColumnType("text"); b.Property("ExpireDate") - .HasColumnName("expire_date"); + .HasColumnName("expire_date") + .HasColumnType("timestamp without time zone"); b.Property("IsVerified") - .HasColumnName("is_verified"); + .HasColumnName("is_verified") + .HasColumnType("boolean"); b.Property("VerificationCode") .IsRequired() - .HasColumnName("code"); + .HasColumnName("code") + .HasColumnType("text"); b.HasKey("AdminId"); @@ -79,20 +85,23 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("MAVN.Service.AdminManagement.MsSqlRepositories.Entities.PermissionEntity", b => { b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnName("id"); + .HasColumnName("id") + .HasColumnType("text"); b.Property("AdminUserId") .IsRequired() - .HasColumnName("admin_id"); + .HasColumnName("admin_id") + .HasColumnType("text"); b.Property("Level") .IsRequired() - .HasColumnName("level"); + .HasColumnName("level") + .HasColumnType("text"); b.Property("Type") .IsRequired() - .HasColumnName("type"); + .HasColumnName("type") + .HasColumnType("text"); b.HasKey("Id"); diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/AdminUsersRepository.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/AdminUsersRepository.cs index f675168..c2750a4 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/AdminUsersRepository.cs +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/AdminUsersRepository.cs @@ -1,9 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using AutoMapper; using MAVN.Common; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.AdminManagement.Domain.Models; using MAVN.Service.AdminManagement.Domain.Repositories; using MAVN.Service.AdminManagement.MsSqlRepositories.Entities; diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/EmailVerificationCodeRepository.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/EmailVerificationCodeRepository.cs index 0b90107..c975ccd 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/EmailVerificationCodeRepository.cs +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/EmailVerificationCodeRepository.cs @@ -1,21 +1,22 @@ -using System; -using System.Data.SqlClient; +using System; using System.Threading.Tasks; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.AdminManagement.Domain.Models.Verification; using MAVN.Service.AdminManagement.Domain.Repositories; using MAVN.Service.AdminManagement.MsSqlRepositories.Entities; +using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; +using Npgsql; namespace MAVN.Service.AdminManagement.MsSqlRepositories.Repositories { public class EmailVerificationCodeRepository : IEmailVerificationCodeRepository { - private readonly MsSqlContextFactory _contextFactory; + private readonly PostgreSQLContextFactory _contextFactory; private readonly TimeSpan _verificationLinkExpirePeriod; public EmailVerificationCodeRepository( - MsSqlContextFactory contextFactory, + PostgreSQLContextFactory contextFactory, TimeSpan verificationLinkExpirePeriod) { _contextFactory = contextFactory; @@ -37,8 +38,8 @@ public async Task CreateOrUpdateAsync(string adminId, string } catch (DbUpdateException e) { - if (e.InnerException is SqlException sqlException && - sqlException.Number == MsSqlErrorCodes.PrimaryKeyConstraintViolation) + if (e.InnerException is PostgresException sqlException && + sqlException.SqlState == PostgreSqlErrorCodes.UniqueViolation.ToString()) { context.EmailVerificationCodes.Update(entity); diff --git a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/PermissionsRepository.cs b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/PermissionsRepository.cs index 685313a..b4c50fc 100644 --- a/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/PermissionsRepository.cs +++ b/src/MAVN.Service.AdminManagement.MsSqlRepositories/Repositories/PermissionsRepository.cs @@ -1,10 +1,10 @@ -using System; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading.Tasks; using AutoMapper; -using MAVN.Common.MsSql; +using MAVN.Persistence.PostgreSQL.Legacy; using MAVN.Service.AdminManagement.Domain.Models; using MAVN.Service.AdminManagement.Domain.Repositories; using MAVN.Service.AdminManagement.MsSqlRepositories.Entities; @@ -64,4 +64,4 @@ public async Task> AddAndRemoveAsync(string adminId, } } } -} \ No newline at end of file +} diff --git a/src/MAVN.Service.AdminManagement/Dockerfile b/src/MAVN.Service.AdminManagement/Dockerfile index fa60c74..7c8ea6f 100644 --- a/src/MAVN.Service.AdminManagement/Dockerfile +++ b/src/MAVN.Service.AdminManagement/Dockerfile @@ -1,4 +1,4 @@ -FROM microsoft/dotnet:2.2-aspnetcore-runtime +FROM microsoft/dotnet:3.1-aspnetcore-runtime WORKDIR /app COPY . . ENTRYPOINT ["dotnet", "MAVN.Service.AdminManagement.dll"] diff --git a/src/MAVN.Service.AdminManagement/MAVN.Service.AdminManagement.csproj b/src/MAVN.Service.AdminManagement/MAVN.Service.AdminManagement.csproj index a4cc57f..62255ed 100644 --- a/src/MAVN.Service.AdminManagement/MAVN.Service.AdminManagement.csproj +++ b/src/MAVN.Service.AdminManagement/MAVN.Service.AdminManagement.csproj @@ -1,6 +1,6 @@ - + - netcoreapp2.2 + netcoreapp3.1 Exe 1.0.0 @@ -15,13 +15,17 @@ $(OutputPath)$(AssemblyName).xml + + Always + PreserveNewest - + + diff --git a/src/MAVN.Service.AdminManagement/Modules/DataLayerModule.cs b/src/MAVN.Service.AdminManagement/Modules/DataLayerModule.cs index 409ec5a..74749df 100644 --- a/src/MAVN.Service.AdminManagement/Modules/DataLayerModule.cs +++ b/src/MAVN.Service.AdminManagement/Modules/DataLayerModule.cs @@ -1,12 +1,12 @@ -using Autofac; +using Autofac; using JetBrains.Annotations; -using MAVN.Common.MsSql; using MAVN.Service.AdminManagement.Domain.Repositories; using MAVN.Service.AdminManagement.MsSqlRepositories; using MAVN.Service.AdminManagement.MsSqlRepositories.Repositories; using MAVN.Service.AdminManagement.Settings; using Lykke.SettingsReader; using System; +using MAVN.Persistence.PostgreSQL.Legacy; namespace MAVN.Service.AdminManagement.Modules { @@ -24,7 +24,7 @@ public DataLayerModule(IReloadingManager settings) protected override void Load(ContainerBuilder builder) { - builder.RegisterMsSql( + builder.RegisterPostgreSQL( _settings.DbConnectionString, connString => new AdminManagementContext(connString, false), dbConn => new AdminManagementContext(dbConn)); diff --git a/tests/MAVN.Service.AdminManagement.DomainServices.Tests/MAVN.Service.AdminManagement.DomainServices.Tests.csproj b/tests/MAVN.Service.AdminManagement.DomainServices.Tests/MAVN.Service.AdminManagement.DomainServices.Tests.csproj index 72b93ec..9a6df0a 100644 --- a/tests/MAVN.Service.AdminManagement.DomainServices.Tests/MAVN.Service.AdminManagement.DomainServices.Tests.csproj +++ b/tests/MAVN.Service.AdminManagement.DomainServices.Tests/MAVN.Service.AdminManagement.DomainServices.Tests.csproj @@ -1,12 +1,12 @@ - netcoreapp2.2 + netcoreapp3.1 false 1.0.0 - - + + diff --git a/tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests.csproj b/tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests.csproj index d3cfb76..df6b5c4 100644 --- a/tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests.csproj +++ b/tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests/MAVN.Service.AdminManagement.MsSqlRepositories.Tests.csproj @@ -1,11 +1,11 @@ - netcoreapp2.2 + netcoreapp3.1 false 1.0.0 - + diff --git a/tests/MAVN.Service.AdminManagement.Tests/MAVN.Service.AdminManagement.Tests.csproj b/tests/MAVN.Service.AdminManagement.Tests/MAVN.Service.AdminManagement.Tests.csproj index f8f2e1d..ab90958 100644 --- a/tests/MAVN.Service.AdminManagement.Tests/MAVN.Service.AdminManagement.Tests.csproj +++ b/tests/MAVN.Service.AdminManagement.Tests/MAVN.Service.AdminManagement.Tests.csproj @@ -1,6 +1,6 @@ - netcoreapp2.2 + netcoreapp3.1 false 1.0.0 @@ -9,7 +9,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 874d7d15fb545820a7bef065cf64c2a416c1f151 Mon Sep 17 00:00:00 2001 From: Iliyan Iliev Date: Mon, 20 Jul 2020 11:21:47 +0300 Subject: [PATCH 2/2] fix dotnet version in github files --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6e9367..21acb10 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 2.2.207 + dotnet-version: 3.1.302 - name: Install dependencies run: dotnet restore - name: Build solution diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 42786d7..f159e2d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 2.2.207 + dotnet-version: 3.1.302 - name: Install dependencies run: dotnet restore - name: Build