Compare commits
11 Commits
subProduct
...
master
Author | SHA1 | Date |
---|---|---|
|
81b78d16d0 | |
|
d283681c7c | |
|
e45d48d8b3 | |
|
48d3386233 | |
|
13751e452a | |
|
1d29f39cbc | |
|
e445be641e | |
|
5dc92f63e7 | |
|
6da620690d | |
|
96feec0b26 | |
|
a87bfee340 |
|
@ -38,6 +38,11 @@ public class PageController : ICarterModule
|
||||||
.HasApiVersion(1.0)
|
.HasApiVersion(1.0)
|
||||||
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManagePages));
|
.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)
|
group.MapDelete("{id}", DeletePageByIdAsync)
|
||||||
.WithDisplayName("Delete Page")
|
.WithDisplayName("Delete Page")
|
||||||
.HasApiVersion(1.0)
|
.HasApiVersion(1.0)
|
||||||
|
@ -55,27 +60,25 @@ public class PageController : ICarterModule
|
||||||
=> TypedResults.Ok(await pageService.DeletePageAsync(id, cancellationToken));
|
=> TypedResults.Ok(await pageService.DeletePageAsync(id, cancellationToken));
|
||||||
|
|
||||||
public async Task<IResult> GetPagesAsync([FromServices] IPageService pageService, CancellationToken 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)
|
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)
|
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)
|
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)
|
public async Task<IResult> PostPageAsync([FromBody] PageActionRequestDto page, [FromServices] IPageService pageService, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
await pageService.CreatePageAsync(page, cancellationToken);
|
await pageService.CreatePageAsync(page, cancellationToken);
|
||||||
return TypedResults.Ok();
|
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>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<AssemblyVersion>1.10.21.36</AssemblyVersion>
|
<AssemblyVersion>1.14.22.42</AssemblyVersion>
|
||||||
<FileVersion>1.10.21.36</FileVersion>
|
<FileVersion>1.14.22.42</FileVersion>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
public interface IPageService : IScopedDependency
|
public interface IPageService : IScopedDependency
|
||||||
{
|
{
|
||||||
Task<BasePageSDto> GetPageAsync(Guid? id = null, string? pageName = null, string? pageSlug = null, string? type = null, CancellationToken cancellationToken = default);
|
Task<BasePageLDto> GetPageAsync(Guid? id = null, string? pageName = null, string? pageSlug = null, string? type = null, CancellationToken cancellationToken = default);
|
||||||
Task<List<BasePageSDto>> GetPagesAsync(CancellationToken cancellationToken = default);
|
Task<List<BasePageSDto>> GetPagesAsync(CancellationToken cancellationToken = default);
|
||||||
Task<bool> CreatePageAsync(PageActionRequestDto entity, 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<bool> DeletePageAsync(Guid id, CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
Task<string> CheckRedirectAsync(string oldUrl, CancellationToken cancellationToken);
|
Task<string> CheckRedirectAsync(string oldUrl, CancellationToken cancellationToken);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Netina.Core.BaseServices.Abstracts;
|
using Netina.Domain.MartenEntities.Pages;
|
||||||
using Netina.Domain.MartenEntities.Pages;
|
|
||||||
|
|
||||||
namespace Netina.Core.BaseServices;
|
namespace Netina.Core.BaseServices;
|
||||||
|
|
||||||
|
@ -9,7 +8,11 @@ public class PageService(
|
||||||
ISettingService settingService)
|
ISettingService settingService)
|
||||||
: IPageService
|
: IPageService
|
||||||
{
|
{
|
||||||
public async Task<BasePageSDto> GetPageAsync(Guid? id = null, string? pageName = null, string? pageSlug = null, string? type = null, CancellationToken cancellationToken = default)
|
public async Task<BasePageLDto> GetPageAsync(Guid? id = null,
|
||||||
|
string? pageName = null,
|
||||||
|
string? pageSlug = null,
|
||||||
|
string? type = null,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
BasePage? page = null;
|
BasePage? page = null;
|
||||||
if (id != null)
|
if (id != null)
|
||||||
|
@ -23,18 +26,7 @@ public class PageService(
|
||||||
if (page == null)
|
if (page == null)
|
||||||
throw new AppException("Page not found", ApiResultStatusCode.NotFound);
|
throw new AppException("Page not found", ApiResultStatusCode.NotFound);
|
||||||
|
|
||||||
var entityType = Assembly.GetAssembly(typeof(DomainConfig))?.GetType(page.Type);
|
var dto = page.Adapt<BasePageLDto>();
|
||||||
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;
|
return dto;
|
||||||
}
|
}
|
||||||
|
@ -45,19 +37,7 @@ public class PageService(
|
||||||
var pages = await martenRepositoryWrapperWrapper.SetRepository<BasePage>().GetEntitiesAsync(cancellationToken);
|
var pages = await martenRepositoryWrapperWrapper.SetRepository<BasePage>().GetEntitiesAsync(cancellationToken);
|
||||||
foreach (var page in pages)
|
foreach (var page in pages)
|
||||||
{
|
{
|
||||||
var dto = new BasePageSDto
|
var dto = page.Adapt<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);
|
sDtos.Add(dto);
|
||||||
}
|
}
|
||||||
return sDtos;
|
return sDtos;
|
||||||
|
@ -76,7 +56,9 @@ public class PageService(
|
||||||
Type = entity.Type,
|
Type = entity.Type,
|
||||||
Slug = entity.Slug,
|
Slug = entity.Slug,
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
CreatedBy = currentUserService.UserName ?? string.Empty
|
CreatedBy = currentUserService.UserName ?? string.Empty,
|
||||||
|
Indexing = entity.Indexing,
|
||||||
|
Sections = entity.Sections
|
||||||
};
|
};
|
||||||
if (!basePage.Type.IsNullOrEmpty())
|
if (!basePage.Type.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
@ -124,4 +106,11 @@ public class PageService(
|
||||||
}
|
}
|
||||||
throw new BaseApiException(ApiResultStatusCode.NotFound, "PageSetting not found");
|
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");
|
root.SetAttribute("xmlns:image", "http://www.google.com/schemas/sitemap-image/1.1");
|
||||||
doc.AppendChild(root);
|
doc.AppendChild(root);
|
||||||
|
|
||||||
foreach (var page in pages)
|
foreach (var page in pages.Where(p=>p.Indexing))
|
||||||
{
|
{
|
||||||
string slugHtml = page.Slug;
|
string slugHtml = page.Slug;
|
||||||
if (slugHtml.Contains(' '))
|
if (slugHtml.Contains(' '))
|
||||||
|
|
|
@ -73,6 +73,18 @@ 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)
|
else if (discount.Type == DiscountType.Subscriber)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException("Subscribe discount not implemented");
|
throw new NotImplementedException("Subscribe discount not implemented");
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class AddToOrderBagCommandHandler(
|
||||||
await mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken);
|
await mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken);
|
||||||
|
|
||||||
orderBag.AddToOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount,
|
orderBag.AddToOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount,
|
||||||
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId, requestDto.Count);
|
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId,productSDto.BrandId, requestDto.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
repositoryWrapper.SetRepository<Order>().Update(orderBag);
|
repositoryWrapper.SetRepository<Order>().Update(orderBag);
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class SubmitOrderBagCommandHandler(
|
||||||
await mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken);
|
await mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken);
|
||||||
|
|
||||||
orderBag.ChangeOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount,
|
orderBag.ChangeOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount,
|
||||||
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId, requestDto.Count);
|
productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId,productSDto.BrandId, requestDto.Count);
|
||||||
}
|
}
|
||||||
foreach (var orderProduct in orderBag.OrderProducts.ToList())
|
foreach (var orderProduct in orderBag.OrderProducts.ToList())
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,9 +35,10 @@ public class CalculateOrderCommandHandler(IRepositoryWrapper repositoryWrapper,
|
||||||
order.RemoveDiscount();
|
order.RemoveDiscount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (totalProductPrice > 5000000)
|
||||||
|
deliveryPrice = 0;
|
||||||
var taxesPrice = (((totalProductPrice - (discountCodePrice + productDiscountPrice)) + totalPackingPrice + servicePrice) / 100) * taxesFee;
|
var taxesPrice = (((totalProductPrice - (discountCodePrice + productDiscountPrice)) + totalPackingPrice + servicePrice) / 100) * taxesFee;
|
||||||
|
|
||||||
|
|
||||||
order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, productDiscountPrice, discountCodePrice, taxesPrice);
|
order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, productDiscountPrice, discountCodePrice, taxesPrice);
|
||||||
order.OrderProducts.Clear();
|
order.OrderProducts.Clear();
|
||||||
order.OrderDelivery = null;
|
order.OrderDelivery = null;
|
||||||
|
|
|
@ -21,7 +21,8 @@ bool IsForInvitation,
|
||||||
bool IsSpecialOffer,
|
bool IsSpecialOffer,
|
||||||
bool IsForFirstPurchase,
|
bool IsForFirstPurchase,
|
||||||
Guid ProductId,
|
Guid ProductId,
|
||||||
Guid CategoryId) : IRequest<DiscountLDto>;
|
Guid CategoryId,
|
||||||
|
Guid BrandId) : IRequest<DiscountLDto>;
|
||||||
|
|
||||||
public sealed record UpdateDiscountCommand(
|
public sealed record UpdateDiscountCommand(
|
||||||
Guid Id,
|
Guid Id,
|
||||||
|
@ -46,7 +47,8 @@ public sealed record UpdateDiscountCommand(
|
||||||
bool IsSpecialOffer,
|
bool IsSpecialOffer,
|
||||||
bool IsForFirstPurchase,
|
bool IsForFirstPurchase,
|
||||||
Guid ProductId,
|
Guid ProductId,
|
||||||
Guid CategoryId) : IRequest<bool>;
|
Guid CategoryId,
|
||||||
|
Guid BrandId) : IRequest<bool>;
|
||||||
|
|
||||||
|
|
||||||
public sealed record DeleteDiscountCommand(Guid Id) : IRequest<bool>;
|
public sealed record DeleteDiscountCommand(Guid Id) : IRequest<bool>;
|
||||||
|
|
|
@ -5,6 +5,7 @@ public sealed record CreateSubProductCommand(
|
||||||
Guid ParentId,
|
Guid ParentId,
|
||||||
ProductDiversity Diversity,
|
ProductDiversity Diversity,
|
||||||
string DiversityValue,
|
string DiversityValue,
|
||||||
|
string DiversitySecondaryValue,
|
||||||
string DiversityDescription,
|
string DiversityDescription,
|
||||||
string PersianName,
|
string PersianName,
|
||||||
double Cost,
|
double Cost,
|
||||||
|
@ -19,6 +20,7 @@ public sealed record UpdateSubProductCommand(
|
||||||
Guid ParentId,
|
Guid ParentId,
|
||||||
ProductDiversity Diversity,
|
ProductDiversity Diversity,
|
||||||
string DiversityValue,
|
string DiversityValue,
|
||||||
|
string DiversitySecondaryValue,
|
||||||
string DiversityDescription,
|
string DiversityDescription,
|
||||||
string PersianName,
|
string PersianName,
|
||||||
double Cost,
|
double Cost,
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
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,6 +23,8 @@ public class DiscountLDto : BaseDto<DiscountLDto,Discount>
|
||||||
public bool IsForInvitation { get; set; }
|
public bool IsForInvitation { get; set; }
|
||||||
public Guid ProductId { get; set; }
|
public Guid ProductId { get; set; }
|
||||||
public string ProductName { get; set; } = string.Empty;
|
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 Guid CategoryId { get; set; }
|
||||||
public string CategoryName { get; set; } = string.Empty;
|
public string CategoryName { get; set; } = string.Empty;
|
||||||
public bool IsForFirstPurchase { get; set; }
|
public bool IsForFirstPurchase { get; set; }
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Netina.Domain.Dtos.RequestDtos;
|
using Netina.Domain.MartenEntities.Pages;
|
||||||
|
|
||||||
|
namespace Netina.Domain.Dtos.RequestDtos;
|
||||||
|
|
||||||
public class PageActionRequestDto
|
public class PageActionRequestDto
|
||||||
{
|
{
|
||||||
|
@ -11,4 +13,6 @@ public class PageActionRequestDto
|
||||||
public string Slug { get; set; } = string.Empty;
|
public string Slug { get; set; } = string.Empty;
|
||||||
public string Type { get; set; } = string.Empty;
|
public string Type { get; set; } = string.Empty;
|
||||||
public object? Data { get; set; }
|
public object? Data { get; set; }
|
||||||
|
public bool Indexing { get; set; }
|
||||||
|
public List<BasePageSection> Sections { get; set; } = new();
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
using Netina.Domain.MartenEntities.Pages;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Netina.Domain.Dtos.SmallDtos;
|
namespace Netina.Domain.Dtos.SmallDtos;
|
||||||
|
|
||||||
|
@ -13,6 +12,7 @@ public class BasePageSDto : BaseDto<BasePageSDto,BasePage>
|
||||||
public string Slug { get; set; } = string.Empty;
|
public string Slug { get; set; } = string.Empty;
|
||||||
public string Data { get; set; } = string.Empty;
|
public string Data { get; set; } = string.Empty;
|
||||||
public DateTime ModifiedAt { get; set; }
|
public DateTime ModifiedAt { get; set; }
|
||||||
|
public bool Indexing { get; set; } = true;
|
||||||
|
|
||||||
public T GetData<T>() => JsonConvert.DeserializeObject<T>(Data);
|
public T GetData<T>() => JsonConvert.DeserializeObject<T>(Data);
|
||||||
}
|
}
|
|
@ -12,4 +12,5 @@ public class SubProductSDto : BaseDto<SubProductSDto,SubProduct>
|
||||||
public ProductDiversity Diversity { get; set; }
|
public ProductDiversity Diversity { get; set; }
|
||||||
public string DiversityValue { get; set; } = string.Empty;
|
public string DiversityValue { get; set; } = string.Empty;
|
||||||
public string DiversityDescription { get; set; } = string.Empty;
|
public string DiversityDescription { get; set; } = string.Empty;
|
||||||
|
public string DiversitySecondaryValue { get; set; } = string.Empty;
|
||||||
}
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
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,6 +39,19 @@ 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 partial class ProductDiscount
|
||||||
{
|
{
|
||||||
public static ProductDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
public static ProductDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type,
|
||||||
|
|
|
@ -12,7 +12,14 @@ public partial class Order
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddToOrderBag(Guid productId, double cost, double costWithDiscount, bool hasDiscount, double packingCost, Guid categoryId, int count)
|
public void AddToOrderBag(Guid productId,
|
||||||
|
double cost,
|
||||||
|
double costWithDiscount,
|
||||||
|
bool hasDiscount,
|
||||||
|
double packingCost,
|
||||||
|
Guid categoryId,
|
||||||
|
Guid brandId,
|
||||||
|
int count)
|
||||||
{
|
{
|
||||||
var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId);
|
var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId);
|
||||||
if (orderProduct == null)
|
if (orderProduct == null)
|
||||||
|
@ -25,6 +32,7 @@ public partial class Order
|
||||||
OrderStatus.OrderBag,
|
OrderStatus.OrderBag,
|
||||||
productId,
|
productId,
|
||||||
categoryId,
|
categoryId,
|
||||||
|
brandId,
|
||||||
this.Id);
|
this.Id);
|
||||||
OrderProducts.Add(orderProduct);
|
OrderProducts.Add(orderProduct);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +52,10 @@ public partial class Order
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeOrderBag(Guid productId, double cost, double costWithDiscount, bool hasDiscount, double packingCost, Guid categoryId, int count)
|
public void ChangeOrderBag(Guid productId, double cost, double costWithDiscount, bool hasDiscount, double packingCost,
|
||||||
|
Guid categoryId,
|
||||||
|
Guid brandId,
|
||||||
|
int count)
|
||||||
{
|
{
|
||||||
var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId);
|
var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId);
|
||||||
if (orderProduct != null)
|
if (orderProduct != null)
|
||||||
|
@ -52,10 +63,10 @@ public partial class Order
|
||||||
if (orderProduct.Count > count)
|
if (orderProduct.Count > count)
|
||||||
RemoveFromOrderBag(productId, count);
|
RemoveFromOrderBag(productId, count);
|
||||||
else
|
else
|
||||||
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId, count);
|
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId,brandId, count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId, count);
|
AddToOrderBag(productId, cost, costWithDiscount, hasDiscount, packingCost, categoryId, brandId, count);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,11 +176,16 @@ public partial class OrderProduct
|
||||||
OrderStatus orderProductStatus,
|
OrderStatus orderProductStatus,
|
||||||
Guid productId,
|
Guid productId,
|
||||||
Guid productCategoryId,
|
Guid productCategoryId,
|
||||||
|
Guid brandId,
|
||||||
Guid orderId)
|
Guid orderId)
|
||||||
{
|
{
|
||||||
var productCost = count * productFeeWithDiscount;
|
var productCost = count * productFeeWithDiscount;
|
||||||
var packingCost = count * packingFee;
|
var packingCost = count * packingFee;
|
||||||
return new OrderProduct(count, productFee, productFeeWithDiscount, hasDiscount, productCost, packingFee, packingCost, orderProductStatus, productId, productCategoryId, orderId);
|
return new OrderProduct(count, productFee,
|
||||||
|
productFeeWithDiscount, hasDiscount,
|
||||||
|
productCost, packingFee, packingCost,
|
||||||
|
orderProductStatus, productId,
|
||||||
|
productCategoryId, orderId,brandId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCount(int count)
|
public void SetCount(int count)
|
||||||
|
|
|
@ -19,7 +19,8 @@ public partial class OrderProduct : ApiEntity
|
||||||
OrderStatus orderProductStatus,
|
OrderStatus orderProductStatus,
|
||||||
Guid productId,
|
Guid productId,
|
||||||
Guid productCategoryId,
|
Guid productCategoryId,
|
||||||
Guid orderId)
|
Guid orderId,
|
||||||
|
Guid brandId)
|
||||||
{
|
{
|
||||||
Count = count;
|
Count = count;
|
||||||
ProductFee = productFee;
|
ProductFee = productFee;
|
||||||
|
@ -32,6 +33,7 @@ public partial class OrderProduct : ApiEntity
|
||||||
ProductCategoryId = productCategoryId;
|
ProductCategoryId = productCategoryId;
|
||||||
PackingFee = packingFee;
|
PackingFee = packingFee;
|
||||||
PackingCost = packingCost;
|
PackingCost = packingCost;
|
||||||
|
BrandId = brandId;
|
||||||
}
|
}
|
||||||
public int Count { get; internal set; }
|
public int Count { get; internal set; }
|
||||||
public double ProductFee { get; internal set; }
|
public double ProductFee { get; internal set; }
|
||||||
|
@ -43,6 +45,7 @@ public partial class OrderProduct : ApiEntity
|
||||||
public OrderStatus OrderProductStatus { get; internal set; }
|
public OrderStatus OrderProductStatus { get; internal set; }
|
||||||
|
|
||||||
public Guid ProductId { get; internal set; }
|
public Guid ProductId { get; internal set; }
|
||||||
|
public Guid BrandId { get; internal set; }
|
||||||
public Guid ProductCategoryId { get; internal set; }
|
public Guid ProductCategoryId { get; internal set; }
|
||||||
public Product? Product { get; internal set; }
|
public Product? Product { get; internal set; }
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ public partial class SubProduct
|
||||||
Guid parentId,
|
Guid parentId,
|
||||||
ProductDiversity diversity,
|
ProductDiversity diversity,
|
||||||
string diversityValue,
|
string diversityValue,
|
||||||
|
string diversitySecondaryValue,
|
||||||
string diversityDescription,
|
string diversityDescription,
|
||||||
string persianName,
|
string persianName,
|
||||||
string englishName,
|
string englishName,
|
||||||
|
@ -129,6 +130,7 @@ public partial class SubProduct
|
||||||
parentId,
|
parentId,
|
||||||
diversity,
|
diversity,
|
||||||
diversityValue,
|
diversityValue,
|
||||||
|
diversitySecondaryValue,
|
||||||
diversityDescription,
|
diversityDescription,
|
||||||
persianName,
|
persianName,
|
||||||
englishName,
|
englishName,
|
||||||
|
|
|
@ -14,6 +14,7 @@ public partial class SubProduct : Product
|
||||||
Guid parentId,
|
Guid parentId,
|
||||||
ProductDiversity diversity,
|
ProductDiversity diversity,
|
||||||
string diversityValue,
|
string diversityValue,
|
||||||
|
string diversitySecondaryValue,
|
||||||
string diversityDescription,
|
string diversityDescription,
|
||||||
string persianName,
|
string persianName,
|
||||||
string englishName,
|
string englishName,
|
||||||
|
@ -53,6 +54,7 @@ public partial class SubProduct : Product
|
||||||
ParentId = parentId;
|
ParentId = parentId;
|
||||||
Diversity = diversity;
|
Diversity = diversity;
|
||||||
DiversityValue = diversityValue;
|
DiversityValue = diversityValue;
|
||||||
|
DiversitySecondaryValue = diversitySecondaryValue;
|
||||||
DiversityDescription = diversityDescription;
|
DiversityDescription = diversityDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,5 +63,6 @@ public partial class SubProduct : Product
|
||||||
|
|
||||||
public ProductDiversity Diversity { get; internal set; }
|
public ProductDiversity Diversity { get; internal set; }
|
||||||
public string DiversityValue { get; internal set; } = string.Empty;
|
public string DiversityValue { get; internal set; } = string.Empty;
|
||||||
|
public string DiversitySecondaryValue { get; internal set; } = string.Empty;
|
||||||
public string DiversityDescription { get; internal set; } = string.Empty;
|
public string DiversityDescription { get; internal set; } = string.Empty;
|
||||||
}
|
}
|
|
@ -9,5 +9,7 @@ public enum DiscountType
|
||||||
[Display(Name = "دسته ای")]
|
[Display(Name = "دسته ای")]
|
||||||
Category = 2,
|
Category = 2,
|
||||||
[Display(Name = "مشترکی")]
|
[Display(Name = "مشترکی")]
|
||||||
Subscriber = 3
|
Subscriber = 3,
|
||||||
|
[Display(Name = "برند")]
|
||||||
|
Brand = 4,
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
namespace Netina.Domain.Mappers
|
||||||
|
{
|
||||||
|
public static partial class BrandDiscountMapper
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ namespace Netina.Domain.Mappers
|
||||||
ParentId = (Guid?)p1.ParentId,
|
ParentId = (Guid?)p1.ParentId,
|
||||||
Diversity = p1.Diversity,
|
Diversity = p1.Diversity,
|
||||||
DiversityValue = p1.DiversityValue,
|
DiversityValue = p1.DiversityValue,
|
||||||
|
DiversitySecondaryValue = p1.DiversitySecondaryValue,
|
||||||
DiversityDescription = p1.DiversityDescription,
|
DiversityDescription = p1.DiversityDescription,
|
||||||
PersianName = p1.PersianName,
|
PersianName = p1.PersianName,
|
||||||
Cost = p1.Cost,
|
Cost = p1.Cost,
|
||||||
|
@ -37,6 +38,7 @@ namespace Netina.Domain.Mappers
|
||||||
result.ParentId = (Guid?)p2.ParentId;
|
result.ParentId = (Guid?)p2.ParentId;
|
||||||
result.Diversity = p2.Diversity;
|
result.Diversity = p2.Diversity;
|
||||||
result.DiversityValue = p2.DiversityValue;
|
result.DiversityValue = p2.DiversityValue;
|
||||||
|
result.DiversitySecondaryValue = p2.DiversitySecondaryValue;
|
||||||
result.DiversityDescription = p2.DiversityDescription;
|
result.DiversityDescription = p2.DiversityDescription;
|
||||||
result.PersianName = p2.PersianName;
|
result.PersianName = p2.PersianName;
|
||||||
result.Cost = p2.Cost;
|
result.Cost = p2.Cost;
|
||||||
|
@ -63,6 +65,7 @@ namespace Netina.Domain.Mappers
|
||||||
Diversity = p4.Diversity,
|
Diversity = p4.Diversity,
|
||||||
DiversityValue = p4.DiversityValue,
|
DiversityValue = p4.DiversityValue,
|
||||||
DiversityDescription = p4.DiversityDescription,
|
DiversityDescription = p4.DiversityDescription,
|
||||||
|
DiversitySecondaryValue = p4.DiversitySecondaryValue,
|
||||||
Id = p4.Id,
|
Id = p4.Id,
|
||||||
CreatedAt = p4.CreatedAt
|
CreatedAt = p4.CreatedAt
|
||||||
};
|
};
|
||||||
|
@ -85,6 +88,7 @@ namespace Netina.Domain.Mappers
|
||||||
result.Diversity = p5.Diversity;
|
result.Diversity = p5.Diversity;
|
||||||
result.DiversityValue = p5.DiversityValue;
|
result.DiversityValue = p5.DiversityValue;
|
||||||
result.DiversityDescription = p5.DiversityDescription;
|
result.DiversityDescription = p5.DiversityDescription;
|
||||||
|
result.DiversitySecondaryValue = p5.DiversitySecondaryValue;
|
||||||
result.Id = p5.Id;
|
result.Id = p5.Id;
|
||||||
result.CreatedAt = p5.CreatedAt;
|
result.CreatedAt = p5.CreatedAt;
|
||||||
return result;
|
return result;
|
||||||
|
@ -102,6 +106,7 @@ namespace Netina.Domain.Mappers
|
||||||
Diversity = p7.Diversity,
|
Diversity = p7.Diversity,
|
||||||
DiversityValue = p7.DiversityValue,
|
DiversityValue = p7.DiversityValue,
|
||||||
DiversityDescription = p7.DiversityDescription,
|
DiversityDescription = p7.DiversityDescription,
|
||||||
|
DiversitySecondaryValue = p7.DiversitySecondaryValue,
|
||||||
Id = p7.Id,
|
Id = p7.Id,
|
||||||
CreatedAt = p7.CreatedAt
|
CreatedAt = p7.CreatedAt
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,4 +10,35 @@ public class BasePage : MartenEntity
|
||||||
public string Slug { get; set; } = string.Empty;
|
public string Slug { get; set; } = string.Empty;
|
||||||
public string Type { get; set; } = string.Empty;
|
public string Type { get; set; } = string.Empty;
|
||||||
public string Data { 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,6 +83,7 @@
|
||||||
<Using Include="Netina.Domain.Entities.Warehouses" />
|
<Using Include="Netina.Domain.Entities.Warehouses" />
|
||||||
<Using Include="Netina.Domain.Enums" />
|
<Using Include="Netina.Domain.Enums" />
|
||||||
<Using Include="Netina.Domain.MartenEntities.Faqs" />
|
<Using Include="Netina.Domain.MartenEntities.Faqs" />
|
||||||
|
<Using Include="Netina.Domain.MartenEntities.Pages" />
|
||||||
<Using Include="Netina.Domain.MartenEntities.Settings" />
|
<Using Include="Netina.Domain.MartenEntities.Settings" />
|
||||||
<Using Include="Netina.Domain.Models" />
|
<Using Include="Netina.Domain.Models" />
|
||||||
<Using Include="System.ComponentModel.DataAnnotations" />
|
<Using Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
|
|
@ -48,6 +48,13 @@ public class CreateDiscountCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||||
request.IsForInvitation, request.IsForFirstPurchase, request.IsSpecialOffer, request.ProductId);
|
request.IsForInvitation, request.IsForFirstPurchase, request.IsSpecialOffer, request.ProductId);
|
||||||
repositoryWrapper.SetRepository<ProductDiscount>().Add(productDis);
|
repositoryWrapper.SetRepository<ProductDiscount>().Add(productDis);
|
||||||
break;
|
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:
|
default:
|
||||||
var def = Discount.Create(request.Code, request.Description, request.DiscountPercent, request.DiscountAmount, request.HasCode,
|
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,
|
request.AmountType, request.Type, request.Count, request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor,
|
||||||
|
|
|
@ -55,6 +55,23 @@ public class UpdateDiscountCommandHandler(IRepositoryWrapper repositoryWrapper)
|
||||||
productDis.CreatedBy = productEnt.CreatedBy;
|
productDis.CreatedBy = productEnt.CreatedBy;
|
||||||
repositoryWrapper.SetRepository<ProductDiscount>().Update(productDis);
|
repositoryWrapper.SetRepository<ProductDiscount>().Update(productDis);
|
||||||
break;
|
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);
|
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -21,6 +21,7 @@ public class CreateSubProductCommandHandler(IRepositoryWrapper repositoryWrapper
|
||||||
request.ParentId,
|
request.ParentId,
|
||||||
request.Diversity,
|
request.Diversity,
|
||||||
request.DiversityValue,
|
request.DiversityValue,
|
||||||
|
request.DiversitySecondaryValue,
|
||||||
request.DiversityDescription,
|
request.DiversityDescription,
|
||||||
$"{parent.PersianName} - {request.DiversityDescription}",
|
$"{parent.PersianName} - {request.DiversityDescription}",
|
||||||
parent.EnglishName,
|
parent.EnglishName,
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class UpdateSubProductCommandHandler(IRepositoryWrapper repositoryWrapper
|
||||||
request.ParentId,
|
request.ParentId,
|
||||||
request.Diversity,
|
request.Diversity,
|
||||||
request.DiversityValue,
|
request.DiversityValue,
|
||||||
|
request.DiversitySecondaryValue,
|
||||||
request.DiversityDescription,
|
request.DiversityDescription,
|
||||||
$"{parent.PersianName} - {request.DiversityDescription}",
|
$"{parent.PersianName} - {request.DiversityDescription}",
|
||||||
parent.EnglishName,
|
parent.EnglishName,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,70 @@
|
||||||
|
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
|
@ -0,0 +1,30 @@
|
||||||
|
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,6 +743,9 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("uuid");
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
|
b.Property<Guid>("BrandId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
@ -1674,6 +1677,18 @@ namespace NetinaShop.Repository.Migrations
|
||||||
b.HasDiscriminator().HasValue("ProductComment");
|
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 =>
|
modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b =>
|
||||||
{
|
{
|
||||||
b.HasBaseType("Netina.Domain.Entities.Discounts.Discount");
|
b.HasBaseType("Netina.Domain.Entities.Discounts.Discount");
|
||||||
|
@ -1709,6 +1724,10 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("DiversitySecondaryValue")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("DiversityValue")
|
b.Property<string>("DiversityValue")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
@ -2111,6 +2130,16 @@ namespace NetinaShop.Repository.Migrations
|
||||||
b.Navigation("Product");
|
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 =>
|
modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
||||||
|
|
Loading…
Reference in New Issue