WIP: Project setup with .NET backend and Next.js frontend

This commit is contained in:
Denis Urs Rudolph
2026-04-03 20:55:58 +02:00
parent fbfa367c16
commit 8bfd49e0ab
34 changed files with 2553 additions and 0 deletions
@@ -0,0 +1,329 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using RacePlannerApi.Data;
#nullable disable
namespace RacePlannerApi.Data.Migrations
{
[DbContext(typeof(RacePlannerDbContext))]
[Migration("20260403185515_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("RacePlannerApi.Models.Announcement", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AuthorId")
.HasColumnType("uuid");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(5000)
.HasColumnType("character varying(5000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("EventId")
.HasColumnType("uuid");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("CreatedAt");
b.HasIndex("EventId");
b.ToTable("Announcements");
});
modelBuilder.Entity("RacePlannerApi.Models.Event", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime>("EventDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Location")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int?>("MaxParticipants")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("OrganizerId")
.HasColumnType("uuid");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("Tags")
.IsRequired()
.HasColumnType("text[]");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Category");
b.HasIndex("EventDate");
b.HasIndex("OrganizerId");
b.HasIndex("Status");
b.ToTable("Events");
});
modelBuilder.Entity("RacePlannerApi.Models.Payment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Method")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Notes")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<DateTime>("PaymentDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("RegistrationId")
.HasColumnType("uuid");
b.Property<string>("TransactionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("PaymentDate");
b.HasIndex("RegistrationId");
b.ToTable("Payments");
});
modelBuilder.Entity("RacePlannerApi.Models.Registration", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("EmergencyContact")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("EventId")
.HasColumnType("uuid");
b.Property<Guid>("ParticipantId")
.HasColumnType("uuid");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ParticipantId");
b.HasIndex("Status");
b.HasIndex("EventId", "ParticipantId")
.IsUnique();
b.ToTable("Registrations");
});
modelBuilder.Entity("RacePlannerApi.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Role")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("RacePlannerApi.Models.Announcement", b =>
{
b.HasOne("RacePlannerApi.Models.User", "Author")
.WithMany()
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("RacePlannerApi.Models.Event", "Event")
.WithMany("Announcements")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Event");
});
modelBuilder.Entity("RacePlannerApi.Models.Event", b =>
{
b.HasOne("RacePlannerApi.Models.User", "Organizer")
.WithMany("OrganizedEvents")
.HasForeignKey("OrganizerId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Organizer");
});
modelBuilder.Entity("RacePlannerApi.Models.Payment", b =>
{
b.HasOne("RacePlannerApi.Models.Registration", "Registration")
.WithMany("Payments")
.HasForeignKey("RegistrationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Registration");
});
modelBuilder.Entity("RacePlannerApi.Models.Registration", b =>
{
b.HasOne("RacePlannerApi.Models.Event", "Event")
.WithMany("Registrations")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RacePlannerApi.Models.User", "Participant")
.WithMany("Registrations")
.HasForeignKey("ParticipantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Event");
b.Navigation("Participant");
});
modelBuilder.Entity("RacePlannerApi.Models.Event", b =>
{
b.Navigation("Announcements");
b.Navigation("Registrations");
});
modelBuilder.Entity("RacePlannerApi.Models.Registration", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("RacePlannerApi.Models.User", b =>
{
b.Navigation("OrganizedEvents");
b.Navigation("Registrations");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,230 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RacePlannerApi.Data.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
PasswordHash = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
Role = table.Column<string>(type: "text", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Events",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Description = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
EventDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Location = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: false),
Status = table.Column<string>(type: "text", nullable: false),
Category = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
Tags = table.Column<List<string>>(type: "text[]", nullable: false),
MaxParticipants = table.Column<int>(type: "integer", nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
OrganizerId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Events", x => x.Id);
table.ForeignKey(
name: "FK_Events_Users_OrganizerId",
column: x => x.OrganizerId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Announcements",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
Title = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
Content = table.Column<string>(type: "character varying(5000)", maxLength: 5000, nullable: false),
EventId = table.Column<Guid>(type: "uuid", nullable: false),
AuthorId = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
IsPublished = table.Column<bool>(type: "boolean", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Announcements", x => x.Id);
table.ForeignKey(
name: "FK_Announcements_Events_EventId",
column: x => x.EventId,
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Announcements_Users_AuthorId",
column: x => x.AuthorId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Registrations",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
EventId = table.Column<Guid>(type: "uuid", nullable: false),
ParticipantId = table.Column<Guid>(type: "uuid", nullable: false),
Status = table.Column<string>(type: "text", nullable: false),
Category = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
EmergencyContact = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Registrations", x => x.Id);
table.ForeignKey(
name: "FK_Registrations_Events_EventId",
column: x => x.EventId,
principalTable: "Events",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Registrations_Users_ParticipantId",
column: x => x.ParticipantId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Payments",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
RegistrationId = table.Column<Guid>(type: "uuid", nullable: false),
Amount = table.Column<decimal>(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false),
Method = table.Column<string>(type: "text", nullable: false),
TransactionId = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
Notes = table.Column<string>(type: "character varying(500)", maxLength: 500, nullable: true),
PaymentDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Payments", x => x.Id);
table.ForeignKey(
name: "FK_Payments_Registrations_RegistrationId",
column: x => x.RegistrationId,
principalTable: "Registrations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Announcements_AuthorId",
table: "Announcements",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_Announcements_CreatedAt",
table: "Announcements",
column: "CreatedAt");
migrationBuilder.CreateIndex(
name: "IX_Announcements_EventId",
table: "Announcements",
column: "EventId");
migrationBuilder.CreateIndex(
name: "IX_Events_Category",
table: "Events",
column: "Category");
migrationBuilder.CreateIndex(
name: "IX_Events_EventDate",
table: "Events",
column: "EventDate");
migrationBuilder.CreateIndex(
name: "IX_Events_OrganizerId",
table: "Events",
column: "OrganizerId");
migrationBuilder.CreateIndex(
name: "IX_Events_Status",
table: "Events",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_Payments_PaymentDate",
table: "Payments",
column: "PaymentDate");
migrationBuilder.CreateIndex(
name: "IX_Payments_RegistrationId",
table: "Payments",
column: "RegistrationId");
migrationBuilder.CreateIndex(
name: "IX_Registrations_EventId_ParticipantId",
table: "Registrations",
columns: new[] { "EventId", "ParticipantId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Registrations_ParticipantId",
table: "Registrations",
column: "ParticipantId");
migrationBuilder.CreateIndex(
name: "IX_Registrations_Status",
table: "Registrations",
column: "Status");
migrationBuilder.CreateIndex(
name: "IX_Users_Email",
table: "Users",
column: "Email",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Announcements");
migrationBuilder.DropTable(
name: "Payments");
migrationBuilder.DropTable(
name: "Registrations");
migrationBuilder.DropTable(
name: "Events");
migrationBuilder.DropTable(
name: "Users");
}
}
}
@@ -0,0 +1,326 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using RacePlannerApi.Data;
#nullable disable
namespace RacePlannerApi.Data.Migrations
{
[DbContext(typeof(RacePlannerDbContext))]
partial class RacePlannerDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("RacePlannerApi.Models.Announcement", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("AuthorId")
.HasColumnType("uuid");
b.Property<string>("Content")
.IsRequired()
.HasMaxLength(5000)
.HasColumnType("character varying(5000)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("EventId")
.HasColumnType("uuid");
b.Property<bool>("IsPublished")
.HasColumnType("boolean");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.HasIndex("CreatedAt");
b.HasIndex("EventId");
b.ToTable("Announcements");
});
modelBuilder.Entity("RacePlannerApi.Models.Event", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(2000)
.HasColumnType("character varying(2000)");
b.Property<DateTime>("EventDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("Location")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<int?>("MaxParticipants")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("OrganizerId")
.HasColumnType("uuid");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.PrimitiveCollection<List<string>>("Tags")
.IsRequired()
.HasColumnType("text[]");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("Category");
b.HasIndex("EventDate");
b.HasIndex("OrganizerId");
b.HasIndex("Status");
b.ToTable("Events");
});
modelBuilder.Entity("RacePlannerApi.Models.Payment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasPrecision(18, 2)
.HasColumnType("numeric(18,2)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Method")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Notes")
.HasMaxLength(500)
.HasColumnType("character varying(500)");
b.Property<DateTime>("PaymentDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid>("RegistrationId")
.HasColumnType("uuid");
b.Property<string>("TransactionId")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.HasKey("Id");
b.HasIndex("PaymentDate");
b.HasIndex("RegistrationId");
b.ToTable("Payments");
});
modelBuilder.Entity("RacePlannerApi.Models.Registration", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<string>("Category")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("EmergencyContact")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<Guid>("EventId")
.HasColumnType("uuid");
b.Property<Guid>("ParticipantId")
.HasColumnType("uuid");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ParticipantId");
b.HasIndex("Status");
b.HasIndex("EventId", "ParticipantId")
.IsUnique();
b.ToTable("Registrations");
});
modelBuilder.Entity("RacePlannerApi.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Role")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("RacePlannerApi.Models.Announcement", b =>
{
b.HasOne("RacePlannerApi.Models.User", "Author")
.WithMany()
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("RacePlannerApi.Models.Event", "Event")
.WithMany("Announcements")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
b.Navigation("Event");
});
modelBuilder.Entity("RacePlannerApi.Models.Event", b =>
{
b.HasOne("RacePlannerApi.Models.User", "Organizer")
.WithMany("OrganizedEvents")
.HasForeignKey("OrganizerId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Organizer");
});
modelBuilder.Entity("RacePlannerApi.Models.Payment", b =>
{
b.HasOne("RacePlannerApi.Models.Registration", "Registration")
.WithMany("Payments")
.HasForeignKey("RegistrationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Registration");
});
modelBuilder.Entity("RacePlannerApi.Models.Registration", b =>
{
b.HasOne("RacePlannerApi.Models.Event", "Event")
.WithMany("Registrations")
.HasForeignKey("EventId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("RacePlannerApi.Models.User", "Participant")
.WithMany("Registrations")
.HasForeignKey("ParticipantId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Event");
b.Navigation("Participant");
});
modelBuilder.Entity("RacePlannerApi.Models.Event", b =>
{
b.Navigation("Announcements");
b.Navigation("Registrations");
});
modelBuilder.Entity("RacePlannerApi.Models.Registration", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("RacePlannerApi.Models.User", b =>
{
b.Navigation("OrganizedEvents");
b.Navigation("Registrations");
});
#pragma warning restore 612, 618
}
}
}