用户获取信息返回角色信息
This commit is contained in:
@@ -24,6 +24,8 @@ namespace Apimanager_backend.Data
|
||||
public DbSet<UserRole> UserRoles { get; set; }
|
||||
//日志表
|
||||
public DbSet<Log> Logs { get; set; }
|
||||
//系统配置表
|
||||
public DbSet<SystemConfig> SystemConfigs { get; set; }
|
||||
public ApiContext(DbContextOptions<ApiContext> options) : base(options) { }
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
@@ -31,6 +33,7 @@ namespace Apimanager_backend.Data
|
||||
// 配置全局查询筛选器
|
||||
modelBuilder.Entity<User>().HasQueryFilter(u => !u.IsDelete);
|
||||
modelBuilder.Entity<Api>().HasQueryFilter(a => !a.IsDelete);
|
||||
modelBuilder.Entity<Apipackage>().HasQueryFilter(x => x.IsDeleted);
|
||||
//配置日志表
|
||||
modelBuilder.Entity<Log>().HasKey(x => x.Id);
|
||||
modelBuilder.Entity<Log>()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using Apimanager_backend.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Apimanager_backend.Data
|
||||
{
|
||||
public class SystemConfigConfig : IEntityTypeConfiguration<SystemConfig>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SystemConfig> builder)
|
||||
{
|
||||
//主键
|
||||
builder.HasKey(x => x.Id);
|
||||
//自增
|
||||
builder.Property(x => x.Id)
|
||||
.ValueGeneratedOnAdd();
|
||||
builder.HasData(
|
||||
new SystemConfig(1,"SystemName", "青蓝"),
|
||||
new SystemConfig(2,"SystemDescription", "描述"),
|
||||
new SystemConfig(3,"LogoLocation", ""),
|
||||
new SystemConfig(4,"FaviconLocation", ""),
|
||||
new SystemConfig(5,"Phone","13000000000"),
|
||||
new SystemConfig(6,"Email","admin@admin.com"),
|
||||
new SystemConfig(
|
||||
7,"RegisterConfig", JsonConvert.SerializeObject(new {RegisterOn = true,Emailvalidate = true })
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,9 @@ namespace Apimanager_backend.Data
|
||||
.IsUnique();
|
||||
builder.HasIndex(x => x.Email)
|
||||
.IsUnique();
|
||||
builder.HasData(
|
||||
new User(-1,"admin", "admin1@admin.com","e10adc3949ba59abbe56e057f20f883e")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user