mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
a68feb4a17
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.
23 lines
781 B
C#
23 lines
781 B
C#
using Govor.Core.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Govor.Data.Configurations;
|
|
|
|
public class GroupMembershipConfiguration : IEntityTypeConfiguration<GroupMembership>
|
|
{
|
|
public void Configure(EntityTypeBuilder<GroupMembership> builder)
|
|
{
|
|
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);
|
|
}
|
|
} |