feat: Project preready

This commit is contained in:
ereshk1gal
2025-10-01 01:42:16 +03:00
parent 06cb66624c
commit 504f03bd32
37 changed files with 1671 additions and 147 deletions

View File

@@ -45,10 +45,24 @@ public class AppDbContext : IdentityDbContext<AppUser, IdentityRole<Guid>, Guid>
public DbSet<RefreshToken> RefreshTokens => Set<RefreshToken>();
public DbSet<Notification> Notifications => Set<Notification>();
// Core profile / player chain
public DbSet<Player> Players => Set<Player>();
public DbSet<Profile> Profiles => Set<Profile>();
protected override void OnModelCreating(ModelBuilder b)
{
base.OnModelCreating(b);
// Player configuration
b.Entity<Player>()
.HasIndex(p => p.UserId)
.IsUnique();
b.Entity<Player>()
.HasOne<AppUser>()
.WithOne()
.HasForeignKey<Player>(p => p.UserId)
.IsRequired();
// Rank configurations
b.Entity<Rank>()
.HasIndex(r => r.ExpNeeded)
@@ -201,7 +215,6 @@ public class AppDbContext : IdentityDbContext<AppUser, IdentityRole<Guid>, Guid>
b.Entity<RefreshToken>().HasIndex(x => x.Token).IsUnique();
// ---------- Performance indexes ----------
b.Entity<AppUser>().HasIndex(u => u.RankId);
b.Entity<PlayerSkill>().HasIndex(ps => ps.SkillId);
b.Entity<EventLog>().HasIndex(e => new { e.UserId, e.Type, e.CreatedAt });
b.Entity<StoreItem>().HasIndex(i => i.IsActive);