From 070babb17aeaba26b00a09de488adbe925a6f44f Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Sun, 20 Oct 2024 15:39:08 -0400 Subject: [PATCH] Final Form --- Directory.Packages.props | 50 -- Hutopy.sln | 8 - .../Data/ApplicationDbContext.cs | 10 - src/Infrastructure/DependencyInjection.cs | 53 --- src/Infrastructure/GlobalUsings.cs | 4 - src/Infrastructure/Infrastructure.csproj | 24 - .../20240802044736_Initial.Designer.cs | 444 ------------------ .../Migrations/20240802044736_Initial.cs | 299 ------------ ...0821_ChangeBirthDateToDateTime.Designer.cs | 436 ----------------- ...0240903230821_ChangeBirthDateToDateTime.cs | 83 ---- ...0240903231429_RemoveOccupation.Designer.cs | 432 ----------------- .../20240903231429_RemoveOccupation.cs | 29 -- .../20240924044131_AddGoogleId.Designer.cs | 435 ----------------- .../Migrations/20240924044131_AddGoogleId.cs | 29 -- .../ApplicationDbContextModelSnapshot.cs | 432 ----------------- .../Common}/BlobStorage/AzureBlobStorage.cs | 4 +- .../Common}/BlobStorage/BlobStructure.txt | 0 .../Common}/BlobStorage/CommonFileNames.cs | 2 +- .../Common}/BlobStorage/ContainerNames.cs | 2 +- .../Common}/BlobStorage/ContentTypes.cs | 2 +- .../Common}/BlobStorage/SubDirectoryNames.cs | 2 +- .../ClaimsPrincipalExtensions.cs | 3 +- .../Common/Security}/GenerateJwtToken.cs | 2 +- .../Common/Security}/KnownClaims.cs | 2 +- .../{ => Security}/MissingClaimException.cs | 2 +- .../Common/Security}/PasswordGenerator.cs | 4 +- src/Web/Controllers/FacebookController.cs | 5 +- src/Web/DependencyInjection.cs | 2 +- .../Contents/Data/ContentDbContext.cs | 6 +- .../Features/Contents/Data/ContentReaction.cs | 2 +- .../Features/Contents/Data/Enums/Reaction.cs | 2 +- .../20240806065219_Initial.Designer.cs | 0 .../Migrations/20240806065219_Initial.cs | 0 .../20240816212531_AddsSoftDelete.Designer.cs | 0 .../20240816212531_AddsSoftDelete.cs | 0 ...824185551_AddReactionToContent.Designer.cs | 0 .../20240824185551_AddReactionToContent.cs | 0 ...9045548_UseMeterialColorSchema.Designer.cs | 0 .../20240919045548_UseMeterialColorSchema.cs | 0 ...919051151_NoMoreOptionalColors.Designer.cs | 0 .../20240919051151_NoMoreOptionalColors.cs | 0 ...22064815_RemovesAboutAddsTitle.Designer.cs | 0 .../20240922064815_RemovesAboutAddsTitle.cs | 0 ...653_FromSubscribersToFollowers.Designer.cs | 0 ...241011103653_FromSubscribersToFollowers.cs | 0 .../ContentDbContextModelSnapshot.cs | 0 .../Features/Contents/Handlers/AddReaction.cs | 2 +- .../Contents/Handlers/ChangeBanner.cs | 2 +- .../Features/Contents/Handlers/ChangeLogo.cs | 2 +- .../Contents/Handlers/CreateContent.cs | 3 +- .../Contents/Handlers/CreateCreator.cs | 1 + .../Contents/Handlers/DeleteContent.cs | 1 + .../Contents/Handlers/FollowCreator.cs | 1 + .../Contents/Handlers/GetCreatorProfile.cs | 1 + .../Contents/Handlers/GetFollowedCreators.cs | 1 + .../Contents/Handlers/UnfollowCreator.cs | 1 + .../20241012183354_AddHtmlFileUrl.Designer.cs | 313 ------------ .../20241012183354_AddHtmlFileUrl.cs | 30 -- .../20241011100852_Initial.Designer.cs | 0 .../Migrations/20241011100852_Initial.cs | 0 .../MembershipDbContextModelSnapshot.cs | 0 .../Handlers/GetActiveSubscriptions.cs | 1 + .../Memberships/Handlers/GetReceivedTips.cs | 1 + .../Memberships/Handlers/GetSentTips.cs | 1 + .../Features/Memberships/Handlers/SendTip.cs | 1 + .../Handlers/SubscribeToCreator.cs | 1 + .../20240805012343_Initial.Designer.cs | 0 .../Migrations/20240805012343_Initial.cs | 0 .../MessagingDbContextModelSnapshot.cs | 0 .../Features/Messages/Handlers/AddMessage.cs | 1 + .../Features/Messages/Handlers/AddReply.cs | 1 + .../Messages/Handlers/ChangeMessage.cs | 1 + .../Messages/Handlers/DeleteMessage.cs | 1 + .../Features/Users}/ApplicationRole.cs | 2 +- .../Features/Users}/ApplicationUser.cs | 2 +- .../Features/Users}/ApplicationUserManager.cs | 3 +- .../Users/Data/ApplicationDbContext.cs | 19 + .../Data/ApplicationDbContextInitializer.cs | 9 +- .../20241020183421_Initial.Designer.cs | 304 ++++++++++++ .../Data/Migrations/20241020183421_Initial.cs | 260 ++++++++++ .../ApplicationDbContextModelSnapshot.cs | 301 ++++++++++++ src/Web/Features/Users/DependencyInjection.cs | 43 ++ .../Features/Users/Handlers/ChangeAddress.cs | 4 +- .../Features/Users/Handlers/ChangeAlias.cs | 4 +- .../Users/Handlers/ChangeBirthDate.cs | 4 +- .../Features/Users/Handlers/ChangeEmail.cs | 4 +- .../Features/Users/Handlers/ChangeFullname.cs | 4 +- .../Features/Users/Handlers/ChangePhone.cs | 4 +- .../Features/Users/Handlers/ChangePortrait.cs | 6 +- .../Features/Users/Handlers/GetCurrentUser.cs | 1 - .../Handlers/GetCurrentUserProfilePicture.cs | 3 +- .../Users/Handlers/LoginWithGoogle.cs | 4 +- .../Users}/IdentityResultExtensions.cs | 4 +- .../Features/Users}/IdentityService.cs | 5 +- .../Features/Users}/JwtOptions.cs | 2 +- .../Features/Users}/KnownRoles.cs | 2 +- .../Features/Users}/Models/Result.cs | 2 +- .../Features/Users}/Models/RoleModel.cs | 2 +- .../Features/Users}/Models/UserModel.cs | 2 +- src/Web/Pages/Shared/_LoginPartial.cshtml | 2 +- src/Web/Program.cs | 11 +- src/Web/TestDataSeeder.cs | 4 +- src/Web/Web.csproj | 40 +- src/Web/appsettings.Development.json | 1 - update-databases.sh | 4 +- 105 files changed, 1027 insertions(+), 3212 deletions(-) delete mode 100644 Directory.Packages.props delete mode 100644 src/Infrastructure/Data/ApplicationDbContext.cs delete mode 100644 src/Infrastructure/DependencyInjection.cs delete mode 100644 src/Infrastructure/GlobalUsings.cs delete mode 100644 src/Infrastructure/Infrastructure.csproj delete mode 100644 src/Infrastructure/Migrations/20240802044736_Initial.Designer.cs delete mode 100644 src/Infrastructure/Migrations/20240802044736_Initial.cs delete mode 100644 src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.Designer.cs delete mode 100644 src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.cs delete mode 100644 src/Infrastructure/Migrations/20240903231429_RemoveOccupation.Designer.cs delete mode 100644 src/Infrastructure/Migrations/20240903231429_RemoveOccupation.cs delete mode 100644 src/Infrastructure/Migrations/20240924044131_AddGoogleId.Designer.cs delete mode 100644 src/Infrastructure/Migrations/20240924044131_AddGoogleId.cs delete mode 100644 src/Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs rename src/{Infrastructure => Web/Common}/BlobStorage/AzureBlobStorage.cs (97%) rename src/{Infrastructure => Web/Common}/BlobStorage/BlobStructure.txt (100%) rename src/{Infrastructure => Web/Common}/BlobStorage/CommonFileNames.cs (76%) rename src/{Infrastructure => Web/Common}/BlobStorage/ContainerNames.cs (72%) rename src/{Infrastructure => Web/Common}/BlobStorage/ContentTypes.cs (95%) rename src/{Infrastructure => Web/Common}/BlobStorage/SubDirectoryNames.cs (74%) rename src/Web/Common/{ => Security}/ClaimsPrincipalExtensions.cs (96%) rename src/{Infrastructure/Utils => Web/Common/Security}/GenerateJwtToken.cs (97%) rename src/{Infrastructure/Utils => Web/Common/Security}/KnownClaims.cs (77%) rename src/Web/Common/{ => Security}/MissingClaimException.cs (66%) rename src/{Infrastructure/Utils => Web/Common/Security}/PasswordGenerator.cs (96%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240806065219_Initial.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240806065219_Initial.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240816212531_AddsSoftDelete.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240816212531_AddsSoftDelete.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240824185551_AddReactionToContent.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240824185551_AddReactionToContent.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240919045548_UseMeterialColorSchema.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240919045548_UseMeterialColorSchema.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240919051151_NoMoreOptionalColors.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240919051151_NoMoreOptionalColors.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240922064815_RemovesAboutAddsTitle.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20240922064815_RemovesAboutAddsTitle.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20241011103653_FromSubscribersToFollowers.Designer.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/20241011103653_FromSubscribersToFollowers.cs (100%) rename src/Web/Features/Contents/{ => Data}/Migrations/ContentDbContextModelSnapshot.cs (100%) delete mode 100644 src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.Designer.cs delete mode 100644 src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.cs rename src/Web/Features/Memberships/{ => Data}/Migrations/20241011100852_Initial.Designer.cs (100%) rename src/Web/Features/Memberships/{ => Data}/Migrations/20241011100852_Initial.cs (100%) rename src/Web/Features/Memberships/{ => Data}/Migrations/MembershipDbContextModelSnapshot.cs (100%) rename src/Web/Features/Messages/{ => Data}/Migrations/20240805012343_Initial.Designer.cs (100%) rename src/Web/Features/Messages/{ => Data}/Migrations/20240805012343_Initial.cs (100%) rename src/Web/Features/Messages/{ => Data}/Migrations/MessagingDbContextModelSnapshot.cs (100%) rename src/{Infrastructure/Identity => Web/Features/Users}/ApplicationRole.cs (82%) rename src/{Infrastructure/Identity => Web/Features/Users}/ApplicationUser.cs (92%) rename src/{Infrastructure/Identity => Web/Features/Users}/ApplicationUserManager.cs (90%) create mode 100644 src/Web/Features/Users/Data/ApplicationDbContext.cs rename src/{Infrastructure => Web/Features/Users}/Data/ApplicationDbContextInitializer.cs (85%) create mode 100644 src/Web/Features/Users/Data/Migrations/20241020183421_Initial.Designer.cs create mode 100644 src/Web/Features/Users/Data/Migrations/20241020183421_Initial.cs create mode 100644 src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs create mode 100644 src/Web/Features/Users/DependencyInjection.cs rename src/{Infrastructure/Identity => Web/Features/Users}/IdentityResultExtensions.cs (77%) rename src/{Infrastructure/Identity => Web/Features/Users}/IdentityService.cs (95%) rename src/{Infrastructure/Identity => Web/Features/Users}/JwtOptions.cs (86%) rename src/{Infrastructure/Identity => Web/Features/Users}/KnownRoles.cs (76%) rename src/{Infrastructure/Identity => Web/Features/Users}/Models/Result.cs (95%) rename src/{Infrastructure/Identity => Web/Features/Users}/Models/RoleModel.cs (66%) rename src/{Infrastructure/Identity => Web/Features/Users}/Models/UserModel.cs (90%) diff --git a/Directory.Packages.props b/Directory.Packages.props deleted file mode 100644 index 9717e70..0000000 --- a/Directory.Packages.props +++ /dev/null @@ -1,50 +0,0 @@ - - - - true - - - - - - - - - - - - - - - - - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Hutopy.sln b/Hutopy.sln index 5521526..2c58b02 100644 --- a/Hutopy.sln +++ b/Hutopy.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure", "src\Infrastructure\Infrastructure.csproj", "{117DA02F-5274-4565-ACC6-DA9B6E568B09}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{6ED356A7-8B47-4613-AD01-C85CF28491BD}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E2DA20AA-28D1-455C-BF50-C49A8F831633}" @@ -12,7 +10,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig .gitignore = .gitignore Directory.Build.props = Directory.Build.props - Directory.Packages.props = Directory.Packages.props global.json = global.json README.md = README.md start-infrastructure.sh = start-infrastructure.sh @@ -28,10 +25,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {117DA02F-5274-4565-ACC6-DA9B6E568B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {117DA02F-5274-4565-ACC6-DA9B6E568B09}.Debug|Any CPU.Build.0 = Debug|Any CPU - {117DA02F-5274-4565-ACC6-DA9B6E568B09}.Release|Any CPU.ActiveCfg = Release|Any CPU - {117DA02F-5274-4565-ACC6-DA9B6E568B09}.Release|Any CPU.Build.0 = Release|Any CPU {4E4EE20C-F06A-4A1B-851F-C5577796941C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4E4EE20C-F06A-4A1B-851F-C5577796941C}.Debug|Any CPU.Build.0 = Debug|Any CPU {4E4EE20C-F06A-4A1B-851F-C5577796941C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -41,7 +34,6 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {117DA02F-5274-4565-ACC6-DA9B6E568B09} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} {4E4EE20C-F06A-4A1B-851F-C5577796941C} = {6ED356A7-8B47-4613-AD01-C85CF28491BD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/src/Infrastructure/Data/ApplicationDbContext.cs b/src/Infrastructure/Data/ApplicationDbContext.cs deleted file mode 100644 index ae691cb..0000000 --- a/src/Infrastructure/Data/ApplicationDbContext.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Hutopy.Infrastructure.Identity; -using Microsoft.AspNetCore.Identity.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; - -namespace Hutopy.Infrastructure.Data -{ - public class ApplicationDbContext( - DbContextOptions options) - : IdentityDbContext(options); -} diff --git a/src/Infrastructure/DependencyInjection.cs b/src/Infrastructure/DependencyInjection.cs deleted file mode 100644 index bffd9d3..0000000 --- a/src/Infrastructure/DependencyInjection.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Hutopy.Infrastructure.BlobStorage; -using Hutopy.Infrastructure.Data; -using Hutopy.Infrastructure.Identity; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Diagnostics; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace Hutopy.Infrastructure; - -public static class DependencyInjection -{ - public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, - IConfiguration configuration) - { - // Replace password in the connection string with env var in local environment. - // Prod will use the connectionString stored in the vault with password in it directly. - var connectionString = configuration.GetConnectionString("MssqlConnection") - ?? throw new InvalidOperationException("Missing ConnectionStrings:MssqlConnection"); - - services.AddDbContext((sp, options) => - { - options.AddInterceptors(sp.GetServices()); - options.UseSqlServer(connectionString); - }); - - services.AddScoped(); - - services.AddAuthentication() - .AddBearerToken(IdentityConstants.BearerScheme); - - services.AddAuthorizationBuilder(); - - services - .AddIdentityCore() - .AddUserManager() - .AddRoles() - .AddEntityFrameworkStores() - .AddApiEndpoints() - .AddSignInManager>() - .AddDefaultTokenProviders(); - - // Singleton services - services.AddSingleton(TimeProvider.System); - services.AddSingleton(); - - // Scoped services - services.AddScoped(); - - return services; - } -} diff --git a/src/Infrastructure/GlobalUsings.cs b/src/Infrastructure/GlobalUsings.cs deleted file mode 100644 index f176ce1..0000000 --- a/src/Infrastructure/GlobalUsings.cs +++ /dev/null @@ -1,4 +0,0 @@ -global using System; -global using System.Linq; -global using System.Threading; -global using System.Threading.Tasks; diff --git a/src/Infrastructure/Infrastructure.csproj b/src/Infrastructure/Infrastructure.csproj deleted file mode 100644 index 0967acf..0000000 --- a/src/Infrastructure/Infrastructure.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - Hutopy.Infrastructure - Hutopy.Infrastructure - - - - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - - - diff --git a/src/Infrastructure/Migrations/20240802044736_Initial.Designer.cs b/src/Infrastructure/Migrations/20240802044736_Initial.Designer.cs deleted file mode 100644 index ad817a1..0000000 --- a/src/Infrastructure/Migrations/20240802044736_Initial.Designer.cs +++ /dev/null @@ -1,444 +0,0 @@ -// -using System; -using Hutopy.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240802044736_Initial")] - partial class Initial - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Hutopy.Domain.Entities.FutureCreator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ReasonToJoin") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SocialNetworkAccount") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("FutureCreators"); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("ApplicationUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsConfirmed") - .HasColumnType("bit"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Paid") - .HasColumnType("bit"); - - b.Property("StripeBillingDetailEmail") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeBillingDetailName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeChargeId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeEventId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentIntent") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentMethod") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeReceiptUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TipMessage") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("UserTransactions"); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("Address") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Alias") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("BirthDate") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("City") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Country") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("FirstName") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("LastName") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("Occupation") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("PortraitUrl") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Migrations/20240802044736_Initial.cs b/src/Infrastructure/Migrations/20240802044736_Initial.cs deleted file mode 100644 index 5b50f9c..0000000 --- a/src/Infrastructure/Migrations/20240802044736_Initial.cs +++ /dev/null @@ -1,299 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AspNetRoles", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetUsers", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Alias = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - FirstName = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - LastName = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - Occupation = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - BirthDate = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - Country = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - City = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - Address = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - PortraitUrl = table.Column(type: "nvarchar(255)", maxLength: 255, nullable: true), - UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "bit", nullable: false), - PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), - SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), - ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), - PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), - TwoFactorEnabled = table.Column(type: "bit", nullable: false), - LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), - LockoutEnabled = table.Column(type: "bit", nullable: false), - AccessFailedCount = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "FutureCreators", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - FirstName = table.Column(type: "nvarchar(max)", nullable: false), - LastName = table.Column(type: "nvarchar(max)", nullable: false), - EmailAddress = table.Column(type: "nvarchar(max)", nullable: false), - PhoneNumber = table.Column(type: "nvarchar(max)", nullable: false), - SocialNetworkAccount = table.Column(type: "nvarchar(max)", nullable: false), - ReasonToJoin = table.Column(type: "nvarchar(max)", nullable: false), - CreatedAt = table.Column(type: "datetimeoffset", nullable: false), - CreatedBy = table.Column(type: "uniqueidentifier", nullable: true), - LastModifiedAt = table.Column(type: "datetimeoffset", nullable: false), - LastModifiedBy = table.Column(type: "uniqueidentifier", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_FutureCreators", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AspNetRoleClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - RoleId = table.Column(type: "uniqueidentifier", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserClaims", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UserId = table.Column(type: "uniqueidentifier", nullable: false), - ClaimType = table.Column(type: "nvarchar(max)", nullable: true), - ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AspNetUserClaims_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserLogins", - columns: table => new - { - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), - ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), - UserId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_AspNetUserLogins_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserRoles", - columns: table => new - { - UserId = table.Column(type: "uniqueidentifier", nullable: false), - RoleId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetRoles_RoleId", - column: x => x.RoleId, - principalTable: "AspNetRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AspNetUserRoles_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AspNetUserTokens", - columns: table => new - { - UserId = table.Column(type: "uniqueidentifier", nullable: false), - LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), - Name = table.Column(type: "nvarchar(450)", nullable: false), - Value = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AspNetUserTokens_AspNetUsers_UserId", - column: x => x.UserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserTransactions", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Amount = table.Column(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false), - Currency = table.Column(type: "nvarchar(max)", nullable: false), - TipMessage = table.Column(type: "nvarchar(max)", nullable: false), - ApplicationUserId = table.Column(type: "uniqueidentifier", nullable: false), - IsConfirmed = table.Column(type: "bit", nullable: false), - StripeEventId = table.Column(type: "nvarchar(max)", nullable: false), - StripeChargeId = table.Column(type: "nvarchar(max)", nullable: false), - StripePaymentIntent = table.Column(type: "nvarchar(max)", nullable: false), - StripePaymentMethod = table.Column(type: "nvarchar(max)", nullable: false), - StripeReceiptUrl = table.Column(type: "nvarchar(max)", nullable: false), - StripeBillingDetailEmail = table.Column(type: "nvarchar(max)", nullable: false), - StripeBillingDetailName = table.Column(type: "nvarchar(max)", nullable: false), - Paid = table.Column(type: "bit", nullable: false), - CreatedAt = table.Column(type: "datetimeoffset", nullable: false), - CreatedBy = table.Column(type: "uniqueidentifier", nullable: true), - LastModifiedAt = table.Column(type: "datetimeoffset", nullable: false), - LastModifiedBy = table.Column(type: "uniqueidentifier", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_UserTransactions", x => x.Id); - table.ForeignKey( - name: "FK_UserTransactions_AspNetUsers_ApplicationUserId", - column: x => x.ApplicationUserId, - principalTable: "AspNetUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AspNetRoleClaims_RoleId", - table: "AspNetRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - table: "AspNetRoles", - column: "NormalizedName", - unique: true, - filter: "[NormalizedName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserClaims_UserId", - table: "AspNetUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserLogins_UserId", - table: "AspNetUserLogins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AspNetUserRoles_RoleId", - table: "AspNetUserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - table: "AspNetUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - table: "AspNetUsers", - column: "NormalizedUserName", - unique: true, - filter: "[NormalizedUserName] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_UserTransactions_ApplicationUserId", - table: "UserTransactions", - column: "ApplicationUserId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AspNetRoleClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserClaims"); - - migrationBuilder.DropTable( - name: "AspNetUserLogins"); - - migrationBuilder.DropTable( - name: "AspNetUserRoles"); - - migrationBuilder.DropTable( - name: "AspNetUserTokens"); - - migrationBuilder.DropTable( - name: "FutureCreators"); - - migrationBuilder.DropTable( - name: "UserTransactions"); - - migrationBuilder.DropTable( - name: "AspNetRoles"); - - migrationBuilder.DropTable( - name: "AspNetUsers"); - } - } -} diff --git a/src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.Designer.cs b/src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.Designer.cs deleted file mode 100644 index fbdfc47..0000000 --- a/src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.Designer.cs +++ /dev/null @@ -1,436 +0,0 @@ -// -using System; -using Hutopy.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240903230821_ChangeBirthDateToDateTime")] - partial class ChangeBirthDateToDateTime - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Hutopy.Domain.Entities.FutureCreator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ReasonToJoin") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SocialNetworkAccount") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("FutureCreators"); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("ApplicationUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsConfirmed") - .HasColumnType("bit"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Paid") - .HasColumnType("bit"); - - b.Property("StripeBillingDetailEmail") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeBillingDetailName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeChargeId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeEventId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentIntent") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentMethod") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeReceiptUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TipMessage") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("UserTransactions"); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("Address") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Alias") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("BirthDate") - .HasMaxLength(255) - .HasColumnType("datetime2"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Firstname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Lastname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("Occupation") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("PortraitUrl") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.cs b/src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.cs deleted file mode 100644 index 6e94cdb..0000000 --- a/src/Infrastructure/Migrations/20240903230821_ChangeBirthDateToDateTime.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - /// - public partial class ChangeBirthDateToDateTime : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "City", - table: "AspNetUsers"); - - migrationBuilder.DropColumn( - name: "Country", - table: "AspNetUsers"); - - migrationBuilder.RenameColumn( - name: "LastName", - table: "AspNetUsers", - newName: "Lastname"); - - migrationBuilder.RenameColumn( - name: "FirstName", - table: "AspNetUsers", - newName: "Firstname"); - - migrationBuilder.AlterColumn( - name: "BirthDate", - table: "AspNetUsers", - type: "datetime2", - maxLength: 255, - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(255)", - oldMaxLength: 255, - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Lastname", - table: "AspNetUsers", - newName: "LastName"); - - migrationBuilder.RenameColumn( - name: "Firstname", - table: "AspNetUsers", - newName: "FirstName"); - - migrationBuilder.AlterColumn( - name: "BirthDate", - table: "AspNetUsers", - type: "nvarchar(255)", - maxLength: 255, - nullable: true, - oldClrType: typeof(DateTime), - oldType: "datetime2", - oldMaxLength: 255, - oldNullable: true); - - migrationBuilder.AddColumn( - name: "City", - table: "AspNetUsers", - type: "nvarchar(255)", - maxLength: 255, - nullable: true); - - migrationBuilder.AddColumn( - name: "Country", - table: "AspNetUsers", - type: "nvarchar(255)", - maxLength: 255, - nullable: true); - } - } -} diff --git a/src/Infrastructure/Migrations/20240903231429_RemoveOccupation.Designer.cs b/src/Infrastructure/Migrations/20240903231429_RemoveOccupation.Designer.cs deleted file mode 100644 index dd3ab98..0000000 --- a/src/Infrastructure/Migrations/20240903231429_RemoveOccupation.Designer.cs +++ /dev/null @@ -1,432 +0,0 @@ -// -using System; -using Hutopy.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240903231429_RemoveOccupation")] - partial class RemoveOccupation - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Hutopy.Domain.Entities.FutureCreator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ReasonToJoin") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SocialNetworkAccount") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("FutureCreators"); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("ApplicationUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsConfirmed") - .HasColumnType("bit"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Paid") - .HasColumnType("bit"); - - b.Property("StripeBillingDetailEmail") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeBillingDetailName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeChargeId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeEventId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentIntent") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentMethod") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeReceiptUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TipMessage") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("UserTransactions"); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("Address") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Alias") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("BirthDate") - .HasMaxLength(255) - .HasColumnType("datetime2"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Firstname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Lastname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("PortraitUrl") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Migrations/20240903231429_RemoveOccupation.cs b/src/Infrastructure/Migrations/20240903231429_RemoveOccupation.cs deleted file mode 100644 index c1cb1b0..0000000 --- a/src/Infrastructure/Migrations/20240903231429_RemoveOccupation.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - /// - public partial class RemoveOccupation : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Occupation", - table: "AspNetUsers"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Occupation", - table: "AspNetUsers", - type: "nvarchar(255)", - maxLength: 255, - nullable: true); - } - } -} diff --git a/src/Infrastructure/Migrations/20240924044131_AddGoogleId.Designer.cs b/src/Infrastructure/Migrations/20240924044131_AddGoogleId.Designer.cs deleted file mode 100644 index 9eb0111..0000000 --- a/src/Infrastructure/Migrations/20240924044131_AddGoogleId.Designer.cs +++ /dev/null @@ -1,435 +0,0 @@ -// -using System; -using Hutopy.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20240924044131_AddGoogleId")] - partial class AddGoogleId - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Hutopy.Domain.Entities.FutureCreator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ReasonToJoin") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SocialNetworkAccount") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("FutureCreators"); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("ApplicationUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsConfirmed") - .HasColumnType("bit"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Paid") - .HasColumnType("bit"); - - b.Property("StripeBillingDetailEmail") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeBillingDetailName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeChargeId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeEventId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentIntent") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentMethod") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeReceiptUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TipMessage") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("UserTransactions"); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("Address") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Alias") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime2"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Firstname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("GoogleId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Lastname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("PortraitUrl") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/Migrations/20240924044131_AddGoogleId.cs b/src/Infrastructure/Migrations/20240924044131_AddGoogleId.cs deleted file mode 100644 index 9e71d45..0000000 --- a/src/Infrastructure/Migrations/20240924044131_AddGoogleId.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - /// - public partial class AddGoogleId : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "GoogleId", - table: "AspNetUsers", - type: "nvarchar(255)", - maxLength: 255, - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "GoogleId", - table: "AspNetUsers"); - } - } -} diff --git a/src/Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs deleted file mode 100644 index 7d39e2d..0000000 --- a/src/Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs +++ /dev/null @@ -1,432 +0,0 @@ -// -using System; -using Hutopy.Infrastructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Hutopy.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - partial class ApplicationDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Hutopy.Domain.Entities.FutureCreator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("EmailAddress") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ReasonToJoin") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SocialNetworkAccount") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("FutureCreators"); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("ApplicationUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Currency") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IsConfirmed") - .HasColumnType("bit"); - - b.Property("LastModifiedAt") - .HasColumnType("datetimeoffset"); - - b.Property("LastModifiedBy") - .HasColumnType("uniqueidentifier"); - - b.Property("Paid") - .HasColumnType("bit"); - - b.Property("StripeBillingDetailEmail") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeBillingDetailName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeChargeId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeEventId") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentIntent") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripePaymentMethod") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("StripeReceiptUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("TipMessage") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("ApplicationUserId"); - - b.ToTable("UserTransactions"); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex") - .HasFilter("[NormalizedName] IS NOT NULL"); - - b.ToTable("AspNetRoles", (string)null); - }); - - modelBuilder.Entity("Hutopy.Infrastructure.Identity.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .HasColumnType("int"); - - b.Property("Address") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Alias") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("BirthDate") - .HasColumnType("datetime2"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("bit"); - - b.Property("Firstname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("GoogleId") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("Lastname") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("LockoutEnabled") - .HasColumnType("bit"); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("PasswordHash") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumber") - .HasColumnType("nvarchar(max)"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("bit"); - - b.Property("PortraitUrl") - .HasMaxLength(255) - .HasColumnType("nvarchar(255)"); - - b.Property("SecurityStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("TwoFactorEnabled") - .HasColumnType("bit"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex") - .HasFilter("[NormalizedUserName] IS NOT NULL"); - - b.ToTable("AspNetUsers", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetRoleClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("nvarchar(max)"); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserClaims", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(450)"); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(max)"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("AspNetUserLogins", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("AspNetUserRoles", (string)null); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .HasColumnType("nvarchar(450)"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AspNetUserTokens", (string)null); - }); - - modelBuilder.Entity("Hutopy.Domain.Entities.UserTransaction", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("ApplicationUserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("Hutopy.Infrastructure.Identity.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infrastructure/BlobStorage/AzureBlobStorage.cs b/src/Web/Common/BlobStorage/AzureBlobStorage.cs similarity index 97% rename from src/Infrastructure/BlobStorage/AzureBlobStorage.cs rename to src/Web/Common/BlobStorage/AzureBlobStorage.cs index fdf6fe9..0814f05 100644 --- a/src/Infrastructure/BlobStorage/AzureBlobStorage.cs +++ b/src/Web/Common/BlobStorage/AzureBlobStorage.cs @@ -1,10 +1,8 @@ using Azure; using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; -namespace Hutopy.Infrastructure.BlobStorage; +namespace Hutopy.Web.Common.BlobStorage; public class AzureBlobStorage { diff --git a/src/Infrastructure/BlobStorage/BlobStructure.txt b/src/Web/Common/BlobStorage/BlobStructure.txt similarity index 100% rename from src/Infrastructure/BlobStorage/BlobStructure.txt rename to src/Web/Common/BlobStorage/BlobStructure.txt diff --git a/src/Infrastructure/BlobStorage/CommonFileNames.cs b/src/Web/Common/BlobStorage/CommonFileNames.cs similarity index 76% rename from src/Infrastructure/BlobStorage/CommonFileNames.cs rename to src/Web/Common/BlobStorage/CommonFileNames.cs index 7b40a7d..5d93f5b 100644 --- a/src/Infrastructure/BlobStorage/CommonFileNames.cs +++ b/src/Web/Common/BlobStorage/CommonFileNames.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.BlobStorage; +namespace Hutopy.Web.Common.BlobStorage; public static class CommonFileNames { diff --git a/src/Infrastructure/BlobStorage/ContainerNames.cs b/src/Web/Common/BlobStorage/ContainerNames.cs similarity index 72% rename from src/Infrastructure/BlobStorage/ContainerNames.cs rename to src/Web/Common/BlobStorage/ContainerNames.cs index 7319810..faedbe3 100644 --- a/src/Infrastructure/BlobStorage/ContainerNames.cs +++ b/src/Web/Common/BlobStorage/ContainerNames.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.BlobStorage; +namespace Hutopy.Web.Common.BlobStorage; public static class ContainerNames { diff --git a/src/Infrastructure/BlobStorage/ContentTypes.cs b/src/Web/Common/BlobStorage/ContentTypes.cs similarity index 95% rename from src/Infrastructure/BlobStorage/ContentTypes.cs rename to src/Web/Common/BlobStorage/ContentTypes.cs index 7ce942e..438a2aa 100644 --- a/src/Infrastructure/BlobStorage/ContentTypes.cs +++ b/src/Web/Common/BlobStorage/ContentTypes.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.BlobStorage; +namespace Hutopy.Web.Common.BlobStorage; public static class ContentTypes { diff --git a/src/Infrastructure/BlobStorage/SubDirectoryNames.cs b/src/Web/Common/BlobStorage/SubDirectoryNames.cs similarity index 74% rename from src/Infrastructure/BlobStorage/SubDirectoryNames.cs rename to src/Web/Common/BlobStorage/SubDirectoryNames.cs index 1bb509d..b99383e 100644 --- a/src/Infrastructure/BlobStorage/SubDirectoryNames.cs +++ b/src/Web/Common/BlobStorage/SubDirectoryNames.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.BlobStorage; +namespace Hutopy.Web.Common.BlobStorage; public static class SubDirectoryNames { diff --git a/src/Web/Common/ClaimsPrincipalExtensions.cs b/src/Web/Common/Security/ClaimsPrincipalExtensions.cs similarity index 96% rename from src/Web/Common/ClaimsPrincipalExtensions.cs rename to src/Web/Common/Security/ClaimsPrincipalExtensions.cs index d633d6c..d655e9e 100644 --- a/src/Web/Common/ClaimsPrincipalExtensions.cs +++ b/src/Web/Common/Security/ClaimsPrincipalExtensions.cs @@ -1,7 +1,6 @@ using System.Security.Claims; -using Hutopy.Infrastructure.Utils; -namespace Hutopy.Web.Common; +namespace Hutopy.Web.Common.Security; public static class ClaimsPrincipalExtensions { diff --git a/src/Infrastructure/Utils/GenerateJwtToken.cs b/src/Web/Common/Security/GenerateJwtToken.cs similarity index 97% rename from src/Infrastructure/Utils/GenerateJwtToken.cs rename to src/Web/Common/Security/GenerateJwtToken.cs index d2120b8..ed301b6 100644 --- a/src/Infrastructure/Utils/GenerateJwtToken.cs +++ b/src/Web/Common/Security/GenerateJwtToken.cs @@ -3,7 +3,7 @@ using System.Security.Claims; using System.Text; using Microsoft.IdentityModel.Tokens; -namespace Hutopy.Infrastructure.Utils; +namespace Hutopy.Web.Common.Security; public static class JwtTokenHelper { diff --git a/src/Infrastructure/Utils/KnownClaims.cs b/src/Web/Common/Security/KnownClaims.cs similarity index 77% rename from src/Infrastructure/Utils/KnownClaims.cs rename to src/Web/Common/Security/KnownClaims.cs index 21d44e2..9c33719 100644 --- a/src/Infrastructure/Utils/KnownClaims.cs +++ b/src/Web/Common/Security/KnownClaims.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.Utils; +namespace Hutopy.Web.Common.Security; public static class KnownClaims { diff --git a/src/Web/Common/MissingClaimException.cs b/src/Web/Common/Security/MissingClaimException.cs similarity index 66% rename from src/Web/Common/MissingClaimException.cs rename to src/Web/Common/Security/MissingClaimException.cs index 258fbcd..f2b6126 100644 --- a/src/Web/Common/MissingClaimException.cs +++ b/src/Web/Common/Security/MissingClaimException.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Web.Common; +namespace Hutopy.Web.Common.Security; public class MissingClaimException( string claimName) diff --git a/src/Infrastructure/Utils/PasswordGenerator.cs b/src/Web/Common/Security/PasswordGenerator.cs similarity index 96% rename from src/Infrastructure/Utils/PasswordGenerator.cs rename to src/Web/Common/Security/PasswordGenerator.cs index 7901a7f..e4ee290 100644 --- a/src/Infrastructure/Utils/PasswordGenerator.cs +++ b/src/Web/Common/Security/PasswordGenerator.cs @@ -1,9 +1,9 @@ using System.Text; -namespace Hutopy.Infrastructure.Utils; +namespace Hutopy.Web.Common.Security; // If we need to add special characters we can alternate between 2 pools. -public class PasswordGenerator +public static class PasswordGenerator { private const string LowerLetters = "abcdefghijklmnopqrstuvwxyz"; private const string UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/src/Web/Controllers/FacebookController.cs b/src/Web/Controllers/FacebookController.cs index bae7799..d05c3f3 100644 --- a/src/Web/Controllers/FacebookController.cs +++ b/src/Web/Controllers/FacebookController.cs @@ -1,6 +1,7 @@ using System.Security.Claims; -using Hutopy.Infrastructure.Identity; -using Hutopy.Infrastructure.Utils; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; +using Hutopy.Web.Features.Users; using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Facebook; diff --git a/src/Web/DependencyInjection.cs b/src/Web/DependencyInjection.cs index 1ce13a2..cdc4275 100644 --- a/src/Web/DependencyInjection.cs +++ b/src/Web/DependencyInjection.cs @@ -1,6 +1,6 @@ using System.Text; using Azure.Identity; -using Hutopy.Infrastructure.Data; +using Hutopy.Web.Features.Users.Data; using Microsoft.AspNetCore.Authentication.Cookies; using Microsoft.AspNetCore.Authentication.Facebook; using Microsoft.AspNetCore.Authentication.Google; diff --git a/src/Web/Features/Contents/Data/ContentDbContext.cs b/src/Web/Features/Contents/Data/ContentDbContext.cs index 94b88ea..eb03f89 100644 --- a/src/Web/Features/Contents/Data/ContentDbContext.cs +++ b/src/Web/Features/Contents/Data/ContentDbContext.cs @@ -1,6 +1,4 @@ -using Humanizer; - -namespace Hutopy.Web.Features.Contents.Data; +namespace Hutopy.Web.Features.Contents.Data; public class ContentDbContext( DbContextOptions options) @@ -31,7 +29,7 @@ public class ContentDbContext( modelBuilder .Entity() .OwnsMany(c => c.Reactions) - .ToTable(nameof(ContentReaction).Pluralize()); + .ToTable("Reactions"); modelBuilder .Entity() diff --git a/src/Web/Features/Contents/Data/ContentReaction.cs b/src/Web/Features/Contents/Data/ContentReaction.cs index 475bc86..eec8fe4 100644 --- a/src/Web/Features/Contents/Data/ContentReaction.cs +++ b/src/Web/Features/Contents/Data/ContentReaction.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using Hutopy.Web.Features.Contents.Handlers.Enums; +using Hutopy.Web.Features.Contents.Data.Enums; namespace Hutopy.Web.Features.Contents.Data; diff --git a/src/Web/Features/Contents/Data/Enums/Reaction.cs b/src/Web/Features/Contents/Data/Enums/Reaction.cs index 1e898db..4617ffa 100644 --- a/src/Web/Features/Contents/Data/Enums/Reaction.cs +++ b/src/Web/Features/Contents/Data/Enums/Reaction.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Web.Features.Contents.Handlers.Enums; +namespace Hutopy.Web.Features.Contents.Data.Enums; public enum Reaction { diff --git a/src/Web/Features/Contents/Migrations/20240806065219_Initial.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20240806065219_Initial.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240806065219_Initial.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20240806065219_Initial.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20240806065219_Initial.cs b/src/Web/Features/Contents/Data/Migrations/20240806065219_Initial.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240806065219_Initial.cs rename to src/Web/Features/Contents/Data/Migrations/20240806065219_Initial.cs diff --git a/src/Web/Features/Contents/Migrations/20240816212531_AddsSoftDelete.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20240816212531_AddsSoftDelete.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240816212531_AddsSoftDelete.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20240816212531_AddsSoftDelete.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20240816212531_AddsSoftDelete.cs b/src/Web/Features/Contents/Data/Migrations/20240816212531_AddsSoftDelete.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240816212531_AddsSoftDelete.cs rename to src/Web/Features/Contents/Data/Migrations/20240816212531_AddsSoftDelete.cs diff --git a/src/Web/Features/Contents/Migrations/20240824185551_AddReactionToContent.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20240824185551_AddReactionToContent.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240824185551_AddReactionToContent.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20240824185551_AddReactionToContent.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20240824185551_AddReactionToContent.cs b/src/Web/Features/Contents/Data/Migrations/20240824185551_AddReactionToContent.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240824185551_AddReactionToContent.cs rename to src/Web/Features/Contents/Data/Migrations/20240824185551_AddReactionToContent.cs diff --git a/src/Web/Features/Contents/Migrations/20240919045548_UseMeterialColorSchema.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20240919045548_UseMeterialColorSchema.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240919045548_UseMeterialColorSchema.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20240919045548_UseMeterialColorSchema.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20240919045548_UseMeterialColorSchema.cs b/src/Web/Features/Contents/Data/Migrations/20240919045548_UseMeterialColorSchema.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240919045548_UseMeterialColorSchema.cs rename to src/Web/Features/Contents/Data/Migrations/20240919045548_UseMeterialColorSchema.cs diff --git a/src/Web/Features/Contents/Migrations/20240919051151_NoMoreOptionalColors.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20240919051151_NoMoreOptionalColors.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240919051151_NoMoreOptionalColors.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20240919051151_NoMoreOptionalColors.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20240919051151_NoMoreOptionalColors.cs b/src/Web/Features/Contents/Data/Migrations/20240919051151_NoMoreOptionalColors.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240919051151_NoMoreOptionalColors.cs rename to src/Web/Features/Contents/Data/Migrations/20240919051151_NoMoreOptionalColors.cs diff --git a/src/Web/Features/Contents/Migrations/20240922064815_RemovesAboutAddsTitle.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20240922064815_RemovesAboutAddsTitle.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240922064815_RemovesAboutAddsTitle.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20240922064815_RemovesAboutAddsTitle.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20240922064815_RemovesAboutAddsTitle.cs b/src/Web/Features/Contents/Data/Migrations/20240922064815_RemovesAboutAddsTitle.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20240922064815_RemovesAboutAddsTitle.cs rename to src/Web/Features/Contents/Data/Migrations/20240922064815_RemovesAboutAddsTitle.cs diff --git a/src/Web/Features/Contents/Migrations/20241011103653_FromSubscribersToFollowers.Designer.cs b/src/Web/Features/Contents/Data/Migrations/20241011103653_FromSubscribersToFollowers.Designer.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20241011103653_FromSubscribersToFollowers.Designer.cs rename to src/Web/Features/Contents/Data/Migrations/20241011103653_FromSubscribersToFollowers.Designer.cs diff --git a/src/Web/Features/Contents/Migrations/20241011103653_FromSubscribersToFollowers.cs b/src/Web/Features/Contents/Data/Migrations/20241011103653_FromSubscribersToFollowers.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/20241011103653_FromSubscribersToFollowers.cs rename to src/Web/Features/Contents/Data/Migrations/20241011103653_FromSubscribersToFollowers.cs diff --git a/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs b/src/Web/Features/Contents/Data/Migrations/ContentDbContextModelSnapshot.cs similarity index 100% rename from src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs rename to src/Web/Features/Contents/Data/Migrations/ContentDbContextModelSnapshot.cs diff --git a/src/Web/Features/Contents/Handlers/AddReaction.cs b/src/Web/Features/Contents/Handlers/AddReaction.cs index 7097c36..301f200 100644 --- a/src/Web/Features/Contents/Handlers/AddReaction.cs +++ b/src/Web/Features/Contents/Handlers/AddReaction.cs @@ -1,6 +1,6 @@ using Hutopy.Web.Extensions; using Hutopy.Web.Features.Contents.Data; -using Hutopy.Web.Features.Contents.Handlers.Enums; +using Hutopy.Web.Features.Contents.Data.Enums; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Handlers/ChangeBanner.cs b/src/Web/Features/Contents/Handlers/ChangeBanner.cs index 8c51ddd..04b8cb4 100644 --- a/src/Web/Features/Contents/Handlers/ChangeBanner.cs +++ b/src/Web/Features/Contents/Handlers/ChangeBanner.cs @@ -1,4 +1,4 @@ -using Hutopy.Infrastructure.BlobStorage; +using Hutopy.Web.Common.BlobStorage; using Hutopy.Web.Features.Contents.Data; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Handlers/ChangeLogo.cs b/src/Web/Features/Contents/Handlers/ChangeLogo.cs index 5d987c9..80deb04 100644 --- a/src/Web/Features/Contents/Handlers/ChangeLogo.cs +++ b/src/Web/Features/Contents/Handlers/ChangeLogo.cs @@ -1,4 +1,4 @@ -using Hutopy.Infrastructure.BlobStorage; +using Hutopy.Web.Common.BlobStorage; using Hutopy.Web.Features.Contents.Data; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Handlers/CreateContent.cs b/src/Web/Features/Contents/Handlers/CreateContent.cs index e139c44..d89f5e7 100644 --- a/src/Web/Features/Contents/Handlers/CreateContent.cs +++ b/src/Web/Features/Contents/Handlers/CreateContent.cs @@ -1,6 +1,7 @@ using System.Collections.Concurrent; -using Hutopy.Infrastructure.BlobStorage; using Hutopy.Web.Common; +using Hutopy.Web.Common.BlobStorage; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; using Hutopy.Web.Features.Contents.Handlers.Models; diff --git a/src/Web/Features/Contents/Handlers/CreateCreator.cs b/src/Web/Features/Contents/Handlers/CreateCreator.cs index 12cf41d..07b5db3 100644 --- a/src/Web/Features/Contents/Handlers/CreateCreator.cs +++ b/src/Web/Features/Contents/Handlers/CreateCreator.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Handlers/DeleteContent.cs b/src/Web/Features/Contents/Handlers/DeleteContent.cs index eb5b512..26e37e2 100644 --- a/src/Web/Features/Contents/Handlers/DeleteContent.cs +++ b/src/Web/Features/Contents/Handlers/DeleteContent.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Handlers/FollowCreator.cs b/src/Web/Features/Contents/Handlers/FollowCreator.cs index 3386046..3025b0c 100644 --- a/src/Web/Features/Contents/Handlers/FollowCreator.cs +++ b/src/Web/Features/Contents/Handlers/FollowCreator.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; using Hutopy.Web.Features.Contents.Handlers.Models; diff --git a/src/Web/Features/Contents/Handlers/GetCreatorProfile.cs b/src/Web/Features/Contents/Handlers/GetCreatorProfile.cs index 67dd5cb..cb27ca4 100644 --- a/src/Web/Features/Contents/Handlers/GetCreatorProfile.cs +++ b/src/Web/Features/Contents/Handlers/GetCreatorProfile.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Handlers/GetFollowedCreators.cs b/src/Web/Features/Contents/Handlers/GetFollowedCreators.cs index 6ab7f52..c8560fd 100644 --- a/src/Web/Features/Contents/Handlers/GetFollowedCreators.cs +++ b/src/Web/Features/Contents/Handlers/GetFollowedCreators.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; using Hutopy.Web.Features.Contents.Handlers.Models; diff --git a/src/Web/Features/Contents/Handlers/UnfollowCreator.cs b/src/Web/Features/Contents/Handlers/UnfollowCreator.cs index a4d9669..66b7cbf 100644 --- a/src/Web/Features/Contents/Handlers/UnfollowCreator.cs +++ b/src/Web/Features/Contents/Handlers/UnfollowCreator.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Contents.Data; namespace Hutopy.Web.Features.Contents.Handlers; diff --git a/src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.Designer.cs b/src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.Designer.cs deleted file mode 100644 index 40fc57e..0000000 --- a/src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.Designer.cs +++ /dev/null @@ -1,313 +0,0 @@ -// -using System; -using Hutopy.Web.Features.Contents.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Hutopy.Web.Features.Contents.Migrations -{ - [DbContext(typeof(ContentDbContext))] - [Migration("20241012183354_AddHtmlFileUrl")] - partial class AddHtmlFileUrl - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("Content") - .HasAnnotation("ProductVersion", "8.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone") - .HasDefaultValueSql("CURRENT_TIMESTAMP"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("DeletedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("DeletedBy") - .HasColumnType("uuid"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(2048) - .HasColumnType("character varying(2048)"); - - b.Property("HtmlFileUrl") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b.Property("Urls") - .HasColumnType("text[]"); - - b.HasKey("Id"); - - b.HasIndex("CreatedBy"); - - b.ToTable("Contents", "Content"); - }); - - modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.Property("Title") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b.HasKey("Id"); - - b.ToTable("Creators", "Content"); - }); - - modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b => - { - b.Property("CreatedBy") - .HasColumnType("uuid"); - - b.Property("CreatorId") - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp with time zone"); - - b.HasKey("CreatedBy", "CreatorId"); - - b.HasIndex("CreatorId"); - - b.ToTable("Subscriptions", "Content"); - }); - - modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b => - { - b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator") - .WithMany() - .HasForeignKey("CreatedBy") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 => - { - b1.Property("ContentId") - .HasColumnType("uuid"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); - - b1.Property("Reaction") - .HasColumnType("integer"); - - b1.Property("UserId") - .HasColumnType("uuid"); - - b1.Property("UserName") - .IsRequired() - .HasMaxLength(128) - .HasColumnType("character varying(128)"); - - b1.HasKey("ContentId", "Id"); - - b1.ToTable("ContentReactions", "Content"); - - b1.WithOwner() - .HasForeignKey("ContentId"); - }); - - b.Navigation("Creator"); - - b.Navigation("Reactions"); - }); - - modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => - { - b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 => - { - b1.Property("CreatorId") - .HasColumnType("uuid"); - - b1.Property("Background") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("Error") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("OnBackground") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("OnError") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("OnPrimary") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("OnSecondary") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("OnSurface") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("Primary") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("Secondary") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.Property("Surface") - .IsRequired() - .HasMaxLength(9) - .HasColumnType("character varying(9)"); - - b1.HasKey("CreatorId"); - - b1.ToTable("Colors", "Content"); - - b1.WithOwner() - .HasForeignKey("CreatorId"); - }); - - b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 => - { - b1.Property("CreatorId") - .HasColumnType("uuid"); - - b1.Property("Banner") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("Logo") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.HasKey("CreatorId"); - - b1.ToTable("Images", "Content"); - - b1.WithOwner() - .HasForeignKey("CreatorId"); - }); - - b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 => - { - b1.Property("CreatorId") - .HasColumnType("uuid"); - - b1.Property("FacebookUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("InstagramUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("LinkedInUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("RedditUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("TikTokUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("WebsiteUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("XUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.Property("YoutubeUrl") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); - - b1.HasKey("CreatorId"); - - b1.ToTable("Socials", "Content"); - - b1.WithOwner() - .HasForeignKey("CreatorId"); - }); - - b.Navigation("Colors") - .IsRequired(); - - b.Navigation("Images") - .IsRequired(); - - b.Navigation("Socials") - .IsRequired(); - }); - - modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b => - { - b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator") - .WithMany() - .HasForeignKey("CreatorId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Creator"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.cs b/src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.cs deleted file mode 100644 index 25593d2..0000000 --- a/src/Web/Features/Contents/Migrations/20241012183354_AddHtmlFileUrl.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Hutopy.Web.Features.Contents.Migrations -{ - /// - public partial class AddHtmlFileUrl : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "HtmlFileUrl", - schema: "Content", - table: "Contents", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "HtmlFileUrl", - schema: "Content", - table: "Contents"); - } - } -} diff --git a/src/Web/Features/Memberships/Migrations/20241011100852_Initial.Designer.cs b/src/Web/Features/Memberships/Data/Migrations/20241011100852_Initial.Designer.cs similarity index 100% rename from src/Web/Features/Memberships/Migrations/20241011100852_Initial.Designer.cs rename to src/Web/Features/Memberships/Data/Migrations/20241011100852_Initial.Designer.cs diff --git a/src/Web/Features/Memberships/Migrations/20241011100852_Initial.cs b/src/Web/Features/Memberships/Data/Migrations/20241011100852_Initial.cs similarity index 100% rename from src/Web/Features/Memberships/Migrations/20241011100852_Initial.cs rename to src/Web/Features/Memberships/Data/Migrations/20241011100852_Initial.cs diff --git a/src/Web/Features/Memberships/Migrations/MembershipDbContextModelSnapshot.cs b/src/Web/Features/Memberships/Data/Migrations/MembershipDbContextModelSnapshot.cs similarity index 100% rename from src/Web/Features/Memberships/Migrations/MembershipDbContextModelSnapshot.cs rename to src/Web/Features/Memberships/Data/Migrations/MembershipDbContextModelSnapshot.cs diff --git a/src/Web/Features/Memberships/Handlers/GetActiveSubscriptions.cs b/src/Web/Features/Memberships/Handlers/GetActiveSubscriptions.cs index ddca0c7..ffff3c4 100644 --- a/src/Web/Features/Memberships/Handlers/GetActiveSubscriptions.cs +++ b/src/Web/Features/Memberships/Handlers/GetActiveSubscriptions.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Memberships.Data; namespace Hutopy.Web.Features.Memberships.Handlers; diff --git a/src/Web/Features/Memberships/Handlers/GetReceivedTips.cs b/src/Web/Features/Memberships/Handlers/GetReceivedTips.cs index 7e5e606..e40992b 100644 --- a/src/Web/Features/Memberships/Handlers/GetReceivedTips.cs +++ b/src/Web/Features/Memberships/Handlers/GetReceivedTips.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Memberships.Data; namespace Hutopy.Web.Features.Memberships.Handlers; diff --git a/src/Web/Features/Memberships/Handlers/GetSentTips.cs b/src/Web/Features/Memberships/Handlers/GetSentTips.cs index a37af32..70c1b52 100644 --- a/src/Web/Features/Memberships/Handlers/GetSentTips.cs +++ b/src/Web/Features/Memberships/Handlers/GetSentTips.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Memberships.Data; namespace Hutopy.Web.Features.Memberships.Handlers; diff --git a/src/Web/Features/Memberships/Handlers/SendTip.cs b/src/Web/Features/Memberships/Handlers/SendTip.cs index 9b59761..b2a961c 100644 --- a/src/Web/Features/Memberships/Handlers/SendTip.cs +++ b/src/Web/Features/Memberships/Handlers/SendTip.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Memberships.Data; using Hutopy.Web.Features.Memberships.Services; diff --git a/src/Web/Features/Memberships/Handlers/SubscribeToCreator.cs b/src/Web/Features/Memberships/Handlers/SubscribeToCreator.cs index a006f1a..9b394ef 100644 --- a/src/Web/Features/Memberships/Handlers/SubscribeToCreator.cs +++ b/src/Web/Features/Memberships/Handlers/SubscribeToCreator.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Memberships.Data; using Hutopy.Web.Features.Memberships.Services; diff --git a/src/Web/Features/Messages/Migrations/20240805012343_Initial.Designer.cs b/src/Web/Features/Messages/Data/Migrations/20240805012343_Initial.Designer.cs similarity index 100% rename from src/Web/Features/Messages/Migrations/20240805012343_Initial.Designer.cs rename to src/Web/Features/Messages/Data/Migrations/20240805012343_Initial.Designer.cs diff --git a/src/Web/Features/Messages/Migrations/20240805012343_Initial.cs b/src/Web/Features/Messages/Data/Migrations/20240805012343_Initial.cs similarity index 100% rename from src/Web/Features/Messages/Migrations/20240805012343_Initial.cs rename to src/Web/Features/Messages/Data/Migrations/20240805012343_Initial.cs diff --git a/src/Web/Features/Messages/Migrations/MessagingDbContextModelSnapshot.cs b/src/Web/Features/Messages/Data/Migrations/MessagingDbContextModelSnapshot.cs similarity index 100% rename from src/Web/Features/Messages/Migrations/MessagingDbContextModelSnapshot.cs rename to src/Web/Features/Messages/Data/Migrations/MessagingDbContextModelSnapshot.cs diff --git a/src/Web/Features/Messages/Handlers/AddMessage.cs b/src/Web/Features/Messages/Handlers/AddMessage.cs index 84131a4..e2f8f5b 100644 --- a/src/Web/Features/Messages/Handlers/AddMessage.cs +++ b/src/Web/Features/Messages/Handlers/AddMessage.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Messages.Data; namespace Hutopy.Web.Features.Messages.Handlers; diff --git a/src/Web/Features/Messages/Handlers/AddReply.cs b/src/Web/Features/Messages/Handlers/AddReply.cs index b1c7aa8..04f086a 100644 --- a/src/Web/Features/Messages/Handlers/AddReply.cs +++ b/src/Web/Features/Messages/Handlers/AddReply.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Messages.Data; namespace Hutopy.Web.Features.Messages.Handlers; diff --git a/src/Web/Features/Messages/Handlers/ChangeMessage.cs b/src/Web/Features/Messages/Handlers/ChangeMessage.cs index 0889af9..d151416 100644 --- a/src/Web/Features/Messages/Handlers/ChangeMessage.cs +++ b/src/Web/Features/Messages/Handlers/ChangeMessage.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Messages.Data; namespace Hutopy.Web.Features.Messages.Handlers; diff --git a/src/Web/Features/Messages/Handlers/DeleteMessage.cs b/src/Web/Features/Messages/Handlers/DeleteMessage.cs index dc5a9f0..a95f8e5 100644 --- a/src/Web/Features/Messages/Handlers/DeleteMessage.cs +++ b/src/Web/Features/Messages/Handlers/DeleteMessage.cs @@ -1,4 +1,5 @@ using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Hutopy.Web.Features.Messages.Data; namespace Hutopy.Web.Features.Messages.Handlers; diff --git a/src/Infrastructure/Identity/ApplicationRole.cs b/src/Web/Features/Users/ApplicationRole.cs similarity index 82% rename from src/Infrastructure/Identity/ApplicationRole.cs rename to src/Web/Features/Users/ApplicationRole.cs index 4f90614..f93aa61 100644 --- a/src/Infrastructure/Identity/ApplicationRole.cs +++ b/src/Web/Features/Users/ApplicationRole.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Identity; -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public class ApplicationRole : IdentityRole { diff --git a/src/Infrastructure/Identity/ApplicationUser.cs b/src/Web/Features/Users/ApplicationUser.cs similarity index 92% rename from src/Infrastructure/Identity/ApplicationUser.cs rename to src/Web/Features/Users/ApplicationUser.cs index 5ed71b2..e3eea1e 100644 --- a/src/Infrastructure/Identity/ApplicationUser.cs +++ b/src/Web/Features/Users/ApplicationUser.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Identity; -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public class ApplicationUser : IdentityUser { diff --git a/src/Infrastructure/Identity/ApplicationUserManager.cs b/src/Web/Features/Users/ApplicationUserManager.cs similarity index 90% rename from src/Infrastructure/Identity/ApplicationUserManager.cs rename to src/Web/Features/Users/ApplicationUserManager.cs index 1799bbc..8c7a234 100644 --- a/src/Infrastructure/Identity/ApplicationUserManager.cs +++ b/src/Web/Features/Users/ApplicationUserManager.cs @@ -1,8 +1,7 @@ using Microsoft.AspNetCore.Identity; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public sealed class ApplicationUserManager( IUserStore store, diff --git a/src/Web/Features/Users/Data/ApplicationDbContext.cs b/src/Web/Features/Users/Data/ApplicationDbContext.cs new file mode 100644 index 0000000..51a9146 --- /dev/null +++ b/src/Web/Features/Users/Data/ApplicationDbContext.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Identity.EntityFrameworkCore; + +namespace Hutopy.Web.Features.Users.Data +{ + public class ApplicationDbContext( + DbContextOptions options) + : IdentityDbContext(options) + { + public const string SchemaName = "Identity"; + protected override void OnModelCreating(ModelBuilder + modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.HasDefaultSchema(SchemaName); + } + + } +} diff --git a/src/Infrastructure/Data/ApplicationDbContextInitializer.cs b/src/Web/Features/Users/Data/ApplicationDbContextInitializer.cs similarity index 85% rename from src/Infrastructure/Data/ApplicationDbContextInitializer.cs rename to src/Web/Features/Users/Data/ApplicationDbContextInitializer.cs index 5b89257..acca6cb 100644 --- a/src/Infrastructure/Data/ApplicationDbContextInitializer.cs +++ b/src/Web/Features/Users/Data/ApplicationDbContextInitializer.cs @@ -1,11 +1,6 @@ -using Hutopy.Infrastructure.Identity; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Identity; -namespace Hutopy.Infrastructure.Data; +namespace Hutopy.Web.Features.Users.Data; public static class InitializerExtensions { diff --git a/src/Web/Features/Users/Data/Migrations/20241020183421_Initial.Designer.cs b/src/Web/Features/Users/Data/Migrations/20241020183421_Initial.Designer.cs new file mode 100644 index 0000000..166eaf8 --- /dev/null +++ b/src/Web/Features/Users/Data/Migrations/20241020183421_Initial.Designer.cs @@ -0,0 +1,304 @@ +// +using System; +using Hutopy.Web.Features.Users.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Hutopy.Web.Features.Users.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20241020183421_Initial")] + partial class Initial + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Identity") + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Hutopy.Web.Features.Users.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", "Identity"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Users.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("Address") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Alias") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("BirthDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("Firstname") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("GoogleId") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Lastname") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("PortraitUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Web/Features/Users/Data/Migrations/20241020183421_Initial.cs b/src/Web/Features/Users/Data/Migrations/20241020183421_Initial.cs new file mode 100644 index 0000000..76dd942 --- /dev/null +++ b/src/Web/Features/Users/Data/Migrations/20241020183421_Initial.cs @@ -0,0 +1,260 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Hutopy.Web.Features.Users.Data.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "Identity"); + + migrationBuilder.CreateTable( + name: "AspNetRoles", + schema: "Identity", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + schema: "Identity", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Alias = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + Firstname = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + Lastname = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + BirthDate = table.Column(type: "timestamp with time zone", nullable: true), + Address = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + PortraitUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + GoogleId = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + schema: "Identity", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + RoleId = table.Column(type: "uuid", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalSchema: "Identity", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + schema: "Identity", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "uuid", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "Identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + schema: "Identity", + columns: table => new + { + LoginProvider = table.Column(type: "text", nullable: false), + ProviderKey = table.Column(type: "text", nullable: false), + ProviderDisplayName = table.Column(type: "text", nullable: true), + UserId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "Identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + schema: "Identity", + columns: table => new + { + UserId = table.Column(type: "uuid", nullable: false), + RoleId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalSchema: "Identity", + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "Identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + schema: "Identity", + columns: table => new + { + UserId = table.Column(type: "uuid", nullable: false), + LoginProvider = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalSchema: "Identity", + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + schema: "Identity", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + schema: "Identity", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + schema: "Identity", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + schema: "Identity", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + schema: "Identity", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + schema: "Identity", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + schema: "Identity", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims", + schema: "Identity"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims", + schema: "Identity"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins", + schema: "Identity"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles", + schema: "Identity"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens", + schema: "Identity"); + + migrationBuilder.DropTable( + name: "AspNetRoles", + schema: "Identity"); + + migrationBuilder.DropTable( + name: "AspNetUsers", + schema: "Identity"); + } + } +} diff --git a/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000..ac105e1 --- /dev/null +++ b/src/Web/Features/Users/Data/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,301 @@ +// +using System; +using Hutopy.Web.Features.Users.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Hutopy.Web.Features.Users.Data.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + partial class ApplicationDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("Identity") + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Hutopy.Web.Features.Users.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", "Identity"); + }); + + modelBuilder.Entity("Hutopy.Web.Features.Users.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("Address") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Alias") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("BirthDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("Firstname") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("GoogleId") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("Lastname") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("PortraitUrl") + .HasMaxLength(255) + .HasColumnType("character varying(255)"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Hutopy.Web.Features.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Web/Features/Users/DependencyInjection.cs b/src/Web/Features/Users/DependencyInjection.cs new file mode 100644 index 0000000..8444036 --- /dev/null +++ b/src/Web/Features/Users/DependencyInjection.cs @@ -0,0 +1,43 @@ +using Hutopy.Web.Common.BlobStorage; +using Hutopy.Web.Features.Messages.Data; +using Hutopy.Web.Features.Users.Data; +using Microsoft.AspNetCore.Identity; + +namespace Hutopy.Web.Features.Users; + +public static class DependencyInjection +{ + public static IServiceCollection AddUsersModule( + this IServiceCollection services, + Action? configureAction = null) + { + services.AddDbContext(configureAction); + services.AddScoped(); + + services.AddDbContext(configureAction); + services.AddScoped(); + + services.AddAuthentication() + .AddBearerToken(IdentityConstants.BearerScheme); + + services.AddAuthorizationBuilder(); + + services + .AddIdentityCore() + .AddUserManager() + .AddRoles() + .AddEntityFrameworkStores() + .AddApiEndpoints() + .AddSignInManager>() + .AddDefaultTokenProviders(); + + // Singleton services + services.AddSingleton(TimeProvider.System); + services.AddSingleton(); + + // Scoped services + services.AddScoped(); + + return services; + } +} diff --git a/src/Web/Features/Users/Handlers/ChangeAddress.cs b/src/Web/Features/Users/Handlers/ChangeAddress.cs index 7eea146..04b79fe 100644 --- a/src/Web/Features/Users/Handlers/ChangeAddress.cs +++ b/src/Web/Features/Users/Handlers/ChangeAddress.cs @@ -1,5 +1,5 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/ChangeAlias.cs b/src/Web/Features/Users/Handlers/ChangeAlias.cs index 7272075..571a5ae 100644 --- a/src/Web/Features/Users/Handlers/ChangeAlias.cs +++ b/src/Web/Features/Users/Handlers/ChangeAlias.cs @@ -1,5 +1,5 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/ChangeBirthDate.cs b/src/Web/Features/Users/Handlers/ChangeBirthDate.cs index 661bd8a..7b571b5 100644 --- a/src/Web/Features/Users/Handlers/ChangeBirthDate.cs +++ b/src/Web/Features/Users/Handlers/ChangeBirthDate.cs @@ -1,5 +1,5 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/ChangeEmail.cs b/src/Web/Features/Users/Handlers/ChangeEmail.cs index 9af2864..dc9037c 100644 --- a/src/Web/Features/Users/Handlers/ChangeEmail.cs +++ b/src/Web/Features/Users/Handlers/ChangeEmail.cs @@ -1,5 +1,5 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/ChangeFullname.cs b/src/Web/Features/Users/Handlers/ChangeFullname.cs index b71762e..d46cdf5 100644 --- a/src/Web/Features/Users/Handlers/ChangeFullname.cs +++ b/src/Web/Features/Users/Handlers/ChangeFullname.cs @@ -1,5 +1,5 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/ChangePhone.cs b/src/Web/Features/Users/Handlers/ChangePhone.cs index 4341ff2..79726fb 100644 --- a/src/Web/Features/Users/Handlers/ChangePhone.cs +++ b/src/Web/Features/Users/Handlers/ChangePhone.cs @@ -1,5 +1,5 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/ChangePortrait.cs b/src/Web/Features/Users/Handlers/ChangePortrait.cs index 4ab1c4c..81b44d9 100644 --- a/src/Web/Features/Users/Handlers/ChangePortrait.cs +++ b/src/Web/Features/Users/Handlers/ChangePortrait.cs @@ -1,6 +1,6 @@ -using Hutopy.Infrastructure.BlobStorage; -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; +using Hutopy.Web.Common.BlobStorage; +using Hutopy.Web.Common.Security; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/GetCurrentUser.cs b/src/Web/Features/Users/Handlers/GetCurrentUser.cs index 8d8bd4d..2b9cc09 100644 --- a/src/Web/Features/Users/Handlers/GetCurrentUser.cs +++ b/src/Web/Features/Users/Handlers/GetCurrentUser.cs @@ -1,4 +1,3 @@ -using Hutopy.Infrastructure.Identity; using Hutopy.Web.Features.Users.Handlers.Models; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/GetCurrentUserProfilePicture.cs b/src/Web/Features/Users/Handlers/GetCurrentUserProfilePicture.cs index c5ec37c..3ffee88 100644 --- a/src/Web/Features/Users/Handlers/GetCurrentUserProfilePicture.cs +++ b/src/Web/Features/Users/Handlers/GetCurrentUserProfilePicture.cs @@ -1,5 +1,4 @@ -using Hutopy.Infrastructure.BlobStorage; -using Hutopy.Infrastructure.Identity; +using Hutopy.Web.Common.BlobStorage; namespace Hutopy.Web.Features.Users.Handlers; diff --git a/src/Web/Features/Users/Handlers/LoginWithGoogle.cs b/src/Web/Features/Users/Handlers/LoginWithGoogle.cs index 49d0e8f..ef1e101 100644 --- a/src/Web/Features/Users/Handlers/LoginWithGoogle.cs +++ b/src/Web/Features/Users/Handlers/LoginWithGoogle.cs @@ -1,7 +1,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -using Hutopy.Infrastructure.Identity; -using Hutopy.Infrastructure.Utils; +using Hutopy.Web.Common; +using Hutopy.Web.Common.Security; using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Options; diff --git a/src/Infrastructure/Identity/IdentityResultExtensions.cs b/src/Web/Features/Users/IdentityResultExtensions.cs similarity index 77% rename from src/Infrastructure/Identity/IdentityResultExtensions.cs rename to src/Web/Features/Users/IdentityResultExtensions.cs index 8ab92c1..a9cad9f 100644 --- a/src/Infrastructure/Identity/IdentityResultExtensions.cs +++ b/src/Web/Features/Users/IdentityResultExtensions.cs @@ -1,7 +1,7 @@ -using Hutopy.Infrastructure.Identity.Models; +using Hutopy.Web.Features.Users.Models; using Microsoft.AspNetCore.Identity; -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public static class IdentityResultExtensions { diff --git a/src/Infrastructure/Identity/IdentityService.cs b/src/Web/Features/Users/IdentityService.cs similarity index 95% rename from src/Infrastructure/Identity/IdentityService.cs rename to src/Web/Features/Users/IdentityService.cs index 66ce6f8..30b7482 100644 --- a/src/Infrastructure/Identity/IdentityService.cs +++ b/src/Web/Features/Users/IdentityService.cs @@ -1,8 +1,7 @@ using System.Security.Claims; -using Hutopy.Infrastructure.Identity.Models; -using Microsoft.AspNetCore.Http; +using Hutopy.Web.Features.Users.Models; -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public class IdentityService( ApplicationUserManager userManager, diff --git a/src/Infrastructure/Identity/JwtOptions.cs b/src/Web/Features/Users/JwtOptions.cs similarity index 86% rename from src/Infrastructure/Identity/JwtOptions.cs rename to src/Web/Features/Users/JwtOptions.cs index 0f4214c..7ee27a2 100644 --- a/src/Infrastructure/Identity/JwtOptions.cs +++ b/src/Web/Features/Users/JwtOptions.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public record JwtOptions { diff --git a/src/Infrastructure/Identity/KnownRoles.cs b/src/Web/Features/Users/KnownRoles.cs similarity index 76% rename from src/Infrastructure/Identity/KnownRoles.cs rename to src/Web/Features/Users/KnownRoles.cs index 109c3fa..20c9ce2 100644 --- a/src/Infrastructure/Identity/KnownRoles.cs +++ b/src/Web/Features/Users/KnownRoles.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.Identity; +namespace Hutopy.Web.Features.Users; public static class KnownRoles { diff --git a/src/Infrastructure/Identity/Models/Result.cs b/src/Web/Features/Users/Models/Result.cs similarity index 95% rename from src/Infrastructure/Identity/Models/Result.cs rename to src/Web/Features/Users/Models/Result.cs index 9d26a1d..8e34553 100644 --- a/src/Infrastructure/Identity/Models/Result.cs +++ b/src/Web/Features/Users/Models/Result.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.Identity.Models; +namespace Hutopy.Web.Features.Users.Models; public class Result( bool succeeded, diff --git a/src/Infrastructure/Identity/Models/RoleModel.cs b/src/Web/Features/Users/Models/RoleModel.cs similarity index 66% rename from src/Infrastructure/Identity/Models/RoleModel.cs rename to src/Web/Features/Users/Models/RoleModel.cs index 051a272..a6243e1 100644 --- a/src/Infrastructure/Identity/Models/RoleModel.cs +++ b/src/Web/Features/Users/Models/RoleModel.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.Identity.Models; +namespace Hutopy.Web.Features.Users.Models; public class RoleModel { diff --git a/src/Infrastructure/Identity/Models/UserModel.cs b/src/Web/Features/Users/Models/UserModel.cs similarity index 90% rename from src/Infrastructure/Identity/Models/UserModel.cs rename to src/Web/Features/Users/Models/UserModel.cs index b43bc71..4172360 100644 --- a/src/Infrastructure/Identity/Models/UserModel.cs +++ b/src/Web/Features/Users/Models/UserModel.cs @@ -1,4 +1,4 @@ -namespace Hutopy.Infrastructure.Identity.Models; +namespace Hutopy.Web.Features.Users.Models; public class UserModel { diff --git a/src/Web/Pages/Shared/_LoginPartial.cshtml b/src/Web/Pages/Shared/_LoginPartial.cshtml index 252b86b..a347682 100644 --- a/src/Web/Pages/Shared/_LoginPartial.cshtml +++ b/src/Web/Pages/Shared/_LoginPartial.cshtml @@ -1,4 +1,4 @@ -@using Hutopy.Infrastructure.Identity +@using Hutopy.Web.Features.Users @using Microsoft.AspNetCore.Identity @using Microsoft.AspNetCore.Mvc.TagHelpers @inject SignInManager SignInManager diff --git a/src/Web/Program.cs b/src/Web/Program.cs index 6858ab6..90cf35d 100644 --- a/src/Web/Program.cs +++ b/src/Web/Program.cs @@ -1,7 +1,4 @@ using Azure.Identity; -using Hutopy.Infrastructure; -using Hutopy.Infrastructure.Data; -using Hutopy.Infrastructure.Identity; using Hutopy.Web; using Hutopy.Web.Features.Contents; using Hutopy.Web.Features.Contents.Data; @@ -9,6 +6,8 @@ using Hutopy.Web.Features.Memberships; using Hutopy.Web.Features.Memberships.Data; using Hutopy.Web.Features.Messages; using Hutopy.Web.Features.Messages.Data; +using Hutopy.Web.Features.Users; +using Hutopy.Web.Features.Users.Data; using Microsoft.AspNetCore.HttpOverrides; using NSwag; using NSwag.Generation.AspNetCore.Processors; @@ -50,8 +49,6 @@ builder.Services.AddCors(options => // Add services to the container. builder.Services.AddKeyVaultIfConfigured(builder.Configuration); - -builder.Services.AddInfrastructureServices(builder.Configuration); builder.Services.AddWebServices(); builder.Services.AddAuthorizationAndAuthentication(builder.Configuration); @@ -84,6 +81,10 @@ var postgresConnectionString = builder.Configuration.GetConnectionString("Postgr ?? throw new InvalidOperationException("Missing ConnectionStrings:PostgresConnection"); builder.Services.AddFastEndpoints(); +builder.Services.AddUsersModule(options => + options.UseNpgsql( + postgresConnectionString, + o => o.MigrationsHistoryTable("__EFMigrationsHistory", ApplicationDbContext.SchemaName))); builder.Services.AddContentModule(options => options.UseNpgsql( postgresConnectionString, diff --git a/src/Web/TestDataSeeder.cs b/src/Web/TestDataSeeder.cs index 530ca5f..2b2d48d 100644 --- a/src/Web/TestDataSeeder.cs +++ b/src/Web/TestDataSeeder.cs @@ -1,7 +1,7 @@ -using Hutopy.Infrastructure.Identity; -using Hutopy.Web.Common; +using Hutopy.Web.Common; using Hutopy.Web.Features.Contents.Data; using Hutopy.Web.Features.Messages.Data; +using Hutopy.Web.Features.Users; namespace Hutopy.Web; diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj index 68ad88e..a4bea51 100644 --- a/src/Web/Web.csproj +++ b/src/Web/Web.csproj @@ -7,34 +7,30 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + + - - + diff --git a/src/Web/appsettings.Development.json b/src/Web/appsettings.Development.json index be6e89a..9345447 100644 --- a/src/Web/appsettings.Development.json +++ b/src/Web/appsettings.Development.json @@ -9,7 +9,6 @@ }, "ConnectionStrings": { "AzureBlob": "DefaultEndpointsProtocol=https;AccountName=hutopyblob;AccountKey=AjK9vQMCIAG280PFIAWDjTtiFc/fIj/fb1NA9xtC7SLm6ZMZa/Agg0JFGYcHuJEaoZKDme7mNx/U+AStt9o7LQ==;EndpointSuffix=core.windows.net", - "MssqlConnection": "Server=localhost,1433;Initial Catalog=Hutopy;User Id=sa;Password=P@ssword123!;MultipleActiveResultSets=true;TrustServerCertificate=True;MultiSubnetFailover=True", "PostgresConnection": "Server=localhost,5432;Database=Hutopy;Uid=sa;Pwd=P@ssword123!;" }, "Authentication": { diff --git a/update-databases.sh b/update-databases.sh index 4b81d45..1441a95 100644 --- a/update-databases.sh +++ b/update-databases.sh @@ -3,9 +3,9 @@ dotnet build dotnet ef database update \ - --project src/Infrastructure/Infrastructure.csproj \ + --project src/Web/Web.csproj \ --startup-project src/Web/Web.csproj \ - --context Hutopy.Infrastructure.Data.ApplicationDbContext \ + --context Hutopy.Web.Features.Users.Data.ApplicationDbContext \ --configuration Debug \ --no-build