fix: перенёс уровни в бд и пофиксид их отображение на фронте
Backend CI / build-and-test (push) Successful in 52s
Frontend CI / build-and-check (push) Failing after 5m15s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 16s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 1m0s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 32s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 13s
Backend CI / build-and-test (push) Successful in 52s
Frontend CI / build-and-check (push) Failing after 5m15s
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 16s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 1m0s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 32s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 13s
This commit is contained in:
@@ -23,6 +23,7 @@ public class AppDbContext : DbContext
|
||||
public DbSet<Achievement> Achievements { get; set; } = null!;
|
||||
public DbSet<UserAchievement> UserAchievements { get; set; } = null!;
|
||||
public DbSet<CoinTransaction> CoinTransactions { get; set; } = null!;
|
||||
public DbSet<LevelThreshold> LevelThresholds { get; set; } = null!;
|
||||
public DbSet<UserNotification> UserNotifications { get; set; } = null!;
|
||||
public DbSet<RefreshToken> RefreshTokens { get; set; } = null!;
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using UniVerse.Domain.Entities;
|
||||
|
||||
namespace UniVerse.Infrastructure.Data.Configurations;
|
||||
|
||||
public class LevelThresholdConfiguration : IEntityTypeConfiguration<LevelThreshold>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<LevelThreshold> builder)
|
||||
{
|
||||
builder.ToTable("level_thresholds", table =>
|
||||
{
|
||||
table.HasCheckConstraint("CK_level_thresholds_level_positive", "level > 0");
|
||||
table.HasCheckConstraint("CK_level_thresholds_required_xp_non_negative", "required_xp >= 0");
|
||||
});
|
||||
|
||||
builder.HasKey(t => t.Level);
|
||||
builder.Property(t => t.Level).HasColumnName("level").ValueGeneratedNever();
|
||||
builder.Property(t => t.RequiredXp).HasColumnName("required_xp").IsRequired();
|
||||
builder.HasIndex(t => t.RequiredXp).IsUnique();
|
||||
|
||||
builder.HasData(
|
||||
new LevelThreshold { Level = 1, RequiredXp = 0 },
|
||||
new LevelThreshold { Level = 2, RequiredXp = 100 },
|
||||
new LevelThreshold { Level = 3, RequiredXp = 300 },
|
||||
new LevelThreshold { Level = 4, RequiredXp = 600 },
|
||||
new LevelThreshold { Level = 5, RequiredXp = 1000 },
|
||||
new LevelThreshold { Level = 6, RequiredXp = 1500 },
|
||||
new LevelThreshold { Level = 7, RequiredXp = 2500 },
|
||||
new LevelThreshold { Level = 8, RequiredXp = 4000 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user