Started to create authorization portion pt.2
This commit is contained in:
25
BrightGlimmer.Data/AuthContext.cs
Normal file
25
BrightGlimmer.Data/AuthContext.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using BrightGlimmer.Data.Interfaces;
|
||||
using BrightGlimmer.Domain.Auth;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BrightGlimmer.Data
|
||||
{
|
||||
public class AuthContext : DbContext, IUnitOfWork
|
||||
{
|
||||
public AuthContext(DbContextOptions<AuthContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
// dotnet ef migrations add NAME --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Auth --context AuthContext
|
||||
// dotnet ef database update --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Auth --context AuthContext
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<User> Users { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using BrightGlimmer.Data.Interfaces;
|
||||
using BrightGlimmer.Domain;
|
||||
using BrightGlimmer.Domain.Service;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -15,9 +15,8 @@ namespace BrightGlimmer.Data
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// dotnet ef migrations add NAME --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api
|
||||
// dotnet ef database update --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api
|
||||
// dotnet ef migrations add NAME --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api --context BgContext
|
||||
// dotnet ef database update --project ./BrightGlimmer.Data --startup-project ./BrightGlimmer.Api --context BgContext
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Student>(entity =>
|
||||
|
||||
57
BrightGlimmer.Data/Migrations/Auth/20190505233325_Create-Database.Designer.cs
generated
Normal file
57
BrightGlimmer.Data/Migrations/Auth/20190505233325_Create-Database.Designer.cs
generated
Normal file
@@ -0,0 +1,57 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using BrightGlimmer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace BrightGlimmer.Data.Migrations.Auth
|
||||
{
|
||||
[DbContext(typeof(AuthContext))]
|
||||
[Migration("20190505233325_Create-Database")]
|
||||
partial class CreateDatabase
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Domain.Auth.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("AccountLocked");
|
||||
|
||||
b.Property<DateTime>("CreatedDate");
|
||||
|
||||
b.Property<string>("Email");
|
||||
|
||||
b.Property<bool>("EmailConfirmed");
|
||||
|
||||
b.Property<string>("FirstName");
|
||||
|
||||
b.Property<bool>("IsDeleted");
|
||||
|
||||
b.Property<string>("LastName");
|
||||
|
||||
b.Property<string>("MiddleName");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate");
|
||||
|
||||
b.Property<string>("PasswordHash");
|
||||
|
||||
b.Property<int>("RetryAttempts");
|
||||
|
||||
b.Property<string>("Username");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace BrightGlimmer.Data.Migrations.Auth
|
||||
{
|
||||
public partial class CreateDatabase : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(nullable: false),
|
||||
IsDeleted = table.Column<bool>(nullable: false),
|
||||
CreatedDate = table.Column<DateTime>(nullable: false),
|
||||
ModifiedDate = table.Column<DateTime>(nullable: false),
|
||||
Username = table.Column<string>(nullable: true),
|
||||
Email = table.Column<string>(nullable: true),
|
||||
FirstName = table.Column<string>(nullable: true),
|
||||
MiddleName = table.Column<string>(nullable: true),
|
||||
LastName = table.Column<string>(nullable: true),
|
||||
PasswordHash = table.Column<string>(nullable: true),
|
||||
EmailConfirmed = table.Column<bool>(nullable: false),
|
||||
AccountLocked = table.Column<bool>(nullable: false),
|
||||
RetryAttempts = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using BrightGlimmer.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace BrightGlimmer.Data.Migrations.Auth
|
||||
{
|
||||
[DbContext(typeof(AuthContext))]
|
||||
partial class AuthContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "2.2.4-servicing-10062");
|
||||
|
||||
modelBuilder.Entity("BrightGlimmer.Domain.Auth.User", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<bool>("AccountLocked");
|
||||
|
||||
b.Property<DateTime>("CreatedDate");
|
||||
|
||||
b.Property<string>("Email");
|
||||
|
||||
b.Property<bool>("EmailConfirmed");
|
||||
|
||||
b.Property<string>("FirstName");
|
||||
|
||||
b.Property<bool>("IsDeleted");
|
||||
|
||||
b.Property<string>("LastName");
|
||||
|
||||
b.Property<string>("MiddleName");
|
||||
|
||||
b.Property<DateTime>("ModifiedDate");
|
||||
|
||||
b.Property<string>("PasswordHash");
|
||||
|
||||
b.Property<int>("RetryAttempts");
|
||||
|
||||
b.Property<string>("Username");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using BrightGlimmer.Data.Interfaces;
|
||||
using BrightGlimmer.Domain;
|
||||
using BrightGlimmer.Domain.Service;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using System;
|
||||
|
||||
10
BrightGlimmer.Data/Services/UserService.cs
Normal file
10
BrightGlimmer.Data/Services/UserService.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace BrightGlimmer.Data.Services
|
||||
{
|
||||
public class UserService
|
||||
{
|
||||
}
|
||||
}
|
||||
BIN
BrightGlimmer.Data/bright_glimmer_auth.db
Normal file
BIN
BrightGlimmer.Data/bright_glimmer_auth.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user