Setup base EF model and authentication #1
4 changed files with 6 additions and 4 deletions
|
@ -33,6 +33,8 @@ public class ApplicationDbContext : IdentityDbContext<DbApplicationUser>
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
modelBuilder.Entity<DbCompany>(entity =>
|
modelBuilder.Entity<DbCompany>(entity =>
|
||||||
{
|
{
|
||||||
|
@ -216,6 +218,5 @@ public class ApplicationDbContext : IdentityDbContext<DbApplicationUser>
|
||||||
.WithMany();
|
.WithMany();
|
||||||
});
|
});
|
||||||
|
|
||||||
base.OnModelCreating(modelBuilder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
namespace DrinkRateAPI.Migrations
|
namespace DrinkRateAPI.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
[Migration("20250809141112_init")]
|
[Migration("20250809145003_init")]
|
||||||
partial class init
|
partial class init
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
|
@ -1,4 +1,5 @@
|
||||||
using DrinkRateAPI.Contexts;
|
using DrinkRateAPI.Contexts;
|
||||||
|
using DrinkRateAPI.DbEntities;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
@ -11,7 +12,7 @@ builder.Services.AddControllers();
|
||||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddAuthorization();
|
builder.Services.AddAuthorization();
|
||||||
builder.Services.AddIdentityApiEndpoints<IdentityUser>()
|
builder.Services.AddIdentityApiEndpoints<DbApplicationUser>()
|
||||||
.AddEntityFrameworkStores<ApplicationDbContext>();
|
.AddEntityFrameworkStores<ApplicationDbContext>();
|
||||||
|
|
||||||
builder.Services.AddSwaggerGen(c =>
|
builder.Services.AddSwaggerGen(c =>
|
||||||
|
@ -60,7 +61,7 @@ if (app.Environment.IsDevelopment())
|
||||||
app.MapSwagger().RequireAuthorization();
|
app.MapSwagger().RequireAuthorization();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.MapIdentityApi<IdentityUser>();
|
app.MapIdentityApi<DbApplicationUser>();
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue