diff --git a/.version b/.version index 7a35dfa..6837eda 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.25.29.50 \ No newline at end of file +0.26.30.51 \ No newline at end of file diff --git a/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json b/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json index 078a159..8387986 100644 --- a/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json +++ b/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json @@ -17,7 +17,7 @@ "TaxesFee": 9 }, "SiteSettings": { - "BaseUrl": "http://192.168.1.12:32770", + "BaseUrl": "http://localhost:32770", "WebSiteUrl": "https://hamyan.visabartar.com", "AdminPanelBaseUrl": "https://admin.hamyan.visabartar.com", "StorageBaseUrl": "https://storage.visabartar.com", diff --git a/Netina.Api/Controller/AuthController.cs b/Netina.Api/Controllers/AuthController.cs similarity index 95% rename from Netina.Api/Controller/AuthController.cs rename to Netina.Api/Controllers/AuthController.cs index fb61349..02ed4f7 100644 --- a/Netina.Api/Controller/AuthController.cs +++ b/Netina.Api/Controllers/AuthController.cs @@ -1,7 +1,4 @@ -using Netina.Core.CoreServices.Abstracts; -using Netina.Domain.Dtos.RequestDtos; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class AuthController : ICarterModule diff --git a/Netina.Api/Controller/BlogCategoryController.cs b/Netina.Api/Controllers/BlogCategoryController.cs similarity index 86% rename from Netina.Api/Controller/BlogCategoryController.cs rename to Netina.Api/Controllers/BlogCategoryController.cs index c6ec9d8..7379e5b 100644 --- a/Netina.Api/Controller/BlogCategoryController.cs +++ b/Netina.Api/Controllers/BlogCategoryController.cs @@ -1,6 +1,6 @@ using Netina.Domain.Entities.Blogs; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class BlogCategoryController : ICarterModule { @@ -32,20 +32,22 @@ public class BlogCategoryController : ICarterModule } // GET:Get All Entity - public async Task GetAllAsync([FromQuery] int? page, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + public async Task GetAllAsync([FromQuery] int? page,[FromQuery]string? categoryName , IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) { + var query = repositoryWrapper.SetRepository() + .TableNoTracking; + if (categoryName != null) + query = query.Where(q => q.Name.Trim().ToUpper().Contains(categoryName.Trim().ToUpper())); if (page != null) { - return TypedResults.Ok(await repositoryWrapper.SetRepository().TableNoTracking - .OrderByDescending(b => b.Name).Skip(page.Value * 10).Take(10) + return TypedResults.Ok(await query.OrderByDescending(b => b.Name).Skip(page.Value * 10).Take(10) .Select(BlogCategoryMapper.ProjectToSDto) .ToListAsync(cancellationToken)); } else { - return TypedResults.Ok(await repositoryWrapper.SetRepository().TableNoTracking - .OrderByDescending(b => b.Name) + return TypedResults.Ok(await query.OrderByDescending(b => b.Name) .Select(BlogCategoryMapper.ProjectToSDto) .ToListAsync(cancellationToken)); } diff --git a/Netina.Api/Controller/BlogController.cs b/Netina.Api/Controllers/BlogController.cs similarity index 85% rename from Netina.Api/Controller/BlogController.cs rename to Netina.Api/Controllers/BlogController.cs index deb3dc2..bfb22cc 100644 --- a/Netina.Api/Controller/BlogController.cs +++ b/Netina.Api/Controllers/BlogController.cs @@ -1,10 +1,6 @@ -using Netina.Common.Models.Exception; -using Netina.Domain.Dtos.LargDtos; -using Netina.Domain.Entities.Blogs; -using Netina.Domain.Models.Claims; -using Netina.Repository.Repositories.Base.Contracts; +using Netina.Domain.Entities.Blogs; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class BlogController : ICarterModule { @@ -42,15 +38,19 @@ public class BlogController : ICarterModule } // GET:Get All Entity - public async Task GetAllAsync([FromQuery] int page, [FromQuery] Guid? blogCategoryId, IMediator mediator, CancellationToken cancellationToken) - => TypedResults.Ok(await mediator.Send(new GetBlogsQuery(page, CategoryId: blogCategoryId), cancellationToken)); + public async Task GetAllAsync([FromQuery] int page, [FromQuery]int? count, [FromQuery] Guid? blogCategoryId, [FromQuery]string? blogName, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new GetBlogsQuery(page,Count: count, CategoryId: blogCategoryId,BlogName: blogName), cancellationToken)); // GET:Get An Entity By Id - public async Task GetAsync(Guid id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) - => TypedResults.Ok(await repositoryWrapper.SetRepository().TableNoTracking - .Where(b=>b.Id==id) + public async Task GetAsync(Guid id, IRepositoryWrapper repositoryWrapper, + CancellationToken cancellationToken) + { + var dto = await repositoryWrapper.SetRepository().TableNoTracking + .Where(b => b.Id == id) .Select(BlogMapper.ProjectToLDto) - .FirstOrDefaultAsync(cancellationToken)); + .FirstOrDefaultAsync(cancellationToken); + return TypedResults.Ok(dto); + } // POST:Create Entity public async Task Post([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) diff --git a/Netina.Api/Controller/BrandController.cs b/Netina.Api/Controllers/BrandController.cs similarity index 91% rename from Netina.Api/Controller/BrandController.cs rename to Netina.Api/Controllers/BrandController.cs index 3b917f4..072511a 100644 --- a/Netina.Api/Controller/BrandController.cs +++ b/Netina.Api/Controllers/BrandController.cs @@ -1,10 +1,6 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Entities.Brands; -using Netina.Domain.Models.Claims; -using Netina.Repository.Repositories.Base.Contracts; +using Netina.Domain.Entities.Brands; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class BrandController : ICarterModule { diff --git a/Netina.Api/Controller/DashboardController.cs b/Netina.Api/Controllers/DashboardController.cs similarity index 87% rename from Netina.Api/Controller/DashboardController.cs rename to Netina.Api/Controllers/DashboardController.cs index 044c8d6..6f7fba2 100644 --- a/Netina.Api/Controller/DashboardController.cs +++ b/Netina.Api/Controllers/DashboardController.cs @@ -1,7 +1,4 @@ -using Netina.Core.BaseServices.Abstracts; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class DashboardController : ICarterModule { diff --git a/Netina.Api/Controller/DiscountController.cs b/Netina.Api/Controllers/DiscountController.cs similarity index 94% rename from Netina.Api/Controller/DiscountController.cs rename to Netina.Api/Controllers/DiscountController.cs index 57502ea..9fd53c6 100644 --- a/Netina.Api/Controller/DiscountController.cs +++ b/Netina.Api/Controllers/DiscountController.cs @@ -1,8 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class DiscountController : ICarterModule { diff --git a/Netina.Api/Controller/DistrictController.cs b/Netina.Api/Controllers/DistrictController.cs similarity index 93% rename from Netina.Api/Controller/DistrictController.cs rename to Netina.Api/Controllers/DistrictController.cs index a81232a..1e732e3 100644 --- a/Netina.Api/Controller/DistrictController.cs +++ b/Netina.Api/Controllers/DistrictController.cs @@ -1,6 +1,4 @@ -using Netina.Core.Abstracts; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class DistrictController : ICarterModule { diff --git a/Netina.Api/Controller/FileController.cs b/Netina.Api/Controllers/FileController.cs similarity index 88% rename from Netina.Api/Controller/FileController.cs rename to Netina.Api/Controllers/FileController.cs index 28f8acc..7747d37 100644 --- a/Netina.Api/Controller/FileController.cs +++ b/Netina.Api/Controllers/FileController.cs @@ -1,9 +1,6 @@ -using Netina.Common.Models.Api; -using Netina.Core.Abstracts; -using Netina.Domain.Enums; -using Netina.Domain.Models.Claims; +using Netina.Domain.Enums; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class FileController : ICarterModule { diff --git a/Netina.Api/Controller/HealthController.cs b/Netina.Api/Controllers/HealthController.cs similarity index 97% rename from Netina.Api/Controller/HealthController.cs rename to Netina.Api/Controllers/HealthController.cs index 0d27822..b64ced1 100644 --- a/Netina.Api/Controller/HealthController.cs +++ b/Netina.Api/Controllers/HealthController.cs @@ -1,6 +1,6 @@ using MD.PersianDateTime.Standard; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class HealthController : ICarterModule { diff --git a/Netina.Api/Controller/HomeController.cs b/Netina.Api/Controllers/HomeController.cs similarity index 87% rename from Netina.Api/Controller/HomeController.cs rename to Netina.Api/Controllers/HomeController.cs index d443e15..be0e74c 100644 --- a/Netina.Api/Controller/HomeController.cs +++ b/Netina.Api/Controllers/HomeController.cs @@ -1,6 +1,6 @@ using Netina.Api.Views.Home; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; [Route("")] [AllowAnonymous] diff --git a/Netina.Api/Controller/MarketerController.cs b/Netina.Api/Controllers/MarketerController.cs similarity index 98% rename from Netina.Api/Controller/MarketerController.cs rename to Netina.Api/Controllers/MarketerController.cs index 37770f5..68b24a4 100644 --- a/Netina.Api/Controller/MarketerController.cs +++ b/Netina.Api/Controllers/MarketerController.cs @@ -1,6 +1,6 @@ using Netina.Domain.MartenEntities.Settings; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class MarketerController : ICarterModule { diff --git a/Netina.Api/Controller/NewsletterMemberController.cs b/Netina.Api/Controllers/NewsletterMemberController.cs similarity index 87% rename from Netina.Api/Controller/NewsletterMemberController.cs rename to Netina.Api/Controllers/NewsletterMemberController.cs index b8635b5..3c422df 100644 --- a/Netina.Api/Controller/NewsletterMemberController.cs +++ b/Netina.Api/Controllers/NewsletterMemberController.cs @@ -1,8 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class NewsletterMemberController : ICarterModule { diff --git a/Netina.Api/Controller/OrderBagController.cs b/Netina.Api/Controllers/OrderBagController.cs similarity index 94% rename from Netina.Api/Controller/OrderBagController.cs rename to Netina.Api/Controllers/OrderBagController.cs index 9f48011..154bc6e 100644 --- a/Netina.Api/Controller/OrderBagController.cs +++ b/Netina.Api/Controllers/OrderBagController.cs @@ -1,10 +1,6 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Dtos.RequestDtos; -using Netina.Domain.Enums; -using Netina.Domain.Models.Claims; +using Netina.Domain.Enums; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class OrderBagController : ICarterModule { diff --git a/Netina.Api/Controller/OrderController.cs b/Netina.Api/Controllers/OrderController.cs similarity index 95% rename from Netina.Api/Controller/OrderController.cs rename to Netina.Api/Controllers/OrderController.cs index 12c259b..aa65725 100644 --- a/Netina.Api/Controller/OrderController.cs +++ b/Netina.Api/Controllers/OrderController.cs @@ -1,9 +1,6 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Enums; -using Netina.Domain.Models.Claims; +using Netina.Domain.Enums; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class OrderController : ICarterModule { public void AddRoutes(IEndpointRouteBuilder app) diff --git a/Netina.Api/Controller/PageController.cs b/Netina.Api/Controllers/PageController.cs similarity index 95% rename from Netina.Api/Controller/PageController.cs rename to Netina.Api/Controllers/PageController.cs index c62daad..d8584b3 100644 --- a/Netina.Api/Controller/PageController.cs +++ b/Netina.Api/Controllers/PageController.cs @@ -1,8 +1,4 @@ -using Netina.Core.CoreServices.Abstracts; -using Netina.Domain.Dtos.RequestDtos; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class PageController : ICarterModule { diff --git a/Netina.Api/Controller/PaymentController.cs b/Netina.Api/Controllers/PaymentController.cs similarity index 94% rename from Netina.Api/Controller/PaymentController.cs rename to Netina.Api/Controllers/PaymentController.cs index 1e58e62..9275402 100644 --- a/Netina.Api/Controller/PaymentController.cs +++ b/Netina.Api/Controllers/PaymentController.cs @@ -1,10 +1,7 @@ using Microsoft.Extensions.Options; -using Netina.Core.Abstracts; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Models.Claims; using TypedResults = Microsoft.AspNetCore.Http.TypedResults; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class PaymentController : ICarterModule { diff --git a/Netina.Api/Controller/ProductCategoryController.cs b/Netina.Api/Controllers/ProductCategoryController.cs similarity index 94% rename from Netina.Api/Controller/ProductCategoryController.cs rename to Netina.Api/Controllers/ProductCategoryController.cs index c8b996a..21e22eb 100644 --- a/Netina.Api/Controller/ProductCategoryController.cs +++ b/Netina.Api/Controllers/ProductCategoryController.cs @@ -1,8 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class ProductCategoryController : ICarterModule { diff --git a/Netina.Api/Controller/ProductController.cs b/Netina.Api/Controllers/ProductController.cs similarity index 94% rename from Netina.Api/Controller/ProductController.cs rename to Netina.Api/Controllers/ProductController.cs index e96221c..c2157d1 100644 --- a/Netina.Api/Controller/ProductController.cs +++ b/Netina.Api/Controllers/ProductController.cs @@ -1,9 +1,6 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Enums; -using Netina.Domain.Models.Claims; +using Netina.Domain.Enums; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class ProductController : ICarterModule { diff --git a/Netina.Api/Controller/ProductReviewController.cs b/Netina.Api/Controllers/ProductReviewController.cs similarity index 94% rename from Netina.Api/Controller/ProductReviewController.cs rename to Netina.Api/Controllers/ProductReviewController.cs index 75f5109..9c2b7ee 100644 --- a/Netina.Api/Controller/ProductReviewController.cs +++ b/Netina.Api/Controllers/ProductReviewController.cs @@ -1,8 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class ProductReviewController : ICarterModule { diff --git a/Netina.Api/Controller/RoleController.cs b/Netina.Api/Controllers/RoleController.cs similarity index 97% rename from Netina.Api/Controller/RoleController.cs rename to Netina.Api/Controllers/RoleController.cs index 7fb9e16..8c99bed 100644 --- a/Netina.Api/Controller/RoleController.cs +++ b/Netina.Api/Controllers/RoleController.cs @@ -1,8 +1,6 @@ using Netina.Core.EntityServices.Abstracts; -using Netina.Domain.Dtos.RequestDtos; -using Netina.Domain.Models.Claims; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class RoleController : ICarterModule { diff --git a/Netina.Api/Controller/ScraperController.cs b/Netina.Api/Controllers/ScraperController.cs similarity index 97% rename from Netina.Api/Controller/ScraperController.cs rename to Netina.Api/Controllers/ScraperController.cs index dac2f76..e0a1c44 100644 --- a/Netina.Api/Controller/ScraperController.cs +++ b/Netina.Api/Controllers/ScraperController.cs @@ -1,4 +1,4 @@ -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class ScraperController : ICarterModule { diff --git a/Netina.Api/Controller/SearchController.cs b/Netina.Api/Controllers/SearchController.cs similarity index 95% rename from Netina.Api/Controller/SearchController.cs rename to Netina.Api/Controllers/SearchController.cs index 4922e86..272744a 100644 --- a/Netina.Api/Controller/SearchController.cs +++ b/Netina.Api/Controllers/SearchController.cs @@ -1,6 +1,4 @@ -using Netina.Core.CoreServices.Abstracts; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class SearchController : ICarterModule { diff --git a/Netina.Api/Controller/SeedController.cs b/Netina.Api/Controllers/SeedController.cs similarity index 74% rename from Netina.Api/Controller/SeedController.cs rename to Netina.Api/Controllers/SeedController.cs index ac7118e..0f1dee9 100644 --- a/Netina.Api/Controller/SeedController.cs +++ b/Netina.Api/Controllers/SeedController.cs @@ -1,7 +1,7 @@ using Netina.Domain.Dtos.RequestDtos.SeedDtos; using Netina.Domain.Entities.Blogs; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class SeedController : ICarterModule { private readonly IWebHostEnvironment _environment; @@ -110,10 +110,10 @@ public class SeedController : ICarterModule var noCategory = await repositoryWrapper.SetRepository() .TableNoTracking .FirstOrDefaultAsync(bc => bc.Name == "دسته بندی نشده", cancellationToken); - if(noCategory != null) + if (noCategory != null) seedBlogRequestDto.CategoryId = noCategory.Id; } - var ent = Blog.Create(seedBlogRequestDto.Title,seedBlogRequestDto.Slug, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime, + var ent = Blog.Create(seedBlogRequestDto.Title, seedBlogRequestDto.Slug, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime, seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId); foreach (var storageFileSDto in seedBlogRequestDto.Files) @@ -125,6 +125,35 @@ public class SeedController : ICarterModule repositoryWrapper.SetRepository().Add(ent); await repositoryWrapper.SaveChangesAsync(cancellationToken); } + //var blogs = await repositoryWrapper.SetRepository() + // .TableNoTracking + // .ToListAsync(cancellationToken); + //foreach (var blog in blogs) + //{ + // if (blog.Id == Guid.Parse("358192ec-32b0-4643-8269-b42268755b5b")) + // { + + // } + // blog.Content = blog.Content.Replace(@"

(10 خط ) 02144850335📞  02144872230 📞  02144872231 📞

", string.Empty); + // blog.Content = blog.Content.Replace(@"

(10 خط ) 02144850335📞  02144872230 📞  02144872231 📞

", string.Empty); + // blog.Content = blog.Content.Replace(@"

تلفن های تماس :

", string.Empty); + // blog.Content = blog.Content.Replace("02122894819", string.Empty); + // blog.Content = blog.Content.Replace("02144850335", string.Empty); + // blog.Content = blog.Content.Replace("02126702518", string.Empty); + // blog.Content = blog.Content.Replace("02144872230", string.Empty); + // blog.Content = blog.Content.Replace("02144872231", string.Empty); + // blog.Content = blog.Content.Replace("02144850335", string.Empty); + // blog.Content = blog.Content.Replace("02144872230", string.Empty); + // blog.Content = blog.Content.Replace("02144872231", string.Empty); + + // blog.Content = blog.Content.Replace("۰۲۱۴۴۸۵۰۳۳۵", string.Empty); + // blog.Content = blog.Content.Replace("۰۲۱۴۴۸۷۲۲۳۰", string.Empty); + // blog.Content = blog.Content.Replace("۰۲۱۴۴۸۷۲۲۳۱", string.Empty); + + // repositoryWrapper.SetRepository() + // .Update(blog); + // await repositoryWrapper.SaveChangesAsync(cancellationToken); + //} return TypedResults.Ok(); } diff --git a/Netina.Api/Controller/SettingController.cs b/Netina.Api/Controllers/SettingController.cs similarity index 93% rename from Netina.Api/Controller/SettingController.cs rename to Netina.Api/Controllers/SettingController.cs index 86cdee5..553d684 100644 --- a/Netina.Api/Controller/SettingController.cs +++ b/Netina.Api/Controllers/SettingController.cs @@ -1,8 +1,6 @@ using System.Text.Json; -using Netina.Core.CoreServices.Abstracts; -using Netina.Domain.Models.Claims; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class SettingController : ICarterModule { diff --git a/Netina.Api/Controller/ShippingController.cs b/Netina.Api/Controllers/ShippingController.cs similarity index 94% rename from Netina.Api/Controller/ShippingController.cs rename to Netina.Api/Controllers/ShippingController.cs index 8808e4a..fba8566 100644 --- a/Netina.Api/Controller/ShippingController.cs +++ b/Netina.Api/Controllers/ShippingController.cs @@ -1,8 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Models.Claims; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class ShippingController : ICarterModule { diff --git a/Netina.Api/Controller/UserAddressController.cs b/Netina.Api/Controllers/UserAddressController.cs similarity index 92% rename from Netina.Api/Controller/UserAddressController.cs rename to Netina.Api/Controllers/UserAddressController.cs index f594ae1..1a57666 100644 --- a/Netina.Api/Controller/UserAddressController.cs +++ b/Netina.Api/Controllers/UserAddressController.cs @@ -1,7 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; - -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class UserAddressController : ICarterModule { diff --git a/Netina.Api/Controller/UserController.cs b/Netina.Api/Controllers/UserController.cs similarity index 95% rename from Netina.Api/Controller/UserController.cs rename to Netina.Api/Controllers/UserController.cs index 2bc81aa..5c1d95b 100644 --- a/Netina.Api/Controller/UserController.cs +++ b/Netina.Api/Controllers/UserController.cs @@ -1,12 +1,7 @@ -using Netina.Common.Models.Api; -using Netina.Common.Models.Exception; -using Netina.Core.EntityServices.Abstracts; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Dtos.RequestDtos; -using Netina.Domain.Models.Claims; +using Netina.Core.EntityServices.Abstracts; using Netina.Repository.Abstracts; -namespace Netina.Api.Controller; +namespace Netina.Api.Controllers; public class UserController : ICarterModule { diff --git a/Netina.Api/Controllers/WebSiteController.cs b/Netina.Api/Controllers/WebSiteController.cs new file mode 100644 index 0000000..566f9bc --- /dev/null +++ b/Netina.Api/Controllers/WebSiteController.cs @@ -0,0 +1,28 @@ +using Netina.Domain.MartenEntities.Settings; + +namespace Netina.Api.Controllers; + +public class WebSiteController:ICarterModule +{ + public void AddRoutes(IEndpointRouteBuilder app) + { + var group = app.NewVersionedApi("WebSite").MapGroup("api/website"); + + group.MapGet("/navbar", GetNavBarItemsAsync) + .WithDisplayName("Get NavBar Items") + .HasApiVersion(1.0); + } + + private async Task GetNavBarItemsAsync([FromServices]ISettingService settingService,CancellationToken cancellationToken) + { + var navBarSetting = await settingService.GetSettingAsync(nameof(NavMenuSetting), cancellationToken) as NavMenuSetting; + if (navBarSetting == null) + return TypedResults.Ok(); + navBarSetting.NavMenuItems.ForEach(n => + { + n.Children = navBarSetting.NavMenuItems.Where(ni => ni.ParentId == n.Id).ToList(); + }); + navBarSetting.NavMenuItems.Where(n=>n.ParentId != default).ToList().ForEach(ni=>navBarSetting.NavMenuItems.Remove(ni)); + return TypedResults.Ok(navBarSetting.NavMenuItems); + } +} \ No newline at end of file diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index d475dca..2d09ed0 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 0.25.29.50 - 0.25.29.50 + 0.26.30.51 + 0.26.30.51 diff --git a/Netina.Api/Program.cs b/Netina.Api/Program.cs index 6b80809..c3d3365 100644 --- a/Netina.Api/Program.cs +++ b/Netina.Api/Program.cs @@ -123,6 +123,7 @@ app.UseExceptionHandlerMiddleware(); app.MapCarter(); app.UseStaticFiles(); await app.InitialDb(); +await app.CoreInit(); app.MapControllers(); app.Run(); diff --git a/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs b/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs index 3e0a476..b350568 100644 --- a/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs +++ b/Netina.Api/WebFramework/Configurations/ServiceExtensions.cs @@ -13,7 +13,7 @@ public static class ServiceExtensions // configure and register Quartz var schedulerConfig = new NameValueCollection { {"quartz.threadPool.threadCount", "3"}, - {"quartz.scheduler.threadName", "BrizCo_Scheduler"} + {"quartz.scheduler.threadName", "Netina_Scheduler"} }; builder.RegisterModule(new QuartzAutofacFactoryModule diff --git a/Netina.Core/CoreConfig.cs b/Netina.Core/CoreConfig.cs index acd72c5..627b896 100644 --- a/Netina.Core/CoreConfig.cs +++ b/Netina.Core/CoreConfig.cs @@ -1,7 +1,19 @@ -namespace Netina.Core -{ - public class CoreConfig - { +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Netina.Core.QuartzServices; +namespace Netina.Core; +public static class CoreConfig +{ + + public static async Task CoreInit(this IApplicationBuilder app) + { + var scopeFactory = app.ApplicationServices.GetRequiredService(); + using (var scope = scopeFactory.CreateScope()) + { + var jobScheduler = scope.ServiceProvider.GetService(); + jobScheduler.Start(); + } } } + diff --git a/Netina.Core/QuartzServices/JobScheduler.cs b/Netina.Core/QuartzServices/JobScheduler.cs index 0af4866..67d3b92 100644 --- a/Netina.Core/QuartzServices/JobScheduler.cs +++ b/Netina.Core/QuartzServices/JobScheduler.cs @@ -23,7 +23,7 @@ public class JobScheduler .Build(); ITrigger trigger = TriggerBuilder.Create() .WithIdentity("SiteMapJobTrigger", "admin") - .WithSchedule(CronScheduleBuilder.AtHourAndMinuteOnGivenDaysOfWeek(3, 0, + .WithSchedule(CronScheduleBuilder.AtHourAndMinuteOnGivenDaysOfWeek(3, 30, DayOfWeek.Saturday, DayOfWeek.Sunday, DayOfWeek.Monday, diff --git a/Netina.Domain/CommandQueries/Queries/BlogQueries.cs b/Netina.Domain/CommandQueries/Queries/BlogQueries.cs index ee97fad..01a6201 100644 --- a/Netina.Domain/CommandQueries/Queries/BlogQueries.cs +++ b/Netina.Domain/CommandQueries/Queries/BlogQueries.cs @@ -1,4 +1,4 @@ namespace Netina.Domain.CommandQueries.Queries; -public record GetBlogsQuery(int Page, Guid? CategoryId) : IRequest; \ No newline at end of file +public record GetBlogsQuery(int Page,int? Count, Guid? CategoryId,string? BlogName) : IRequest; \ No newline at end of file diff --git a/Netina.Domain/Dtos/SmallDtos/BlogCategorySDto.cs b/Netina.Domain/Dtos/SmallDtos/BlogCategorySDto.cs index 7552df7..540efe2 100644 --- a/Netina.Domain/Dtos/SmallDtos/BlogCategorySDto.cs +++ b/Netina.Domain/Dtos/SmallDtos/BlogCategorySDto.cs @@ -5,4 +5,5 @@ public class BlogCategorySDto : BaseDto public string Name { get; set; } = string.Empty; public int BlogCount { get; set; } public string Description { get; set; } = string.Empty; + public string Slug { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Netina.Domain/Dtos/SmallDtos/ProductCategorySDto.cs b/Netina.Domain/Dtos/SmallDtos/ProductCategorySDto.cs index 4af46cb..edbab70 100644 --- a/Netina.Domain/Dtos/SmallDtos/ProductCategorySDto.cs +++ b/Netina.Domain/Dtos/SmallDtos/ProductCategorySDto.cs @@ -4,6 +4,7 @@ public class ProductCategorySDto : BaseDto NavMenuItems { get; set; } = new(); +} + +public class NavMenuItem +{ + public NavMenuItem() + { + Id = Guid.NewGuid(); + } + public Guid Id { get; set; } + public string Title { get; set; } = string.Empty; + public string Url { get; set; } = string.Empty; + public Guid ParentId { get; set; } + public NavMenuItem? Parent { get; set; } + public List Children { get; set; } = new(); +} \ No newline at end of file diff --git a/Netina.Domain/Netina.Domain.csproj b/Netina.Domain/Netina.Domain.csproj index 33e99bf..7a4b189 100644 --- a/Netina.Domain/Netina.Domain.csproj +++ b/Netina.Domain/Netina.Domain.csproj @@ -78,6 +78,7 @@ + diff --git a/Netina.Repository/Handlers/Blogs/GetBlogsQueryHandler.cs b/Netina.Repository/Handlers/Blogs/GetBlogsQueryHandler.cs index dd8b5d6..3a0457f 100644 --- a/Netina.Repository/Handlers/Blogs/GetBlogsQueryHandler.cs +++ b/Netina.Repository/Handlers/Blogs/GetBlogsQueryHandler.cs @@ -14,13 +14,18 @@ public class GetBlogsQueryHandler : IRequestHandler Handle (GetBlogsQuery request, CancellationToken cancellationToken) { var response = new GetBlogsResponseDto(); + int count = 20; + if (request.Count != null) + count = request.Count.Value; var query = _repositoryWrapper.SetRepository().TableNoTracking; if (request.CategoryId != null) query = query.Where(b => b.CategoryId == request.CategoryId); + if (request.BlogName != null) + query = query.Where(b => b.Title.Trim().ToUpper().Contains(request.BlogName.Trim().ToUpper())); var result = await query .OrderByDescending(b => b.CreatedAt) - .Skip(request.Page * 20).Take(20) + .Skip(request.Page * count).Take(count) .Select(BlogMapper.ProjectToSDto).ToListAsync(cancellationToken); response.Pager.CurrentPage = request.Page; response.Pager.TotalItems = await query.CountAsync(cancellationToken); diff --git a/Netina.Repository/Handlers/Products/GetProductQueryHandler.cs b/Netina.Repository/Handlers/Products/GetProductQueryHandler.cs index 7a59a15..ac71894 100644 --- a/Netina.Repository/Handlers/Products/GetProductQueryHandler.cs +++ b/Netina.Repository/Handlers/Products/GetProductQueryHandler.cs @@ -1,11 +1,4 @@ using Microsoft.EntityFrameworkCore; -using Netina.Common.Models.Api; -using Netina.Common.Models.Exception; -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.CommandQueries.Queries; -using Netina.Domain.Dtos.ResponseDtos; -using Netina.Domain.Entities.Products; -using Netina.Repository.Repositories.Base.Contracts; namespace Netina.Repository.Handlers.Products;