Fix identityuser being used instead of DbApplicationUser

This commit is contained in:
martinshoob 2025-08-09 17:05:55 +02:00
parent bdb3475685
commit d2e156b9f1
4 changed files with 6 additions and 4 deletions

View file

@ -33,6 +33,8 @@ public class ApplicationDbContext : IdentityDbContext<DbApplicationUser>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Company
modelBuilder.Entity<DbCompany>(entity =>
{
@ -216,6 +218,5 @@ public class ApplicationDbContext : IdentityDbContext<DbApplicationUser>
.WithMany();
});
base.OnModelCreating(modelBuilder);
}
}

View file

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace DrinkRateAPI.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250809141112_init")]
[Migration("20250809145003_init")]
partial class init
{
/// <inheritdoc />

View file

@ -1,4 +1,5 @@
using DrinkRateAPI.Contexts;
using DrinkRateAPI.DbEntities;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Models;
@ -11,7 +12,7 @@ builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddAuthorization();
builder.Services.AddIdentityApiEndpoints<IdentityUser>()
builder.Services.AddIdentityApiEndpoints<DbApplicationUser>()
.AddEntityFrameworkStores<ApplicationDbContext>();
builder.Services.AddSwaggerGen(c =>
@ -60,7 +61,7 @@ if (app.Environment.IsDevelopment())
app.MapSwagger().RequireAuthorization();
}
app.MapIdentityApi<IdentityUser>();
app.MapIdentityApi<DbApplicationUser>();
app.UseHttpsRedirection();