mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Refactor group existence checks and add group repo tests
Renamed IGroupsExist and related methods from Exists to Exist for consistency. Added integration tests for GroupRepository. Introduced entity configurations for ChatGroup, GroupAdmins, GroupInvitation, and updated GroupMembership configuration. Updated usages and tests to match new method names and improved equality checks for ChatGroup.
This commit is contained in:
@@ -8,6 +8,16 @@ public class GroupMembershipConfiguration : IEntityTypeConfiguration<GroupMember
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<GroupMembership> builder)
|
||||
{
|
||||
builder.HasKey(m => new { m.GroupId, m.UserId });
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
builder.Property(e => e.UserId).IsRequired();
|
||||
builder.Property(e => e.GroupId).IsRequired();
|
||||
builder.Property(e => e.InvitationId).IsRequired();
|
||||
|
||||
// Optional: можно добавить навигацию к GroupInvitation
|
||||
builder.HasOne<GroupInvitation>()
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.InvitationId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user