Compare commits

..

No commits in common. "d2085e282df42b6ab96c5161f94b70f1730b3ea5" and "cc004f84be59ad9548ca1d2edf92c44aedb4195c" have entirely different histories.

11 changed files with 47 additions and 45 deletions

View File

@ -20,7 +20,8 @@ public class PageController : ICarterModule
group.MapGet("slug/{pageSlug}", GetPageAsync) group.MapGet("slug/{pageSlug}", GetPageAsync)
.WithDisplayName("Get Page") .WithDisplayName("Get Page")
.HasApiVersion(1.0); .HasApiVersion(1.0)
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewPages, ApplicationPermission.ManagePages));
group.MapGet("type/{type}", GetPageByTypeAsync) group.MapGet("type/{type}", GetPageByTypeAsync)
.WithDisplayName("Get Page") .WithDisplayName("Get Page")

View File

@ -79,13 +79,13 @@ public class SeedController : ICarterModule
true, true,
default, default,
new List<StorageFileSDto>()),cancellationToken); new List<StorageFileSDto>()),cancellationToken);
categories.Add(0,baseCat); categories.Add(0,baseCat.Id);
foreach (var requestDto in request) foreach (var requestDto in request)
{ {
var lDto = await mediator.Send(new CreateProductCategoryCommand(requestDto.Name,requestDto.Description,true,default, var lDto = await mediator.Send(new CreateProductCategoryCommand(requestDto.Name,requestDto.Description,true,default,
new List<StorageFileSDto>()), cancellationToken); new List<StorageFileSDto>()), cancellationToken);
categories.Add(requestDto.BaseCategoryId,lDto); categories.Add(requestDto.BaseCategoryId,lDto.Id);
} }
@ -99,12 +99,12 @@ public class SeedController : ICarterModule
Dictionary<int, Guid> brands = new Dictionary<int, Guid>(); Dictionary<int, Guid> brands = new Dictionary<int, Guid>();
var baseBrand = await mediator.Send(new CreateBrandCommand("بدون برند","NoBrand", "محصولات بدون برند", false,string.Empty, var baseBrand = await mediator.Send(new CreateBrandCommand("بدون برند","NoBrand", "محصولات بدون برند", false,string.Empty,
new List<StorageFileSDto>()), cancellationToken); new List<StorageFileSDto>()), cancellationToken);
brands.Add(0, baseBrand); brands.Add(0, baseBrand.Id);
foreach (var requestDto in request) foreach (var requestDto in request)
{ {
var sDto = await mediator.Send(new CreateBrandCommand(requestDto.Name,string.Empty, requestDto.Description, false, var sDto = await mediator.Send(new CreateBrandCommand(requestDto.Name,string.Empty, requestDto.Description, false,
string.Empty, new List<StorageFileSDto>()), cancellationToken); string.Empty, new List<StorageFileSDto>()), cancellationToken);
brands.Add(requestDto.BaseBrandId,sDto); brands.Add(requestDto.BaseBrandId,sDto.Id);
} }
return TypedResults.Ok(brands); return TypedResults.Ok(brands);

View File

