feat(user): add user invitation functionality and enhance OTP verification
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.
This commit is contained in:
masoodafar-web
2026-09-20 23:33:03 +03:30
parent f31fb5ee39
commit 2b958bd214
17 changed files with 6019 additions and 3 deletions
@@ -0,0 +1,38 @@
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");
}
}