mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40:13 +01:00
Rename EventEndpoints VolunteerId to UserId
This commit is contained in:
@@ -35,7 +35,7 @@ namespace WebApp.Data
|
||||
.HasKey(es => new { es.EventId, es.SkillId });
|
||||
|
||||
builder.Entity<EventRegistration>()
|
||||
.HasKey(er => new { er.VolunteerId, er.EventId });
|
||||
.HasKey(er => new { er.UserId, er.EventId });
|
||||
|
||||
builder.Entity<MessageActivity>()
|
||||
.HasKey(ma => new { ma.Sender, ma.Recipient });
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace WebApp.Endpoints
|
||||
if(!user.IsOrganisation)
|
||||
{
|
||||
var events = await context.EventRegistrations
|
||||
.Where(er => er.VolunteerId == user.UserId)
|
||||
.Where(er => er.UserId == user.UserId)
|
||||
.Select(er => er.Event.ToEventSummaryNoErDto())
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
public class EventRegistration
|
||||
{
|
||||
public int EventId { get; set; }
|
||||
public required int VolunteerId { get; set; }
|
||||
public required int UserId { get; set; }
|
||||
public DateTime RegisteredAt { get; set; } = DateTime.UtcNow;
|
||||
public Event? Event { get; set; }
|
||||
public User? User { get; set; }
|
||||
|
||||
622
WebApp/Migrations/20250530235051_RenameEventRegistration.Designer.cs
generated
Normal file
622
WebApp/Migrations/20250530235051_RenameEventRegistration.Designer.cs
generated
Normal file
@@ -0,0 +1,622 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using WebApp.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApp.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20250530235051_RenameEventRegistration")]
|
||||
partial class RenameEventRegistration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Event", b =>
|
||||
{
|
||||
b.Property<int>("EventId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("EventId"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("EventDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Location")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OrganisationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("EventId");
|
||||
|
||||
b.HasIndex("OrganisationId");
|
||||
|
||||
b.ToTable("Events");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.EventRegistration", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("EventId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("RegisteredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("UserId", "EventId");
|
||||
|
||||
b.HasIndex("EventId");
|
||||
|
||||
b.ToTable("EventRegistrations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.EventSkill", b =>
|
||||
{
|
||||
b.Property<int>("EventId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SkillId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("EventId", "SkillId");
|
||||
|
||||
b.HasIndex("SkillId");
|
||||
|
||||
b.ToTable("EventSkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Message", b =>
|
||||
{
|
||||
b.Property<int>("MessageId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("MessageId"));
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("EventType")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsMsgFromVolunteer")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("IsoDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("OrganizationId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("VolunteerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.MessageActivity", b =>
|
||||
{
|
||||
b.Property<int>("Sender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Recipient")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("RecipientLastActive")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Sender", "Recipient");
|
||||
|
||||
b.ToTable("MessagesActivities");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Organisation", b =>
|
||||
{
|
||||
b.Property<int>("OrganisationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("OrganisationId"));
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Website")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("OrganisationId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Organisations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Skill", b =>
|
||||
{
|
||||
b.Property<int>("SkillId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("SkillId"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("SkillId");
|
||||
|
||||
b.ToTable("Skills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Token", b =>
|
||||
{
|
||||
b.Property<int>("TokenId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TokenId"));
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("ValidUntil")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("TokenId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("Tokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.User", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("UserId"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsOrganisation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("UserId");
|
||||
|
||||
b.ToTable("WebUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.VolunteerSkill", b =>
|
||||
{
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SkillId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("UserId", "SkillId");
|
||||
|
||||
b.HasIndex("SkillId");
|
||||
|
||||
b.ToTable("VolunteerSkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Event", b =>
|
||||
{
|
||||
b.HasOne("WebApp.Entities.Organisation", "Organisation")
|
||||
.WithMany("Events")
|
||||
.HasForeignKey("OrganisationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Organisation");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.EventRegistration", b =>
|
||||
{
|
||||
b.HasOne("WebApp.Entities.Event", "Event")
|
||||
.WithMany("EventRegistrations")
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WebApp.Entities.User", "User")
|
||||
.WithMany("EventRegistrations")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Event");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.EventSkill", b =>
|
||||
{
|
||||
b.HasOne("WebApp.Entities.Event", "Event")
|
||||
.WithMany("EventSkills")
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WebApp.Entities.Skill", "Skill")
|
||||
.WithMany("EventSkills")
|
||||
.HasForeignKey("SkillId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Event");
|
||||
|
||||
b.Navigation("Skill");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Organisation", b =>
|
||||
{
|
||||
b.HasOne("WebApp.Entities.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Token", b =>
|
||||
{
|
||||
b.HasOne("WebApp.Entities.User", null)
|
||||
.WithMany("Tokens")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.VolunteerSkill", b =>
|
||||
{
|
||||
b.HasOne("WebApp.Entities.Skill", "Skill")
|
||||
.WithMany("VolunteerSkills")
|
||||
.HasForeignKey("SkillId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("WebApp.Entities.User", "User")
|
||||
.WithMany("VolunteerSkills")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Skill");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Event", b =>
|
||||
{
|
||||
b.Navigation("EventRegistrations");
|
||||
|
||||
b.Navigation("EventSkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Organisation", b =>
|
||||
{
|
||||
b.Navigation("Events");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.Skill", b =>
|
||||
{
|
||||
b.Navigation("EventSkills");
|
||||
|
||||
b.Navigation("VolunteerSkills");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.User", b =>
|
||||
{
|
||||
b.Navigation("EventRegistrations");
|
||||
|
||||
b.Navigation("Tokens");
|
||||
|
||||
b.Navigation("VolunteerSkills");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
97
WebApp/Migrations/20250530235051_RenameEventRegistration.cs
Normal file
97
WebApp/Migrations/20250530235051_RenameEventRegistration.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace WebApp.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RenameEventRegistration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_EventRegistrations_WebUsers_UserId",
|
||||
table: "EventRegistrations");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_EventRegistrations",
|
||||
table: "EventRegistrations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_EventRegistrations_UserId",
|
||||
table: "EventRegistrations");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "VolunteerId",
|
||||
table: "EventRegistrations");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "UserId",
|
||||
table: "EventRegistrations",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_EventRegistrations",
|
||||
table: "EventRegistrations",
|
||||
columns: new[] { "UserId", "EventId" });
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_EventRegistrations_WebUsers_UserId",
|
||||
table: "EventRegistrations",
|
||||
column: "UserId",
|
||||
principalTable: "WebUsers",
|
||||
principalColumn: "UserId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_EventRegistrations_WebUsers_UserId",
|
||||
table: "EventRegistrations");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_EventRegistrations",
|
||||
table: "EventRegistrations");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "UserId",
|
||||
table: "EventRegistrations",
|
||||
type: "integer",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "VolunteerId",
|
||||
table: "EventRegistrations",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_EventRegistrations",
|
||||
table: "EventRegistrations",
|
||||
columns: new[] { "VolunteerId", "EventId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EventRegistrations_UserId",
|
||||
table: "EventRegistrations",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_EventRegistrations_WebUsers_UserId",
|
||||
table: "EventRegistrations",
|
||||
column: "UserId",
|
||||
principalTable: "WebUsers",
|
||||
principalColumn: "UserId");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +252,7 @@ namespace WebApp.Migrations
|
||||
|
||||
modelBuilder.Entity("WebApp.Entities.EventRegistration", b =>
|
||||
{
|
||||
b.Property<int>("VolunteerId")
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("EventId")
|
||||
@@ -261,15 +261,10 @@ namespace WebApp.Migrations
|
||||
b.Property<DateTime>("RegisteredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("VolunteerId", "EventId");
|
||||
b.HasKey("UserId", "EventId");
|
||||
|
||||
b.HasIndex("EventId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("EventRegistrations");
|
||||
});
|
||||
|
||||
@@ -524,7 +519,9 @@ namespace WebApp.Migrations
|
||||
|
||||
b.HasOne("WebApp.Entities.User", "User")
|
||||
.WithMany("EventRegistrations")
|
||||
.HasForeignKey("UserId");
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Event");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user