@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>1.0.3.3</AssemblyVersion> <AssemblyVersion>1.0.1.2</AssemblyVersion>
<FileVersion>1.0.3.3</FileVersion> <FileVersion>1.0.1.2</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -32,8 +32,8 @@
<body> <body>
<!-- ======= Header ======= --> <!-- ======= Header ======= -->
<header id="header" class="fixed-top"> <header id="header" class="fixed-top ">
<div class="d-flex align-items-center container"> <div class="container d-flex align-items-center">
<h1 class="logo me-auto"><a href="index.html">NetinaShop API</a></h1> <h1 class="logo me-auto"><a href="index.html">NetinaShop API</a></h1>
<!-- Uncomment below if you prefer to use an image logo --> <!-- Uncomment below if you prefer to use an image logo -->
@ -44,7 +44,7 @@
<li><a class="nav-link scrollto active" href="#hero">Home</a></li> <li><a class="nav-link scrollto active" href="#hero">Home</a></li>
<li><a class="nav-link scrollto" href="#why-us">Features</a></li> <li><a class="nav-link scrollto" href="#why-us">Features</a></li>
<li><a class="nav-link scrollto" href="#skills">Framworks</a></li> <li><a class="nav-link scrollto" href="#skills">Framworks</a></li>
<li><a class="getstarted scrollto" target="_blank" href="/scalar/v1">Go To Scalar</a></li> <li><a class="getstarted scrollto" target="_blank" href="/swagger/index.html">Go To Swagger</a></li>
</ul> </ul>
<i class="bi bi-list mobile-nav-toggle"></i> <i class="bi bi-list mobile-nav-toggle"></i>
</nav><!-- .navbar --> </nav><!-- .navbar -->
@ -56,7 +56,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-6 d-flex flex-column justify-content-center pt-4 pt-lg-0 order-lg-1 order-2" data-aos="fade-up" data-aos-delay="200"> <div class="col-lg-6 d-flex flex-column justify-content-center pt-4 pt-lg-0 order-2 order-lg-1" data-aos="fade-up" data-aos-delay="200">
<h1>New API for use </h1> <h1>New API for use </h1>
<h2 style="font-family: SF Pro Display, sans-serif; text-align: justify ;"> <h2 style="font-family: SF Pro Display, sans-serif; text-align: justify ;">
This API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. This API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
@ -65,10 +65,10 @@
Version : @Model?.Version Version : @Model?.Version
</h2> </h2>
<div class="d-flex justify-content-center justify-content-lg-start"> <div class="d-flex justify-content-center justify-content-lg-start">
<a href="/scalar/v1" target="_blank" class="btn-get-started scrollto"><i class="bi bi-chevron-right" style="font-family: SF Pro Display, sans-serif; margin-right:10px ;"></i><span>Go to Scalar</span></a> <a href="/swagger/index.html" target="_blank" class="btn-get-started scrollto"><i class="bi bi-chevron-right" style="font-family: SF Pro Display, sans-serif; margin-right:10px ;"></i><span>Go to Swagger</span></a>
</div> </div>
</div> </div>
<div class="col-lg-6 order-lg-2 hero-img order-1" data-aos="zoom-in" data-aos-delay="200"> <div class="col-lg-6 order-1 order-lg-2 hero-img" data-aos="zoom-in" data-aos-delay="200">
<img src="assets/img/hero-img.png" class="img-fluid animated" alt=""> <img src="assets/img/hero-img.png" class="img-fluid animated" alt="">
</div> </div>
</div> </div>
@ -78,12 +78,12 @@
<main id="main"> <main id="main">
<!-- ======= Why Us Section ======= --> <!-- ======= Why Us Section ======= -->
<section id="why-us" class="why-us section-bg d-flex min-vh-100 flex-column justify-content-center"> <section id="why-us" class="why-us section-bg d-flex min-vh-100 flex-column justify-content-center">
<div class="container-fluid" data-aos="fade-up"> <div class="container-fluid" data-aos="fade-up">
<div class="row"> <div class="row">
<div class="col-lg-7 d-flex flex-column justify-content-center align-items-stretch order-lg-1 order-2"> <div class="col-lg-7 d-flex flex-column justify-content-center align-items-stretch order-2 order-lg-1">
<div class="content"> <div class="content">
<h3>Features of using this API</h3> <h3>Features of using this API</h3>
@ -96,7 +96,7 @@
<ul> <ul>
<li> <li>
<a data-bs-toggle="collapse" class="collapse" data-bs-target="#accordion-list-1"><span>01</span> Use JSON <i class="bx bx-chevron-down icon-show"></i><i class="bx bx-chevron-up icon-close"></i></a> <a data-bs-toggle="collapse" class="collapse" data-bs-target="#accordion-list-1"><span>01</span> Use JSON <i class="bx bx-chevron-down icon-show"></i><i class="bx bx-chevron-up icon-close"></i></a>
<div id="accordion-list-1" class="show collapse" data-bs-parent=".accordion-list"> <div id="accordion-list-1" class="collapse show" data-bs-parent=".accordion-list">
<p> <p>
All responses and data convert to JSON , and you get json compresed response in all request All responses and data convert to JSON , and you get json compresed response in all request
</p> </p>
@ -126,29 +126,29 @@
</div> </div>
<div class="col-lg-5 align-items-stretch order-lg-2 img order-1" style='background-image: url("assets/img/features.svg");' data-aos="zoom-in" data-aos-delay="150">&nbsp;</div> <div class="col-lg-5 align-items-stretch order-1 order-lg-2 img" style='background-image: url("assets/img/features.svg");' data-aos="zoom-in" data-aos-delay="150">&nbsp;</div>
</div> </div>
</div> </div>
</section><!-- End Why Us Section --> </section><!-- End Why Us Section -->
<!-- ======= Cta Section ======= --> <!-- ======= Cta Section ======= -->
<section id="cta" class="cta"> <section id="cta" class="cta ">
<div class="container" data-aos="zoom-in"> <div class="container" data-aos="zoom-in">
<div class="row"> <div class="row">
<div class="col-lg-9 text-lg-start text-center"> <div class="col-lg-9 text-center text-lg-start">
<h3>SCALAR-UI</h3> <h3>SWAGGER</h3>
<p>Scalar-Ui is one of the best API document generator , You can use swagger to read API document and test API , for using swagger you need to login and use you username and password</p> <p>Swagger is one of the best API document generator , You can use swagger to read API document and test API , for using swagger you need to login and use you username and password</p>
</div> </div>
<div class="col-lg-3 cta-btn-container text-center"> <div class="col-lg-3 cta-btn-container text-center">
<a class="cta-btn align-middle" target="_blank" href="/scalar/v1">Go to swagger</a> <a class="cta-btn align-middle" target="_blank" href="/swagger/index.html">Go to swagger</a>
</div> </div>
</div> </div>
</div> </div>
</section><!-- End Cta Section --> </section><!-- End Cta Section -->
<!-- ======= Skills Section ======= --> <!-- ======= Skills Section ======= -->
<section id="skills" class="skills d-flex min-vh-100 flex-column justify-content-center"> <section id="skills" class="skills d-flex min-vh-100 flex-column justify-content-center">
<div class="container" data-aos="fade-up"> <div class="container" data-aos="fade-up">
<div class="row"> <div class="row">
@ -223,7 +223,7 @@
<div class="row"> <div class="row">
<div class="col-lg-9 content align-items-center justify-content-center"> <div class="col-lg-9 content align-items-center justify-content-center">
<h1 class="display-1">NetinaShop API</h1> <h1 class="display-1">BrizCo API</h1>
</div> </div>
<div class="col-lg-3 col-md-6 footer-links"> <div class="col-lg-3 col-md-6 footer-links">
@ -242,7 +242,7 @@
</div> </div>
</div> </div>
<div class="footer-bottom clearfix container"> <div class="container footer-bottom clearfix">
<div class="copyright"> <div class="copyright">
&copy; Copyright <strong><span>NetinaShop</span></strong>. All Rights Reserved &copy; Copyright <strong><span>NetinaShop</span></strong>. All Rights Reserved
</div> </div>

