Compare commits

...

3 Commits

Author SHA1 Message Date
Amir Hossein Khademi d2085e282d ADD VERSION 1.0.3.3 2024-06-09 18:07:20 +03:30
Amir Hossein Khademi 52ccd68228 feat(FastProductCreateDialog),refactor(Pages),refactor(Commands)
-ADD FAST PRODUCT CREATE DIALOG
-Refactor page and layout and fix some responsive issues
-Refactor brand and product command and return Guid in response create
2024-06-08 22:51:09 +03:30
Amir Hossein Khademi de7a70c6c9 refactor(ProductCategoriesPage) , refactor(ICrudApiRest)
- NEW VERSION OF PRODUCT CATEGORIES PAGE
- Change products categories page style and ux
- Change icrud api rest and get guid in instead of dto or model
2024-06-07 23:03:54 +03:30
11 changed files with 45 additions and 47 deletions

View File

@ -20,8 +20,7 @@ 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.Id); categories.Add(0,baseCat);
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.Id); categories.Add(requestDto.BaseCategoryId,lDto);
} }
@ -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.Id); brands.Add(0, baseBrand);
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.Id); brands.Add(requestDto.BaseBrandId,sDto);
} }
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.1.2</AssemblyVersion> <AssemblyVersion>1.0.3.3</AssemblyVersion>
<FileVersion>1.0.1.2</FileVersion> <FileVersion>1.0.3.3</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="container d-flex align-items-center"> <div class="d-flex align-items-center container">
<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="/swagger/index.html">Go To Swagger</a></li> <li><a class="getstarted scrollto" target="_blank" href="/scalar/v1">Go To Scalar</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-2 order-lg-1" 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-lg-1 order-2" 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="/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> <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>
</div> </div>
</div> </div>
<div class="col-lg-6 order-1 order-lg-2 hero-img" data-aos="zoom-in" data-aos-delay="200"> <div class="col-lg-6 order-lg-2 hero-img order-1" 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-2 order-lg-1"> <div class="col-lg-7 d-flex flex-column justify-content-center align-items-stretch order-lg-1 order-2">
<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="collapse show" data-bs-parent=".accordion-list"> <div id="accordion-list-1" class="show collapse" 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-1 order-lg-2 img" 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-lg-2 img order-1" 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-center text-lg-start"> <div class="col-lg-9 text-lg-start text-center">
<h3>SWAGGER</h3> <h3>SCALAR-UI</h3>
<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> <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>
</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="/swagger/index.html">Go to swagger</a> <a class="cta-btn align-middle" target="_blank" href="/scalar/v1">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">BrizCo API</h1> <h1 class="display-1">NetinaShop 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="container footer-bottom clearfix"> <div class="footer-bottom clearfix container">
<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<BrandSDto>; public sealed record CreateBrandCommand(string PersianName,string EnglishName, string Description , bool HasSpecialPage , string PageUrl, List<StorageFileSDto> Files) : IRequest<Guid>;
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<ProductCategoryLDto>; List<StorageFileSDto> Files) : IRequest<Guid>;
public sealed record UpdateProductCategoryCommand( public sealed record UpdateProductCategoryCommand(
Guid Id, Guid Id,

View File

@ -11,4 +11,8 @@ 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 , BrandSDto> public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Guid>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
@ -10,7 +10,7 @@ public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Br
{ {
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<BrandSDto> Handle(CreateBrandCommand request, CancellationToken cancellationToken) public async Task<Guid> 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 , Br
} }
_repositoryWrapper.SetRepository<Brand>().Add(ent); _repositoryWrapper.SetRepository<Brand>().Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return ent.AdaptToSDto(); return ent.Id;
} }
} }

View File

@ -10,10 +10,5 @@ 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,ProductCategoryLDto> public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,Guid>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
@ -9,7 +9,7 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<ProductCategoryLDto> Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken) public async Task<Guid> 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.AdaptToLDto(); return ent.Id;
} }
} }

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)