feat(guild): invite state machine
Add surrogate PK (IDENTITY bigint) to GuildInvite for wire invite_id. Implement InviteAsync, CancelInviteAsync, RejectInviteAsync, ListOutgoingInvitesAsync, ListInvitedGuildsAsync in GuildService. Wire 5 endpoints: invite_user_list, invited_guild_list, invite, cancel_invite, reject_invite in GuildController. Migration: AddGuildInviteSurrogatePk — drops composite PK, adds Id IDENTITY column, adds unique index on (GuildId, InviteeViewerId). 6 integration tests in GuildInviteFlowTests all green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
5007
SVSim.Database/Migrations/20260627171751_AddGuildInviteSurrogatePk.Designer.cs
generated
Normal file
5007
SVSim.Database/Migrations/20260627171751_AddGuildInviteSurrogatePk.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddGuildInviteSurrogatePk : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_GuildInvites",
|
||||
table: "GuildInvites");
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "Id",
|
||||
table: "GuildInvites",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_GuildInvites",
|
||||
table: "GuildInvites",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GuildInvites_GuildId_InviteeViewerId",
|
||||
table: "GuildInvites",
|
||||
columns: new[] { "GuildId", "InviteeViewerId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_GuildInvites",
|
||||
table: "GuildInvites");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GuildInvites_GuildId_InviteeViewerId",
|
||||
table: "GuildInvites");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Id",
|
||||
table: "GuildInvites");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_GuildInvites",
|
||||
table: "GuildInvites",
|
||||
columns: new[] { "GuildId", "InviteeViewerId" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -171,15 +171,21 @@ namespace SVSim.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Entities.Guild.GuildInvite", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("GuildId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("InviteeViewerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<long>("InviterViewerId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -189,7 +195,10 @@ namespace SVSim.Database.Migrations
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("GuildId", "InviteeViewerId");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GuildId", "InviteeViewerId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("InviteeViewerId", "Status");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user