View File

@ -1,6 +1,6 @@
namespace Netina.Domain.CommandQueries.Commands; namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateBrandCommand(string PersianName,string EnglishName, string Description , bool HasSpecialPage , string PageUrl, List<StorageFileSDto> Files) : IRequest<Guid>; public sealed record CreateBrandCommand(string PersianName,string EnglishName, string Description , bool HasSpecialPage , string PageUrl, List<StorageFileSDto> Files) : IRequest<BrandSDto>;
public sealed record UpdateBrandCommand(Guid Id,string PersianName, string EnglishName, string Description, bool HasSpecialPage, string PageUrl, List<StorageFileSDto> Files) : IRequest<bool>; public sealed record UpdateBrandCommand(Guid Id,string PersianName, string EnglishName, string Description, bool HasSpecialPage, string PageUrl, List<StorageFileSDto> Files) : IRequest<bool>;

View File

@ -5,7 +5,7 @@ public sealed record CreateProductCategoryCommand(
string Description, string Description,
bool IsMain, bool IsMain,
Guid ParentId, Guid ParentId,
List<StorageFileSDto> Files) : IRequest<Guid>; List<StorageFileSDto> Files) : IRequest<ProductCategoryLDto>;
public sealed record UpdateProductCategoryCommand( public sealed record UpdateProductCategoryCommand(
Guid Id, Guid Id,

View File

@ -11,8 +11,4 @@ public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory
public string MainImage { get; set; } = string.Empty; public string MainImage { get; set; } = string.Empty;
public List<ProductCategorySDto> Children { get; set; } = new(); public List<ProductCategorySDto> Children { get; set; } = new();
public int Index { get; set; }
public bool IsSelected { get; set; }
public bool AddNewCatVisibility { get; set; }
} }

