Skip to content

Commit e819edb

Browse files
committed
Update DB
1 parent a123b9d commit e819edb

5 files changed

Lines changed: 17 additions & 0 deletions

File tree

API/API.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.0.0" />
26+
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
2627
<PackageReference Include="Fluid.Core" Version="2.5.0" />
2728
<PackageReference Include="MailKit" Version="4.3.0" />
2829
<PackageReference Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" Version="8.0.1" />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using NpgsqlTypes;
2+
3+
namespace OpenShock.Common.Models;
4+
5+
public enum PasswordEncryptionType
6+
{
7+
[PgName("pbkdf2")] Pbkdf2,
8+
[PgName("bcrypt_enhanced")] BcryptEnhanced
9+
}

Common/OpenShockDb/OpenShockContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ public OpenShockContext(DbContextOptions<OpenShockContext> options)
3737

3838
public virtual DbSet<User> Users { get; set; }
3939

40+
public virtual DbSet<UsersActivation> UsersActivations { get; set; }
41+
4042
protected override void OnModelCreating(ModelBuilder modelBuilder)
4143
{
4244
modelBuilder
4345
.HasPostgresEnum("control_type", new[] { "sound", "vibrate", "shock", "stop" })
4446
.HasPostgresEnum("ota_update_status", new[] { "started", "running", "finished", "error", "timeout" })
47+
.HasPostgresEnum("password_encryption_type", new[] { "pbkdf2", "bcrypt_enhanced" })
4548
.HasPostgresEnum("permission_type", new[] { "shockers.use" })
4649
.HasPostgresEnum("rank_type", new[] { "user", "support", "staff", "admin", "system" })
4750
.HasPostgresEnum("shocker_model_type", new[] { "caiXianlin", "petTrainer" });
@@ -372,6 +375,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
372375
entity.Property(e => e.Rank)
373376
.HasColumnType("rank_type")
374377
.HasColumnName("rank");
378+
entity.Property(e => e.PasswordEncryption)
379+
.HasColumnType("password_encryption_type")
380+
.HasColumnName("password_encryption");
375381
});
376382

377383
modelBuilder.Entity<UsersActivation>(entity =>

Common/OpenShockDb/User.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public partial class User
1818

1919
public bool EmailActived { get; set; }
2020
public RankType Rank { get; set; }
21+
public PasswordEncryptionType PasswordEncryption { get; set; }
2122

2223
public virtual ICollection<ApiToken> ApiTokens { get; set; } = new List<ApiToken>();
2324

File renamed without changes.

0 commit comments

Comments
 (0)