Files
Govor/Govor.Data/Configurations/GroupMembershipConfiguration.cs
T
Artemy c0d02e0fa1 Add access control for media downloads
Introduced IAccesserToDownloadMedia and its implementation to enforce access checks when downloading media files. Updated MediaController to use the new accesser service and improved error handling and validation in upload/download actions. Refactored and moved MediaService to the Medias namespace, registered new services in DI, and added comprehensive tests for access logic. Also fixed GroupMembershipConfiguration to make InvitationId optional and performed minor test and namespace cleanups.
2025-07-21 14:51:57 +07:00

23 lines
786 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(false);
// Optional: можно добавить навигацию к GroupInvitation
builder.HasOne<GroupInvitation>()
.WithMany()
.HasForeignKey(e => e.InvitationId)
.OnDelete(DeleteBehavior.SetNull);
}
}