mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-16 20:56:03 +00:00
2e9d7e625e
Adds server-side group and channel management, private invitations, member moderation, avatar handling, and required-channel configuration. This change also introduces SignalR group profile/member notifications, updates registration to atomically join required channels, and adds EF migration and test coverage for group membership, permissions, and invitation expiry rules.
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Govor.Domain.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Govor.Domain.Configurations;
|
|
|
|
public class ChatGroupConfigurator : IEntityTypeConfiguration<ChatGroup>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ChatGroup> builder)
|
|
{
|
|
builder.HasKey(e => e.Id);
|
|
|
|
builder.Property(e => e.Name).IsRequired().HasMaxLength(100);
|
|
builder.Property(e => e.Description).HasMaxLength(500);
|
|
builder.HasOne<Govor.Domain.Models.Users.User>().WithMany()
|
|
.HasForeignKey(e => e.OwnerUserId).OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasMany(e => e.Members)
|
|
.WithOne(e => e.ChatGroup)
|
|
.HasForeignKey(e => e.GroupId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasMany(e => e.Admins)
|
|
.WithOne()
|
|
.HasForeignKey(e => e.GroupId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
|
|
builder.HasMany(e => e.InviteCodes)
|
|
.WithOne()
|
|
.HasForeignKey(e => e.GroupId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|