2025-11-12 02:24:02 +03:30
|
|
|
using CMSMicroservice.Domain.Entities;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
|
|
|
|
//آدرس کاربر
|
|
|
|
|
public class UserWalletConfiguration : IEntityTypeConfiguration<UserWallet>
|
|
|
|
|
{
|
|
|
|
|
public void Configure(EntityTypeBuilder<UserWallet> builder)
|
|
|
|
|
{
|
|
|
|
|
builder.HasQueryFilter(p => !p.IsDeleted);
|
|
|
|
|
builder.Ignore(entity => entity.DomainEvents);
|
|
|
|
|
builder.HasKey(entity => entity.Id);
|
|
|
|
|
builder.Property(entity => entity.Id).UseIdentityColumn();
|
|
|
|
|
builder
|
|
|
|
|
.HasOne(entity => entity.User)
|
|
|
|
|
.WithMany(entity => entity.UserWallets)
|
|
|
|
|
.HasForeignKey(entity => entity.UserId)
|
|
|
|
|
.IsRequired(true);
|
|
|
|
|
builder.Property(entity => entity.Balance).IsRequired(true);
|
2025-11-25 02:03:51 +03:30
|
|
|
builder.Property(entity => entity.NetworkBalance).IsRequired(true);
|
2025-11-29 03:52:46 +03:30
|
|
|
builder.Property(entity => entity.DiscountBalance).IsRequired(true);
|
2025-11-12 02:24:02 +03:30
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|