Add validators and services for Product Galleries and Product Tags
- Implemented Create, Delete, Get, and Update validators for Product Galleries. - Added Create, Delete, Get, and Update validators for Product Tags. - Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags. - Each service class integrates with CQRS for command and query handling. - Established mapping profiles for Product Galleries.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
||||
//محصول
|
||||
public class ProductConfiguration : IEntityTypeConfiguration<Product>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Product> 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.ShortInfomation).IsRequired(true);
|
||||
builder.Property(entity => entity.FullInformation).IsRequired(true);
|
||||
builder.Property(entity => entity.Price).IsRequired(true);
|
||||
builder.Property(entity => entity.Discount).IsRequired(true);
|
||||
builder.Property(entity => entity.Rate).IsRequired(true);
|
||||
builder.Property(entity => entity.ImagePath).IsRequired(true);
|
||||
builder.Property(entity => entity.ThumbnailPath).IsRequired(true);
|
||||
builder.Property(entity => entity.SaleCount).IsRequired(true);
|
||||
builder.Property(entity => entity.ViewCount).IsRequired(true);
|
||||
builder.Property(entity => entity.RemainingCount).IsRequired(true);
|
||||
|
||||
// ============= Club Shop Fields =============
|
||||
builder.Property(entity => entity.IsClubExclusive).IsRequired(true);
|
||||
builder.Property(entity => entity.ClubDiscountPercent).IsRequired(true);
|
||||
|
||||
// Index برای IsClubExclusive
|
||||
builder.HasIndex(e => e.IsClubExclusive)
|
||||
.HasDatabaseName("IX_Products_IsClubExclusive");
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user