Compare commits
No commits in common. "master" and "subProduct" have entirely different histories.
master
...
subProduct
|
@ -38,11 +38,6 @@ public class PageController : ICarterModule
|
|||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManagePages));
|
||||
|
||||
group.MapPut("", UpdatePageAsync)
|
||||
.WithDisplayName("Update Page")
|
||||
.HasApiVersion(1.0)
|
||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManagePages));
|
||||
|
||||
group.MapDelete("{id}", DeletePageByIdAsync)
|
||||
.WithDisplayName("Delete Page")
|
||||
.HasApiVersion(1.0)
|
||||
|
@ -60,25 +55,27 @@ public class PageController : ICarterModule
|
|||
=> TypedResults.Ok(await pageService.DeletePageAsync(id, cancellationToken));
|
||||
|
||||
public async Task<IResult> GetPagesAsync([FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await pageService.GetPagesAsync(cancellationToken));
|
||||
{
|
||||
return TypedResults.Ok(await pageService.GetPagesAsync(cancellationToken));
|
||||
}
|
||||
|
||||
public async Task<IResult> GetPageByIdAsync(Guid id ,[FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await pageService.GetPageAsync(id: id, cancellationToken: cancellationToken));
|
||||
{
|
||||
return TypedResults.Ok(await pageService.GetPageAsync(id: id,cancellationToken: cancellationToken));
|
||||
}
|
||||
public async Task<IResult> GetPageByTypeAsync(string type, [FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await pageService.GetPageAsync(type: type, cancellationToken: cancellationToken));
|
||||
{
|
||||
return TypedResults.Ok(await pageService.GetPageAsync(type: type, cancellationToken: cancellationToken));
|
||||
}
|
||||
|
||||
public async Task<IResult> GetPageAsync(string pageSlug, [FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await pageService.GetPageAsync(pageSlug: pageSlug, cancellationToken: cancellationToken));
|
||||
{
|
||||
return TypedResults.Ok(await pageService.GetPageAsync(pageSlug: pageSlug,cancellationToken: cancellationToken));
|
||||
}
|
||||
|
||||
public async Task<IResult> PostPageAsync([FromBody] PageActionRequestDto page, [FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
{
|
||||
await pageService.CreatePageAsync(page, cancellationToken);
|
||||
return TypedResults.Ok();
|
||||
}
|
||||
|
||||
public async Task<IResult> UpdatePageAsync([FromBody] PageActionRequestDto page, [FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||
{
|
||||
await pageService.UpdatePageAsync(page, cancellationToken);
|
||||
return TypedResults.Ok();
|
||||
}
|
||||
}
|
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<AssemblyVersion>1.14.22.42</AssemblyVersion>
|
||||
<FileVersion>1.14.22.42</FileVersion>
|
||||
<AssemblyVersion>1.10.21.36</AssemblyVersion>
|
||||
<FileVersion>1.10.21.36</FileVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
public interface IPageService : IScopedDependency
|
||||
{
|
||||
Task<BasePageLDto> GetPageAsync(Guid? id = null, string? pageName = null, string? pageSlug = null, string? type = null, CancellationToken cancellationToken = default);
|
||||
Task<BasePageSDto> GetPageAsync(Guid? id = null, string? pageName = null, string? pageSlug = null, string? type = null, CancellationToken cancellationToken = default);
|
||||
Task<List<BasePageSDto>> GetPagesAsync(CancellationToken cancellationToken = default);
|
||||
Task<bool> CreatePageAsync(PageActionRequestDto entity, CancellationToken cancellationToken = default);
|
||||
Task<bool> UpdatePageAsync(PageActionRequestDto entity, CancellationToken cancellationToken = default);
|
||||
Task<bool> DeletePageAsync(Guid id, CancellationToken cancellationToken = default);
|
||||
|
||||
Task<string> CheckRedirectAsync(string oldUrl, CancellationToken cancellationToken);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Netina.Domain.MartenEntities.Pages;
|
||||
using Netina.Core.BaseServices.Abstracts;
|
||||
using Netina.Domain.MartenEntities.Pages;
|
||||
|
||||
namespace Netina.Core.BaseServices;
|
||||
|
||||
|
@ -8,11 +9,7 @@ public class PageService(
|
|||
ISettingService settingService)
|
||||
: IPageService
|
||||
{
|
||||
public async Task<BasePageLDto> GetPageAsync(Guid? id = null,
|
||||
string? pageName = null,
|
||||
string? pageSlug = null,
|
||||
string? type = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
public async Task<BasePageSDto> GetPageAsync(Guid? id = null, string? pageName = null, string? pageSlug = null, string? type = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
BasePage? page = null;
|
||||
if (id != null)
|
||||
|
@ -26,7 +23,18 @@ public class PageService(
|
|||
if (page == null)
|
||||
throw new AppException("Page not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var dto = page.Adapt<BasePageLDto>();
|
||||
var entityType = Assembly.GetAssembly(typeof(DomainConfig))?.GetType(page.Type);
|
||||
var dto = new BasePageSDto
|
||||
{
|
||||
Content = page.Content,
|
||||
Description = page.Description,
|
||||
Id = page.Id,
|
||||
IsCustomPage = page.IsCustomPage,
|
||||
IsHtmlBasePage = page.IsHtmlBasePage,
|
||||
Title = page.Title,
|
||||
Slug = page.Slug,
|
||||
Data = page.Data
|
||||
};
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
@ -37,7 +45,19 @@ public class PageService(
|
|||
var pages = await martenRepositoryWrapperWrapper.SetRepository<BasePage>().GetEntitiesAsync(cancellationToken);
|
||||
foreach (var page in pages)
|
||||
{
|
||||
var dto = page.Adapt<BasePageSDto>();
|
||||
var dto = new BasePageSDto
|
||||
{
|
||||
Content = page.Content,
|
||||
Description = page.Description,
|
||||
Id = page.Id,
|
||||
IsCustomPage = page.IsCustomPage,
|
||||
IsHtmlBasePage = page.IsHtmlBasePage,
|
||||
Title = page.Title,
|
||||
Slug = page.Slug,
|
||||
Data = page.Data,
|
||||
CreatedAt = page.CreatedAt,
|
||||
ModifiedAt = page.ModifiedAt
|
||||
};
|
||||
sDtos.Add(dto);
|
||||
}
|
||||
return sDtos;
|
||||
|
@ -56,9 +76,7 @@ public class PageService(
|
|||
Type = entity.Type,
|
||||
Slug = entity.Slug,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedBy = currentUserService.UserName ?? string.Empty,
|
||||
Indexing = entity.Indexing,
|
||||
Sections = entity.Sections
|
||||
CreatedBy = currentUserService.UserName ?? string.Empty
|
||||
};
|
||||
if (!basePage.Type.IsNullOrEmpty())
|
||||
{
|
||||
|
@ -106,11 +124,4 @@ public class PageService(
|
|||
}
|
||||
throw new BaseApiException(ApiResultStatusCode.NotFound, "PageSetting not found");
|
||||
}
|
||||
|
||||
public async Task<bool> UpdatePageAsync(PageActionRequestDto entity, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var basePage = entity.Adapt<BasePage>();
|
||||
await martenRepositoryWrapperWrapper.SetRepository<BasePage>().AddOrUpdateEntityAsync(basePage, cancellationToken);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -123,7 +123,7 @@ public class SiteMapService(
|
|||
root.SetAttribute("xmlns:image", "http://www.google.com/schemas/sitemap-image/1.1");
|
||||
doc.AppendChild(root);
|
||||
|
||||
foreach (var page in pages.Where(p=>p.Indexing))
|
||||
foreach (var page in pages)
|
||||
{
|
||||
string slugHtml = page.Slug;
|
||||
if (slugHtml.Contains(' '))
|
||||
|
|
|
@ -73,18 +73,6 @@ public class CalculateOrderDiscountCommandHandler(
|
|||
|
||||
}
|
||||
}
|
||||
else if (discount.Type == DiscountType.Brand)
|
||||
{
|
||||
|
||||
var brandDiscount = await repositoryWrapper.SetRepository<BrandDiscount>()
|
||||
.TableNoTracking
|
||||
.FirstOrDefaultAsync(d => d.Code == request.DiscountCode, cancellationToken);
|
||||
|
||||
if (brandDiscount != null && !brandDiscount.IsExpired())
|
||||
{
|
||||
totalPrice = request.Order.OrderProducts.Where(op => op.BrandId == brandDiscount.BrandId).Sum(op => op.ProductCost);
|
||||
}
|
||||
}
|
||||
else if (discount.Type == DiscountType.Subscriber)
|
||||
{
|
||||
throw new NotImplementedException("Subscribe discount not implemented");
|
||||
|
|
|
@ -31,7 +31,7 @@ public class AddToOrderBagCommandHandler(
|
|||
await mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken);
|
||||
|
||||
orderBag.AddToOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount,
|
||||
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId,productSDto.BrandId, requestDto.Count);
|
||||
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId, requestDto.Count);
|
||||
}
|
||||
|
||||
repositoryWrapper.SetRepository<Order>().Update(orderBag);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class SubmitOrderBagCommandHandler(
|
|||
await mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken);
|
||||
|
||||
orderBag.ChangeOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount,
|
||||
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId,productSDto.BrandId, requestDto.Count);
|
||||
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId, requestDto.Count);
|
||||
}
|
||||
foreach (var orderProduct in orderBag.OrderProducts.ToList())
|
||||
{
|
||||
|
|
|
@ -35,10 +35,9 @@ public class CalculateOrderCommandHandler(IRepositoryWrapper repositoryWrapper,
|
|||
order.RemoveDiscount();
|
||||
}
|
||||
|
||||
if (totalProductPrice > 5000000)
|
||||
deliveryPrice = 0;
|
||||
var taxesPrice = (((totalProductPrice - (discountCodePrice + productDiscountPrice)) + totalPackingPrice + servicePrice) / 100) * taxesFee;
|
||||
|
||||
|
||||
order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, productDiscountPrice, discountCodePrice, taxesPrice);
|
||||
order.OrderProducts.Clear();
|
||||
order.OrderDelivery = null;
|
||||
|
|
|
@ -21,8 +21,7 @@ bool IsForInvitation,
|
|||
bool IsSpecialOffer,
|
||||
bool IsForFirstPurchase,
|
||||
Guid ProductId,
|
||||
Guid CategoryId,
|
||||
Guid BrandId) : IRequest<DiscountLDto>;
|
||||
Guid CategoryId) : IRequest<DiscountLDto>;
|
||||
|
||||
public sealed record UpdateDiscountCommand(
|
||||
Guid Id,
|
||||
|
@ -47,8 +46,7 @@ public sealed record UpdateDiscountCommand(
|
|||
bool IsSpecialOffer,
|
||||
bool IsForFirstPurchase,
|
||||
Guid ProductId,
|
||||
Guid CategoryId,
|
||||
Guid BrandId) : IRequest<bool>;
|
||||
Guid CategoryId) : IRequest<bool>;
|
||||
|
||||
|
||||
public sealed record DeleteDiscountCommand(Guid Id) : IRequest<bool>;
|
||||
|
|
|
@ -5,7 +5,6 @@ public sealed record CreateSubProductCommand(
|
|||
Guid ParentId,
|
||||
ProductDiversity Diversity,
|
||||
string DiversityValue,
|
||||
string DiversitySecondaryValue,
|
||||
string DiversityDescription,
|
||||
string PersianName,
|
||||
double Cost,
|
||||
|
@ -20,7 +19,6 @@ public sealed record UpdateSubProductCommand(
|
|||
Guid ParentId,
|
||||
ProductDiversity Diversity,
|
||||
string DiversityValue,
|
||||
string DiversitySecondaryValue,
|
||||
string DiversityDescription,
|
||||
string PersianName,
|
||||
double Cost,
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace Netina.Domain.Dtos.LargDtos;
|
||||
public class BasePageLDto : BaseDto<BasePageLDto, BasePage>
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public bool IsCustomPage { get; set; }
|
||||
public bool IsHtmlBasePage { get; set; }
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
public string Data { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public DateTime ModifiedAt { get; set; }
|
||||
public bool Indexing { get; set; }
|
||||
public List<BasePageSection> Sections { get; set; } = new();
|
||||
}
|
|
@ -23,8 +23,6 @@ public class DiscountLDto : BaseDto<DiscountLDto,Discount>
|
|||
public bool IsForInvitation { get; set; }
|
||||
public Guid ProductId { get; set; }
|
||||
public string ProductName { get; set; } = string.Empty;
|
||||
public Guid BrandId { get; set; }
|
||||
public string BrandName { get; set; } = string.Empty;
|
||||
public Guid CategoryId { get; set; }
|
||||
public string CategoryName { get; set; } = string.Empty;
|
||||
public bool IsForFirstPurchase { get; set; }
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using Netina.Domain.MartenEntities.Pages;
|
||||
|
||||
namespace Netina.Domain.Dtos.RequestDtos;
|
||||
namespace Netina.Domain.Dtos.RequestDtos;
|
||||
|
||||
public class PageActionRequestDto
|
||||
{
|
||||
|
@ -13,6 +11,4 @@ public class PageActionRequestDto
|
|||
public string Slug { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public object? Data { get; set; }
|
||||
public bool Indexing { get; set; }
|
||||
public List<BasePageSection> Sections { get; set; } = new();
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using Newtonsoft.Json;
|
||||
using Netina.Domain.MartenEntities.Pages;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Netina.Domain.Dtos.SmallDtos;
|
||||
|
||||
|
@ -12,7 +13,6 @@ public class BasePageSDto : BaseDto<BasePageSDto,BasePage>
|
|||
public string Slug { get; set; } = string.Empty;
|
||||
public string Data { get; set; } = string.Empty;
|
||||
public DateTime ModifiedAt { get; set; }
|
||||
public bool Indexing { get; set; } = true;
|
||||
|
||||
public T GetData<T>() => JsonConvert.DeserializeObject<T>(Data);
|
||||
}
|
|
@ -12,5 +12,4 @@ public class SubProductSDto : BaseDto<SubProductSDto,SubProduct>
|
|||
public ProductDiversity Diversity { get; set; }
|
||||
public string DiversityValue { get; set; } = string.Empty;
|
||||
public string DiversityDescription { get; set; } = string.Empty;
|
||||
public string DiversitySecondaryValue { get; set; } = string.Empty;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
namespace Netina.Domain.Entities.Discounts;
|
||||
|
||||
public partial class BrandDiscount : Discount
|
||||
{
|
||||
public BrandDiscount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BrandDiscount(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
||||
int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling,
|
||||
bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,
|
||||
bool isForFirstPurchase, bool isSpecialOffer , Guid brandId)
|
||||
: base(code, description, discountPercent, discountAmount, hasCode, amountType, type, count, startDate, expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
|
||||
isForInvitation, isSpecialOffer,isForFirstPurchase, immortal)
|
||||
{
|
||||
BrandId = brandId;
|
||||
}
|
||||
public Guid BrandId { get; internal set; }
|
||||
public Brand? Brand { get; internal set; }
|
||||
}
|
|
@ -39,19 +39,6 @@ public partial class Discount
|
|||
}
|
||||
}
|
||||
|
||||
public partial class BrandDiscount
|
||||
{
|
||||
public static BrandDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
||||
int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling,
|
||||
bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,
|
||||
bool isForFirstPurchase, bool isSpecialOffer, Guid brandId)
|
||||
{
|
||||
return new BrandDiscount(code, description, discountPercent, discountAmount, hasCode, amountType, type, count, immortal, startDate,
|
||||
expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount,
|
||||
isForInvitation, isForFirstPurchase, isSpecialOffer, brandId);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ProductDiscount
|
||||
{
|
||||
public static ProductDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
||||
|
|
|
@ -12,14 +12,7 @@ public partial class Order
|
|||
|
||||
}
|
||||
|
||||
public void AddToOrderBag(Guid productId,
|
||||
double cost,
|
||||
double costWithDiscount,
|
||||
bool hasDiscount,
|
||||
double packingCost,
|
||||
Guid categoryId,
|
||||
Guid brandId,
|
||||
int count)
|
||||
public void AddToOrderBag(Guid productId, double cost, double costWithDiscount, bool hasDiscount, double packingCost, Guid categoryId, int count)
|
||||
{
|
||||
var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId);
|
||||
if (orderProduct == null)
|
||||
|
@ -32,7 +25,6 @@ public partial class Order
|
|||
OrderStatus.OrderBag,
|
||||
productId,
|
||||
categoryId,
|
||||
brandId,
|
||||
this.Id);
|
||||
OrderProducts.Add(orderProduct);
|
||||
}
|
||||
|
@ -52,10 +44,7 @@ public partial class Order
|
|||
}
|
||||
}
|
||||
|
||||
public void ChangeOrderBag(Guid productId, double cost, double costWithDiscount, bool hasDiscount, double packingCost,
|
||||
Guid categoryId,
|
||||
Guid brandId,
|
||||
int count)
|
||||
public void ChangeOrderBag(Guid productId, double cost, double costWithDiscount, bool hasDiscount, double packingCost, Guid categoryId, int count)
|
||||
{
|
||||
var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId);
|
||||
if (orderProduct != null)
|
||||
|
@ -63,10 +52,10 @@ public partial class Order
|
|||
if (orderProduct.Count > count)
|
||||
RemoveFromOrderBag(productId, count);
|
||||
else
|
||||
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId,brandId, count);
|
||||
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId, count);
|
||||
}
|
||||
else
|
||||
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId, brandId, count);
|
||||
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId, count);
|
||||
|
||||
}
|
||||
|
||||
|
@ -176,16 +165,11 @@ public partial class OrderProduct
|
|||
OrderStatus orderProductStatus,
|
||||
Guid productId,
|
||||
Guid productCategoryId,
|
||||
Guid brandId,
|
||||
Guid orderId)
|
||||
{
|
||||
var productCost = count * productFeeWithDiscount;
|
||||
var packingCost = count * packingFee;
|
||||
return new OrderProduct(count, productFee,
|
||||
productFeeWithDiscount, hasDiscount,
|
||||
productCost, packingFee, packingCost,
|
||||
orderProductStatus, productId,
|
||||
productCategoryId, orderId,brandId);
|
||||
return new OrderProduct(count, productFee, productFeeWithDiscount, hasDiscount, productCost, packingFee, packingCost, orderProductStatus, productId, productCategoryId, orderId);
|
||||
}
|
||||
|
||||
public void SetCount(int count)
|
||||
|
|
|
@ -19,8 +19,7 @@ public partial class OrderProduct : ApiEntity
|
|||
OrderStatus orderProductStatus,
|
||||
Guid productId,
|
||||
Guid productCategoryId,
|
||||
Guid orderId,
|
||||
Guid brandId)
|
||||
Guid orderId)
|
||||
{
|
||||
Count = count;
|
||||
ProductFee = productFee;
|
||||
|
@ -33,7 +32,6 @@ public partial class OrderProduct : ApiEntity
|
|||
ProductCategoryId = productCategoryId;
|
||||
PackingFee = packingFee;
|
||||
PackingCost = packingCost;
|
||||
BrandId = brandId;
|
||||
}
|
||||
public int Count { get; internal set; }
|
||||
public double ProductFee { get; internal set; }
|
||||
|
@ -45,7 +43,6 @@ public partial class OrderProduct : ApiEntity
|
|||
public OrderStatus OrderProductStatus { get; internal set; }
|
||||
|
||||
public Guid ProductId { get; internal set; }
|
||||
public Guid BrandId { get; internal set; }
|
||||
public Guid ProductCategoryId { get; internal set; }
|
||||
public Product? Product { get; internal set; }
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ public partial class SubProduct
|
|||
Guid parentId,
|
||||
ProductDiversity diversity,
|
||||
string diversityValue,
|
||||
string diversitySecondaryValue,
|
||||
string diversityDescription,
|
||||
string persianName,
|
||||
string englishName,
|
||||
|
@ -130,7 +129,6 @@ public partial class SubProduct
|
|||
parentId,
|
||||
diversity,
|
||||
diversityValue,
|
||||
diversitySecondaryValue,
|
||||
diversityDescription,
|
||||
persianName,
|
||||
englishName,
|
||||
|
|
|
@ -14,7 +14,6 @@ public partial class SubProduct : Product
|
|||
Guid parentId,
|
||||
ProductDiversity diversity,
|
||||
string diversityValue,
|
||||
string diversitySecondaryValue,
|
||||
string diversityDescription,
|
||||
string persianName,
|
||||
string englishName,
|
||||
|
@ -54,7 +53,6 @@ public partial class SubProduct : Product
|
|||
ParentId = parentId;
|
||||
Diversity = diversity;
|
||||
DiversityValue = diversityValue;
|
||||
DiversitySecondaryValue = diversitySecondaryValue;
|
||||
DiversityDescription = diversityDescription;
|
||||
}
|
||||
|
||||
|
@ -63,6 +61,5 @@ public partial class SubProduct : Product
|
|||
|
||||
public ProductDiversity Diversity { get; internal set; }
|
||||
public string DiversityValue { get; internal set; } = string.Empty;
|
||||
public string DiversitySecondaryValue { get; internal set; } = string.Empty;
|
||||
public string DiversityDescription { get; internal set; } = string.Empty;
|
||||
}
|
|
@ -9,7 +9,5 @@ public enum DiscountType
|
|||
[Display(Name = "دسته ای")]
|
||||
Category = 2,
|
||||
[Display(Name = "مشترکی")]
|
||||
Subscriber = 3,
|
||||
[Display(Name = "برند")]
|
||||
Brand = 4,
|
||||
Subscriber = 3
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
namespace Netina.Domain.Mappers
|
||||
{
|
||||
public static partial class BrandDiscountMapper
|
||||
{
|
||||
}
|
||||
}
|
|
@ -15,7 +15,6 @@ namespace Netina.Domain.Mappers
|
|||
ParentId = (Guid?)p1.ParentId,
|
||||
Diversity = p1.Diversity,
|
||||
DiversityValue = p1.DiversityValue,
|
||||
DiversitySecondaryValue = p1.DiversitySecondaryValue,
|
||||
DiversityDescription = p1.DiversityDescription,
|
||||
PersianName = p1.PersianName,
|
||||
Cost = p1.Cost,
|
||||
|
@ -38,7 +37,6 @@ namespace Netina.Domain.Mappers
|
|||
result.ParentId = (Guid?)p2.ParentId;
|
||||
result.Diversity = p2.Diversity;
|
||||
result.DiversityValue = p2.DiversityValue;
|
||||
result.DiversitySecondaryValue = p2.DiversitySecondaryValue;
|
||||
result.DiversityDescription = p2.DiversityDescription;
|
||||
result.PersianName = p2.PersianName;
|
||||
result.Cost = p2.Cost;
|
||||
|
@ -65,7 +63,6 @@ namespace Netina.Domain.Mappers
|
|||
Diversity = p4.Diversity,
|
||||
DiversityValue = p4.DiversityValue,
|
||||
DiversityDescription = p4.DiversityDescription,
|
||||
DiversitySecondaryValue = p4.DiversitySecondaryValue,
|
||||
Id = p4.Id,
|
||||
CreatedAt = p4.CreatedAt
|
||||
};
|
||||
|
@ -88,7 +85,6 @@ namespace Netina.Domain.Mappers
|
|||
result.Diversity = p5.Diversity;
|
||||
result.DiversityValue = p5.DiversityValue;
|
||||
result.DiversityDescription = p5.DiversityDescription;
|
||||
result.DiversitySecondaryValue = p5.DiversitySecondaryValue;
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
return result;
|
||||
|
@ -106,7 +102,6 @@ namespace Netina.Domain.Mappers
|
|||
Diversity = p7.Diversity,
|
||||
DiversityValue = p7.DiversityValue,
|
||||
DiversityDescription = p7.DiversityDescription,
|
||||
DiversitySecondaryValue = p7.DiversitySecondaryValue,
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
|
|
|
@ -10,35 +10,4 @@ public class BasePage : MartenEntity
|
|||
public string Slug { get; set; } = string.Empty;
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string Data { get; set; } = string.Empty;
|
||||
public bool Indexing { get; set; } = true;
|
||||
public List<BasePageSection> Sections { get; set; } = new();
|
||||
}
|
||||
|
||||
public class BasePageSection
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string CTAText { get; set; } = string.Empty;
|
||||
public string CTARoute { get; set; } = string.Empty;
|
||||
public BasePageSectionType Type { get; set; }
|
||||
public string Query { get; set; } = string.Empty;
|
||||
public List<SectionItem> SectionItems { get; set; } = [];
|
||||
}
|
||||
|
||||
public class SectionItem
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string ImageLocation { get; set; } = string.Empty;
|
||||
public string Url { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public enum BasePageSectionType
|
||||
{
|
||||
[Display(Name = "اسلایدر محصولات")]
|
||||
ProductSlider = 0,
|
||||
[Display(Name = "اسلایدر دسته بندی محصولات")]
|
||||
ProductCategorySlider = 1,
|
||||
[Display(Name = "اسلایدر بلاگ ها")]
|
||||
BlogSlider = 2
|
||||
}
|
|
@ -83,7 +83,6 @@
|
|||
<Using Include="Netina.Domain.Entities.Warehouses" />
|
||||
<Using Include="Netina.Domain.Enums" />
|
||||
<Using Include="Netina.Domain.MartenEntities.Faqs" />
|
||||
<Using Include="Netina.Domain.MartenEntities.Pages" />
|
||||
<Using Include="Netina.Domain.MartenEntities.Settings" />
|
||||
<Using Include="Netina.Domain.Models" />
|
||||
<Using Include="System.ComponentModel.DataAnnotations" />
|
||||
|
|
|
@ -48,13 +48,6 @@ public class CreateDiscountCommandHandler(IRepositoryWrapper repositoryWrapper)
|
|||
request.IsForInvitation, request.IsForFirstPurchase, request.IsSpecialOffer, request.ProductId);
|
||||
repositoryWrapper.SetRepository<ProductDiscount>().Add(productDis);
|
||||
break;
|
||||
case DiscountType.Brand:
|
||||
var brandDis = BrandDiscount.Create(request.Code, request.Description, request.DiscountPercent, request.DiscountAmount, request.HasCode,
|
||||
request.AmountType, request.Type, request.Count, request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor,
|
||||
request.HasPriceFloor, request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity, request.UseCount,
|
||||
request.IsForInvitation, request.IsForFirstPurchase, request.IsSpecialOffer, request.BrandId);
|
||||
repositoryWrapper.SetRepository<BrandDiscount>().Add(brandDis);
|
||||
break;
|
||||
default:
|
||||
var def = Discount.Create(request.Code, request.Description, request.DiscountPercent, request.DiscountAmount, request.HasCode,
|
||||
request.AmountType, request.Type, request.Count, request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor,
|
||||
|
|
|
@ -55,23 +55,6 @@ public class UpdateDiscountCommandHandler(IRepositoryWrapper repositoryWrapper)
|
|||
productDis.CreatedBy = productEnt.CreatedBy;
|
||||
repositoryWrapper.SetRepository<ProductDiscount>().Update(productDis);
|
||||
break;
|
||||
|
||||
case DiscountType.Brand:
|
||||
var brandEnt = await repositoryWrapper.SetRepository<BrandDiscount>().TableNoTracking.FirstOrDefaultAsync(d => d.Id == request.Id, cancellationToken);
|
||||
if (brandEnt == null)
|
||||
throw new AppException("Discount not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
var brandDis = BrandDiscount.Create(request.Code, request.Description,
|
||||
request.DiscountPercent, request.DiscountAmount, request.HasCode,
|
||||
request.AmountType, request.Type, request.Count, request.IsImmortal,
|
||||
request.StartDate, request.ExpireDate, request.PriceFloor, request.HasPriceFloor,
|
||||
request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity,
|
||||
request.UseCount, request.IsForInvitation, request.IsForFirstPurchase, request.IsSpecialOffer, request.BrandId);
|
||||
brandDis.Id = brandEnt.Id;
|
||||
brandDis.CreatedAt = brandEnt.CreatedAt;
|
||||
brandDis.CreatedBy = brandEnt.CreatedBy;
|
||||
repositoryWrapper.SetRepository<BrandDiscount>().Update(brandDis);
|
||||
break;
|
||||
}
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return true;
|
||||
|
|
|
@ -21,7 +21,6 @@ public class CreateSubProductCommandHandler(IRepositoryWrapper repositoryWrapper
|
|||
request.ParentId,
|
||||
request.Diversity,
|
||||
request.DiversityValue,
|
||||
request.DiversitySecondaryValue,
|
||||
request.DiversityDescription,
|
||||
$"{parent.PersianName} - {request.DiversityDescription}",
|
||||
parent.EnglishName,
|
||||
|
|
|
@ -26,7 +26,6 @@ public class UpdateSubProductCommandHandler(IRepositoryWrapper repositoryWrapper
|
|||
request.ParentId,
|
||||
request.Diversity,
|
||||
request.DiversityValue,
|
||||
request.DiversitySecondaryValue,
|
||||
request.DiversityDescription,
|
||||
$"{parent.PersianName} - {request.DiversityDescription}",
|
||||
parent.EnglishName,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,70 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NetinaShop.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EditDisc : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "OrderProducts",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Discounts_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts",
|
||||
column: "BrandId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Discounts_Brands_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts",
|
||||
column: "BrandId",
|
||||
principalSchema: "public",
|
||||
principalTable: "Brands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Discounts_Brands_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Discounts_BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "OrderProducts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BrandId",
|
||||
schema: "public",
|
||||
table: "Discounts");
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,30 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace NetinaShop.Repository.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EditSubProductValue : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DiversitySecondaryValue",
|
||||
schema: "public",
|
||||
table: "Products",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DiversitySecondaryValue",
|
||||
schema: "public",
|
||||
table: "Products");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -743,9 +743,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("BrandId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
@ -1677,18 +1674,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasDiscriminator().HasValue("ProductComment");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.BrandDiscount", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Discounts.Discount");
|
||||
|
||||
b.Property<Guid>("BrandId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasIndex("BrandId");
|
||||
|
||||
b.HasDiscriminator().HasValue("BrandDiscount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b =>
|
||||
{
|
||||
b.HasBaseType("Netina.Domain.Entities.Discounts.Discount");
|
||||
|
@ -1724,10 +1709,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DiversitySecondaryValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DiversityValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
@ -2130,16 +2111,6 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.Navigation("Product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.BrandDiscount", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand")
|
||||
.WithMany()
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Brand");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b =>
|
||||
{
|
||||
b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
||||
|
|
Loading…
Reference in New Issue