diff --git a/.vs/JudoWeb/DesignTimeBuild/.dtbcache.v2 b/.vs/JudoWeb/DesignTimeBuild/.dtbcache.v2 index 803c5ea..7c118f7 100644 Binary files a/.vs/JudoWeb/DesignTimeBuild/.dtbcache.v2 and b/.vs/JudoWeb/DesignTimeBuild/.dtbcache.v2 differ diff --git a/API/API.csproj b/API/API.csproj index 93fcf8a..f8d5136 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -26,6 +26,7 @@ + diff --git a/API/API.csproj.Backup (1).tmp b/API/API.csproj.Backup (1).tmp deleted file mode 100644 index e071122..0000000 --- a/API/API.csproj.Backup (1).tmp +++ /dev/null @@ -1,32 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - diff --git a/API/API.csproj.Backup.tmp b/API/API.csproj.Backup.tmp deleted file mode 100644 index 9d39161..0000000 --- a/API/API.csproj.Backup.tmp +++ /dev/null @@ -1,25 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - diff --git a/API/Database/ApplicationDbContext.cs b/API/Database/ApplicationDbContext.cs index 1a9f69b..8d3d152 100644 --- a/API/Database/ApplicationDbContext.cs +++ b/API/Database/ApplicationDbContext.cs @@ -10,5 +10,12 @@ namespace API.Database } public DbSet Altersgruppen { get; set; } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.ApplyConfigurationsFromAssembly(typeof(ApplicationDbContext).Assembly); + } } } diff --git a/API/Database/Configurations/AltersGruppeConfiguration.cs b/API/Database/Configurations/AltersGruppeConfiguration.cs new file mode 100644 index 0000000..ba6036f --- /dev/null +++ b/API/Database/Configurations/AltersGruppeConfiguration.cs @@ -0,0 +1,34 @@ +using API.Models.Internal.Altersgruppen; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace API.Database.Configurations +{ + public class AltersGruppeConfiguration : IEntityTypeConfiguration + { + public void Configure(EntityTypeBuilder entity) + { + // Primary Key + entity.HasKey(e => e.Id); + + // Id-Konfiguration + entity.Property(e => e.Id) + .HasMaxLength(26) + .IsRequired() + .ValueGeneratedNever(); + + // Name + entity.Property(e => e.Name) + .HasMaxLength(100) + .IsRequired(); + + // StartingAge + entity.Property(e => e.StartingAge) + .IsRequired(); + + // EndingAge + entity.Property(e => e.EndingAge) + .IsRequired(); + } + } +} diff --git a/API/Migrations/20251206113128_InitialCreate.Designer.cs b/API/Migrations/20251206113128_InitialCreate.Designer.cs deleted file mode 100644 index 8220cb4..0000000 --- a/API/Migrations/20251206113128_InitialCreate.Designer.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -using API.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace API.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20251206113128_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.11"); - - modelBuilder.Entity("API.Models.Internal.Altersgruppen.Altergruppe", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndingAge") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("StartingAge") - .IsRequired() - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.ToTable("Altersgruppen"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/API/Migrations/20251206113128_InitialCreate.cs b/API/Migrations/20251206113128_InitialCreate.cs deleted file mode 100644 index fa435ab..0000000 --- a/API/Migrations/20251206113128_InitialCreate.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace API.Migrations -{ - /// - public partial class InitialCreate : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Altersgruppen", - columns: table => new - { - Id = table.Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(type: "TEXT", nullable: false), - StartingAge = table.Column(type: "TEXT", nullable: false), - EndingAge = table.Column(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Altersgruppen", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Altersgruppen"); - } - } -} diff --git a/API/Migrations/20251206220303_ChangeAgeFieldsToInt.Designer.cs b/API/Migrations/20251206220303_ChangeAgeFieldsToInt.Designer.cs deleted file mode 100644 index 1997ead..0000000 --- a/API/Migrations/20251206220303_ChangeAgeFieldsToInt.Designer.cs +++ /dev/null @@ -1,45 +0,0 @@ -// -using API.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace API.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20251206220303_ChangeAgeFieldsToInt")] - partial class ChangeAgeFieldsToInt - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.11"); - - modelBuilder.Entity("API.Models.Internal.Altersgruppen.AltersGruppe", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndingAge") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("StartingAge") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("Altersgruppen"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/API/Migrations/20251206220303_ChangeAgeFieldsToInt.cs b/API/Migrations/20251206220303_ChangeAgeFieldsToInt.cs deleted file mode 100644 index fccb536..0000000 --- a/API/Migrations/20251206220303_ChangeAgeFieldsToInt.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace API.Migrations -{ - /// - public partial class ChangeAgeFieldsToInt : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "StartingAge", - table: "Altersgruppen", - type: "INTEGER", - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT"); - - migrationBuilder.AlterColumn( - name: "EndingAge", - table: "Altersgruppen", - type: "INTEGER", - nullable: false, - oldClrType: typeof(string), - oldType: "TEXT"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "StartingAge", - table: "Altersgruppen", - type: "TEXT", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - - migrationBuilder.AlterColumn( - name: "EndingAge", - table: "Altersgruppen", - type: "TEXT", - nullable: false, - oldClrType: typeof(int), - oldType: "INTEGER"); - } - } -} diff --git a/API/Migrations/ApplicationDbContextModelSnapshot.cs b/API/Migrations/ApplicationDbContextModelSnapshot.cs deleted file mode 100644 index 4e1d4ce..0000000 --- a/API/Migrations/ApplicationDbContextModelSnapshot.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -using API.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace API.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - partial class ApplicationDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "9.0.11"); - - modelBuilder.Entity("API.Models.Internal.Altersgruppen.AltersGruppe", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("EndingAge") - .HasColumnType("INTEGER"); - - b.Property("Name") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property("StartingAge") - .HasColumnType("INTEGER"); - - b.HasKey("Id"); - - b.ToTable("Altersgruppen"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/API/Models/Internal/Altersgruppen/AltersGruppe.cs b/API/Models/Internal/Altersgruppen/AltersGruppe.cs index 5914805..582de6c 100644 --- a/API/Models/Internal/Altersgruppen/AltersGruppe.cs +++ b/API/Models/Internal/Altersgruppen/AltersGruppe.cs @@ -4,9 +4,15 @@ namespace API.Models.Internal.Altersgruppen { public class AltersGruppe { - public int Id { get; set; } + public string Id { get; set; } public string Name { get; set; } public int StartingAge { get; set; } public int EndingAge { get; set; } + + // Constructor für automatische ULID-Generierung + public AltersGruppe() + { + Id = Ulid.NewUlid().ToString(); + } } } diff --git a/API/app.db-shm b/API/app.db-shm deleted file mode 100644 index 97f3b41..0000000 Binary files a/API/app.db-shm and /dev/null differ diff --git a/API/app.db-wal b/API/app.db-wal deleted file mode 100644 index 25974fc..0000000 Binary files a/API/app.db-wal and /dev/null differ