View File

@ -2,7 +2,7 @@
namespace Netina.Repository.Handlers.Brands; namespace Netina.Repository.Handlers.Brands;
public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Guid> public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , BrandSDto>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
@ -10,7 +10,7 @@ public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Gu
{ {
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<Guid> Handle(CreateBrandCommand request, CancellationToken cancellationToken) public async Task<BrandSDto> Handle(CreateBrandCommand request, CancellationToken cancellationToken)
{ {
var ent = Brand.Create(request.PersianName,request.EnglishName, request.Description, request.HasSpecialPage, request.PageUrl); var ent = Brand.Create(request.PersianName,request.EnglishName, request.Description, request.HasSpecialPage, request.PageUrl);
foreach (var file in request.Files) foreach (var file in request.Files)
@ -19,6 +19,6 @@ public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Gu
} }
_repositoryWrapper.SetRepository<Brand>().Add(ent); _repositoryWrapper.SetRepository<Brand>().Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return ent.Id; return ent.AdaptToSDto();
} }
} }

View File

@ -10,5 +10,10 @@ public class CreateBrandCommandValidator : AbstractValidator<CreateBrandCommand>
.NotNull() .NotNull()
.NotEmpty() .NotEmpty()
.WithMessage("نام فارسی برند را وارد کنید"); .WithMessage("نام فارسی برند را وارد کنید");
RuleFor(r => r.EnglishName)
.NotNull()
.NotEmpty()
.WithMessage("نام انگلیسی برند را وارد کنید");
} }
} }

View File

@ -1,6 +1,6 @@
namespace Netina.Repository.Handlers.ProductCategories; namespace Netina.Repository.Handlers.ProductCategories;
public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,Guid> public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,ProductCategoryLDto>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
@ -9,7 +9,7 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<Guid> Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken) public async Task<ProductCategoryLDto> Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken)
{ {
var ent = ProductCategory.Create(request.Name, request.Description, request.IsMain); var ent = ProductCategory.Create(request.Name, request.Description, request.IsMain);
if (request.ParentId != default) if (request.ParentId != default)
@ -20,6 +20,6 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
} }
_repositoryWrapper.SetRepository<ProductCategory>().Add(ent); _repositoryWrapper.SetRepository<ProductCategory>().Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return ent.Id; return ent.AdaptToLDto();
} }
} }

View File

@ -11,15 +11,15 @@ public class CreateProductCommandValidator : AbstractValidator<CreateProductComm
.NotEmpty() .NotEmpty()
.WithMessage("نام فارسی کالا مورد نظر را وارد کنید"); .WithMessage("نام فارسی کالا مورد نظر را وارد کنید");
//RuleFor(d => d.EnglishName) RuleFor(d => d.EnglishName)
// .NotNull() .NotNull()
// .NotEmpty() .NotEmpty()
// .WithMessage("نام انگلیسی کالا مورد نظر را وارد کنید"); .WithMessage("نام انگلیسی کالا مورد نظر را وارد کنید");
//RuleFor(d => d.Summery) RuleFor(d => d.Summery)
// .NotNull() .NotNull()
// .NotEmpty() .NotEmpty()
// .WithMessage("توضیحات کوتاه کالا مورد نظر را وارد کنید"); .WithMessage("توضیحات کوتاه کالا مورد نظر را وارد کنید");
RuleFor(d => d.CategoryId) RuleFor(d => d.CategoryId)
.NotEqual(Guid.Empty) .NotEqual(Guid.Empty)