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:
@@ -532,10 +532,12 @@ public class SVSimDbContext : DbContext
|
||||
|
||||
modelBuilder.Entity<GuildInvite>(e =>
|
||||
{
|
||||
e.HasKey(i => new { i.GuildId, i.InviteeViewerId });
|
||||
e.HasKey(i => i.Id);
|
||||
e.Property(i => i.Id).ValueGeneratedOnAdd();
|
||||
e.HasOne(i => i.Guild).WithMany().HasForeignKey(i => i.GuildId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
e.HasIndex(i => new { i.InviteeViewerId, i.Status }); // "my pending invites"
|
||||
e.HasIndex(i => new { i.GuildId, i.InviteeViewerId }).IsUnique(); // one pending invite per pair
|
||||
e.HasIndex(i => new { i.InviteeViewerId, i.Status }); // "my pending invites"
|
||||
});
|
||||
|
||||
modelBuilder.Entity<GuildJoinRequest>(e =>
|
||||
|
||||
Reference in New Issue
Block a user