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)
.WithDisplayName("Get Page")
.HasApiVersion(1.0)
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewPages, ApplicationPermission.ManagePages));
.HasApiVersion(1.0);
group.MapGet("type/{type}", GetPageByTypeAsync)
.WithDisplayName("Get Page")

View File

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

View File

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

View File

@ -32,8 +32,8 @@
<body>
<!-- ======= Header ======= -->
<header id="header" class="fixed-top ">
<div class="container d-flex align-items-center">
<header id="header" class="fixed-top">
<div class="d-flex align-items-center container">
<h1 class="logo me-auto"><a href="index.html">NetinaShop API</a></h1>
<!-- 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" href="#why-us">Features</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>
<i class="bi bi-list mobile-nav-toggle"></i>
</nav><!-- .navbar -->
@ -56,7 +56,7 @@
<div class="container">
<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>
<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.
@ -65,10 +65,10 @@
Version : @Model?.Version
</h2>
<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 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="">
</div>
</div>
@ -78,12 +78,12 @@
<main id="main">
<!-- ======= 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="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">
<h3>Features of using this API</h3>
@ -96,7 +96,7 @@
<ul>
<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>
<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>
All responses and data convert to JSON , and you get json compresed response in all request
</p>
@ -126,29 +126,29 @@
</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>
</section><!-- End Why Us Section -->
<!-- ======= Cta Section ======= -->
<section id="cta" class="cta ">
<section id="cta" class="cta">
<div class="container" data-aos="zoom-in">
<div class="row">
<div class="col-lg-9 text-center text-lg-start">
<h3>SWAGGER</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>
<div class="col-lg-9 text-lg-start text-center">
<h3>SCALAR-UI</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>
</div>
<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>
</section><!-- End Cta 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="row">
@ -223,7 +223,7 @@
<div class="row">
<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 class="col-lg-3 col-md-6 footer-links">
@ -242,7 +242,7 @@
</div>
</div>
<div class="container footer-bottom clearfix">
<div class="footer-bottom clearfix container">
<div class="copyright">
&copy; Copyright <strong><span>NetinaShop</span></strong>. All Rights Reserved
</div>

View File

@ -1,6 +1,6 @@
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>;

View File

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

View File

@ -11,4 +11,8 @@ public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory
public string MainImage { get; set; } = string.Empty;
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;
public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , BrandSDto>
public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Guid>
{
private readonly IRepositoryWrapper _repositoryWrapper;
@ -10,7 +10,7 @@ public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Br
{
_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);
foreach (var file in request.Files)
@ -19,6 +19,6 @@ public class CreateBrandCommandHandler : IRequestHandler<CreateBrandCommand , Br
}
_repositoryWrapper.SetRepository<Brand>().Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return ent.AdaptToSDto();
return ent.Id;
}
}

View File

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

View File

@ -1,6 +1,6 @@
namespace Netina.Repository.Handlers.ProductCategories;
public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,ProductCategoryLDto>
public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,Guid>
{
private readonly IRepositoryWrapper _repositoryWrapper;
@ -9,7 +9,7 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
_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);
if (request.ParentId != default)
@ -20,6 +20,6 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
}
_repositoryWrapper.SetRepository<ProductCategory>().Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return ent.AdaptToLDto();
return ent.Id;
}
}

View File

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