811b6ef51a
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
34 lines
1.4 KiB
C#
34 lines
1.4 KiB
C#
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 }
|
|
);
|
|
}
|
|
}
|