2b958bd214
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 9m27s
- Introduced UserInvitation entity and updated IApplicationDbContext to include UserInvitations DbSet. - Enhanced VerifyOtpTokenCommand and its handler to support optional inviter mobile number for user registration. - Added new Protobuf definitions for GetMyInvitees and GetInvitationsByFilter RPCs to manage user invitations. - Updated UserService to implement methods for retrieving invitees and invitations based on filters. - Bumped Protobuf project version to reflect the addition of new features.
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using CMSMicroservice.Domain.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
|
|
|
public class UserInvitationConfiguration : IEntityTypeConfiguration<UserInvitation>
|
|
{
|
|
public void Configure(EntityTypeBuilder<UserInvitation> builder)
|
|
{
|
|
builder.ToTable("UserInvitations");
|
|
builder.HasQueryFilter(p => !p.IsDeleted);
|
|
builder.Ignore(entity => entity.DomainEvents);
|
|
|
|
builder.HasKey(entity => entity.Id);
|
|
builder.Property(entity => entity.Id).UseIdentityColumn();
|
|
|
|
builder.Property(entity => entity.InviterUserId).IsRequired();
|
|
builder.Property(entity => entity.InviteeUserId).IsRequired();
|
|
|
|
builder.HasOne(entity => entity.Inviter)
|
|
.WithMany()
|
|
.HasForeignKey(entity => entity.InviterUserId)
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasOne(entity => entity.Invitee)
|
|
.WithMany()
|
|
.HasForeignKey(entity => entity.InviteeUserId)
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
builder.HasIndex(e => e.InviteeUserId)
|
|
.IsUnique()
|
|
.HasDatabaseName("IX_UserInvitations_InviteeUserId");
|
|
|
|
builder.HasIndex(e => new { e.InviterUserId, e.Created })
|
|
.HasDatabaseName("IX_UserInvitations_InviterUserId_Created");
|
|
}
|
|
}
|