Generator Changes at 9/27/2025 8:46:36 AM

This commit is contained in:
generator
2025-09-27 08:46:36 +03:30
parent fd82e3edcf
commit fd8614f72e
261 changed files with 6333 additions and 0 deletions
@@ -0,0 +1,20 @@
using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class PackageConfiguration : IEntityTypeConfiguration<Package>
{
public void Configure(EntityTypeBuilder<Package> builder)
{
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.Title).IsRequired(true);
builder.Property(entity => entity.Description).IsRequired(true);
builder.Property(entity => entity.ImagePath).IsRequired(true);
builder.Property(entity => entity.Price).IsRequired(true);
}
}
@@ -0,0 +1,18 @@
using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class RoleConfiguration : IEntityTypeConfiguration<Role>
{
public void Configure(EntityTypeBuilder<Role> builder)
{
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.Name).IsRequired(true);
builder.Property(entity => entity.Title).IsRequired(true);
}
}
@@ -0,0 +1,26 @@
using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class UserAddressConfiguration : IEntityTypeConfiguration<UserAddress>
{
public void Configure(EntityTypeBuilder<UserAddress> 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.UserAddresss)
.HasForeignKey(entity => entity.UserId)
.IsRequired(true);
builder.Property(entity => entity.Title).IsRequired(true);
builder.Property(entity => entity.Address).IsRequired(true);
builder.Property(entity => entity.PostalCode).IsRequired(true);
builder.Property(entity => entity.IsDefault).IsRequired(true);
builder.Property(entity => entity.CityId).IsRequired(true);
}
}
@@ -0,0 +1,26 @@
using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class UserConfiguration : IEntityTypeConfiguration<User>
{
public void Configure(EntityTypeBuilder<User> builder)
{
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.FirstName).IsRequired(false);
builder.Property(entity => entity.LastName).IsRequired(false);
builder.Property(entity => entity.Mobile).IsRequired(true);
builder.Property(entity => entity.NationalCode).IsRequired(false);
builder.Property(entity => entity.AvatarPath).IsRequired(false);
builder
.HasOne(entity => entity.Parent)
.WithMany(entity => entity.Users)
.HasForeignKey(entity => entity.ParentId)
.IsRequired(false);
}
}
@@ -0,0 +1,30 @@
using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class UserOrderConfiguration : IEntityTypeConfiguration<UserOrder>
{
public void Configure(EntityTypeBuilder<UserOrder> builder)
{
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.Price).IsRequired(true);
builder
.HasOne(entity => entity.Package)
.WithMany(entity => entity.UserOrders)
.HasForeignKey(entity => entity.PackageId)
.IsRequired(true);
builder.Property(entity => entity.TransactionId).IsRequired(false);
builder.Property(entity => entity.PaymentStatus).IsRequired(true);
builder.Property(entity => entity.PaymentDate).IsRequired(false);
builder
.HasOne(entity => entity.User)
.WithMany(entity => entity.UserOrders)
.HasForeignKey(entity => entity.UserId)
.IsRequired(true);
}
}
@@ -0,0 +1,26 @@
using CMSMicroservice.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
public class UserRoleConfiguration : IEntityTypeConfiguration<UserRole>
{
public void Configure(EntityTypeBuilder<UserRole> 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.Role)
.WithMany(entity => entity.UserRoles)
.HasForeignKey(entity => entity.RoleId)
.IsRequired(true);
builder
.HasOne(entity => entity.User)
.WithMany(entity => entity.UserRoles)
.HasForeignKey(entity => entity.UserId)
.IsRequired(true);
}
}