diff --git a/API/Controllers/AgeGroupController.cs b/API/Controllers/AgeGroupController.cs index 89267d1..8280bf1 100644 --- a/API/Controllers/AgeGroupController.cs +++ b/API/Controllers/AgeGroupController.cs @@ -24,7 +24,7 @@ namespace API.Controllers } [HttpGet("{id}")] - public async Task GetOne([FromRoute] int id) + public async Task GetOne([FromRoute] string id) { var group = await _ageGroupService.GetAsync(id); @@ -45,7 +45,7 @@ namespace API.Controllers } [HttpPut("{id}")] - public async Task Update([FromRoute] int id, [FromBody] AltersGruppeIngoing groupDto) + public async Task Update([FromRoute] string id, [FromBody] AltersGruppeIngoing groupDto) { var group = await _ageGroupService.UpdateAsync(id, groupDto.ToInternalFromIngoing()); @@ -58,7 +58,7 @@ namespace API.Controllers } [HttpDelete("{id}")] - public async Task Delete([FromRoute] int Id) + public async Task Delete([FromRoute] string Id) { var group = await _ageGroupService.DeleteAsync(Id); diff --git a/API/Migrations/20251207192702_Init.Designer.cs b/API/Migrations/20251207192702_Init.Designer.cs new file mode 100644 index 0000000..9426d12 --- /dev/null +++ b/API/Migrations/20251207192702_Init.Designer.cs @@ -0,0 +1,46 @@ +// +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("20251207192702_Init")] + partial class Init + { + /// + 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") + .HasMaxLength(26) + .HasColumnType("TEXT"); + + b.Property("EndingAge") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartingAge") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Altersgruppen"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/API/Migrations/20251207192702_Init.cs b/API/Migrations/20251207192702_Init.cs new file mode 100644 index 0000000..fb71bf2 --- /dev/null +++ b/API/Migrations/20251207192702_Init.cs @@ -0,0 +1,35 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace API.Migrations +{ + /// + public partial class Init : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Altersgruppen", + columns: table => new + { + Id = table.Column(type: "TEXT", maxLength: 26, nullable: false), + Name = table.Column(type: "TEXT", maxLength: 100, nullable: false), + StartingAge = table.Column(type: "INTEGER", nullable: false), + EndingAge = table.Column(type: "INTEGER", 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/ApplicationDbContextModelSnapshot.cs b/API/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000..cf69943 --- /dev/null +++ b/API/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,43 @@ +// +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") + .HasMaxLength(26) + .HasColumnType("TEXT"); + + b.Property("EndingAge") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property("StartingAge") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Altersgruppen"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/API/Repository/AgeGroup/AgeGroupService.cs b/API/Repository/AgeGroup/AgeGroupService.cs index 5bdee6d..3b41cd6 100644 --- a/API/Repository/AgeGroup/AgeGroupService.cs +++ b/API/Repository/AgeGroup/AgeGroupService.cs @@ -20,7 +20,7 @@ namespace API.Repository.AgeGroup return altersGruppe; } - public async Task DeleteAsync(int id) + public async Task DeleteAsync(string id) { var group = await _context.Altersgruppen.FirstOrDefaultAsync(x => x.Id == id); @@ -42,12 +42,12 @@ namespace API.Repository.AgeGroup return allGroups; } - public async Task GetAsync(int id) + public async Task GetAsync(string id) { return await _context.Altersgruppen.FindAsync(id); } - public async Task UpdateAsync(int id, AltersGruppe altersGruppe) + public async Task UpdateAsync(string id, AltersGruppe altersGruppe) { var existingGroup = await _context.Altersgruppen.FirstOrDefaultAsync(x => x.Id == id); diff --git a/API/Repository/AgeGroup/IAgeGroupService.cs b/API/Repository/AgeGroup/IAgeGroupService.cs index a350be0..9da50d3 100644 --- a/API/Repository/AgeGroup/IAgeGroupService.cs +++ b/API/Repository/AgeGroup/IAgeGroupService.cs @@ -6,9 +6,9 @@ namespace API.Repository.AgeGroup { public Task> GetAllAsync(); - public Task GetAsync(int id); + public Task GetAsync(string id); public Task CreateAsync(AltersGruppe altersGruppe); - public Task DeleteAsync(int id); - public Task UpdateAsync(int id, AltersGruppe altersGruppe); + public Task DeleteAsync(string id); + public Task UpdateAsync(string id, AltersGruppe altersGruppe); } } diff --git a/API/app.db b/API/app.db new file mode 100644 index 0000000..0de02ec Binary files /dev/null and b/API/app.db differ diff --git a/API/app.db-shm b/API/app.db-shm new file mode 100644 index 0000000..dc36e9f Binary files /dev/null and b/API/app.db-shm differ diff --git a/API/app.db-wal b/API/app.db-wal new file mode 100644 index 0000000..930bbf5 Binary files /dev/null and b/API/app.db-wal differ