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:
+27
@@ -0,0 +1,27 @@
|
||||
using CMSMicroservice.Domain.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
namespace CMSMicroservice.Infrastructure.Persistence.Configurations;
|
||||
//تنظیمات سبد خرید کاربر
|
||||
public class UserCartConfiguration : IEntityTypeConfiguration<UserCart>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserCart> 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.Product)
|
||||
.WithMany(entity => entity.UserCarts)
|
||||
.HasForeignKey(entity => entity.ProductId)
|
||||
.IsRequired(true);
|
||||
builder
|
||||
.HasOne(entity => entity.User)
|
||||
.WithMany(entity => entity.UserCarts)
|
||||
.HasForeignKey(entity => entity.UserId)
|
||||
.IsRequired(true);
|
||||
builder.Property(entity => entity.Count).IsRequired(true);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user