faet : add version 0.26.30.51 , add navbaritem , fix : scheduler job issue
parent
12ab03a520
commit
e024b4d977
|
@ -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",
|
||||
|
|
|
@ -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
|
|
@ -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<IResult> GetAllAsync([FromQuery] int? page, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
||||
public async Task<IResult> GetAllAsync([FromQuery] int? page,[FromQuery]string? categoryName , IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
||||
{
|
||||
var query = repositoryWrapper.SetRepository<BlogCategory>()
|
||||
.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<BlogCategory>().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<BlogCategory>().TableNoTracking
|
||||
.OrderByDescending(b => b.Name)
|
||||
return TypedResults.Ok(await query.OrderByDescending(b => b.Name)
|
||||
.Select(BlogCategoryMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken));
|
||||
}
|
|
@ -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<IResult> 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<IResult> 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<IResult> GetAsync(Guid id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await repositoryWrapper.SetRepository<Blog>().TableNoTracking
|
||||
.Where(b=>b.Id==id)
|
||||
public async Task<IResult> GetAsync(Guid id, IRepositoryWrapper repositoryWrapper,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var dto = await repositoryWrapper.SetRepository<Blog>().TableNoTracking
|
||||
.Where(b => b.Id == id)
|
||||
.Select(BlogMapper.ProjectToLDto)
|
||||
.FirstOrDefaultAsync(cancellationToken));
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
return TypedResults.Ok(dto);
|
||||
}
|
||||
|
||||
// POST:Create Entity
|
||||
public async Task<IResult> Post([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -1,6 +1,4 @@
|
|||
using Netina.Core.Abstracts;
|
||||
|
||||
namespace Netina.Api.Controller;
|
||||
namespace Netina.Api.Controllers;
|
||||
|
||||
public class DistrictController : ICarterModule
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using MD.PersianDateTime.Standard;
|
||||
|
||||
namespace Netina.Api.Controller;
|
||||
namespace Netina.Api.Controllers;
|
||||
|
||||
public class HealthController : ICarterModule
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using Netina.Api.Views.Home;
|
||||
|
||||
namespace Netina.Api.Controller;
|
||||
namespace Netina.Api.Controllers;
|
||||
|
||||
[Route("")]
|
||||
[AllowAnonymous]
|
|
@ -1,6 +1,6 @@
|
|||
using Netina.Domain.MartenEntities.Settings;
|
||||
|
||||
namespace Netina.Api.Controller;
|
||||
namespace Netina.Api.Controllers;
|
||||
|
||||
public class MarketerController : ICarterModule
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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)
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace Netina.Api.Controller;
|
||||
namespace Netina.Api.Controllers;
|
||||
|
||||
public class ScraperController : ICarterModule
|
||||
{
|
|
@ -1,6 +1,4 @@
|
|||
using Netina.Core.CoreServices.Abstracts;
|
||||
|
||||
namespace Netina.Api.Controller;
|
||||
namespace Netina.Api.Controllers;
|
||||
|
||||
public class SearchController : ICarterModule
|
||||
{
|
|
@ -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<BlogCategory>()
|
||||
.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<Blog>().Add(ent);
|
||||
await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
}
|
||||
//var blogs = await repositoryWrapper.SetRepository<Blog>()
|
||||
// .TableNoTracking
|
||||
// .ToListAsync(cancellationToken);
|
||||
//foreach (var blog in blogs)
|
||||
//{
|
||||
// if (blog.Id == Guid.Parse("358192ec-32b0-4643-8269-b42268755b5b"))
|
||||
// {
|
||||
|
||||
// }
|
||||
// blog.Content = blog.Content.Replace(@"<p style=""text-align: center;""><strong>(10 خط ) </strong><a href=""tel:02144850335"">02144850335</a>📞 <a href=""tel:02144872230"">02144872230</a> 📞 <a href=""tel:02144872230"">02144872231</a> 📞</p>", string.Empty);
|
||||
// blog.Content = blog.Content.Replace(@"<p style=""text-align: center;""><strong>(10 خط ) </strong><a href=""tel:02144850335"">02144850335</a>📞 <a href=""tel:02144872230"">02144872230</a> 📞 <a href=""tel:02144872230"">02144872231</a> 📞</p>", string.Empty);
|
||||
// blog.Content = blog.Content.Replace(@"<p style=""text-align: center;"">تلفن های تماس :</p>", 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<Blog>()
|
||||
// .Update(blog);
|
||||
// await repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
//}
|
||||
return TypedResults.Ok();
|
||||
}
|
||||
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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
|
||||
{
|
|
@ -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<IResult> 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);
|
||||
}
|
||||
}
|
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<AssemblyVersion>0.25.29.50</AssemblyVersion>
|
||||
<FileVersion>0.25.29.50</FileVersion>
|
||||
<AssemblyVersion>0.26.30.51</AssemblyVersion>
|
||||
<FileVersion>0.26.30.51</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -123,6 +123,7 @@ app.UseExceptionHandlerMiddleware();
|
|||
app.MapCarter();
|
||||
app.UseStaticFiles();
|
||||
await app.InitialDb();
|
||||
await app.CoreInit();
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<IServiceScopeFactory>();
|
||||
using (var scope = scopeFactory.CreateScope())
|
||||
{
|
||||
var jobScheduler = scope.ServiceProvider.GetService<JobScheduler>();
|
||||
jobScheduler.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace Netina.Domain.CommandQueries.Queries;
|
||||
|
||||
|
||||
public record GetBlogsQuery(int Page, Guid? CategoryId) : IRequest<GetBlogsResponseDto>;
|
||||
public record GetBlogsQuery(int Page,int? Count, Guid? CategoryId,string? BlogName) : IRequest<GetBlogsResponseDto>;
|
|
@ -5,4 +5,5 @@ public class BlogCategorySDto : BaseDto<BlogCategorySDto , BlogCategory>
|
|||
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;
|
||||
}
|
|
@ -4,6 +4,7 @@ public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory
|
|||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public string Slug { get; internal set; } = string.Empty;
|
||||
public bool IsMain { get; set; }
|
||||
public Guid ParentId { get; set; }
|
||||
public string ParentName { get; set; } = string.Empty;
|
||||
|
|
|
@ -23,7 +23,7 @@ public partial class Blog : ApiEntity
|
|||
Slug = slug;
|
||||
}
|
||||
public string Title { get; internal set; } = string.Empty;
|
||||
public string Content { get; internal set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public string Slug { get; internal set; } = string.Empty;
|
||||
public string Tags { get; internal set; } = string.Empty;
|
||||
public int ReadingTime { get; internal set; }
|
||||
|
|
|
@ -116,6 +116,7 @@ namespace Netina.Domain.Mappers
|
|||
return p17 == null ? null : new BlogCategory()
|
||||
{
|
||||
Name = p17.Name,
|
||||
Slug = p17.Slug,
|
||||
Description = p17.Description,
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
|
@ -130,6 +131,7 @@ namespace Netina.Domain.Mappers
|
|||
BlogCategory result = p19 ?? new BlogCategory();
|
||||
|
||||
result.Name = p18.Name;
|
||||
result.Slug = p18.Slug;
|
||||
result.Description = p18.Description;
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
|
@ -143,6 +145,7 @@ namespace Netina.Domain.Mappers
|
|||
Name = p20.Name,
|
||||
BlogCount = funcMain7(p20.Blogs == null ? null : (int?)p20.Blogs.Count),
|
||||
Description = p20.Description,
|
||||
Slug = p20.Slug,
|
||||
Id = p20.Id,
|
||||
CreatedAt = p20.CreatedAt
|
||||
};
|
||||
|
@ -158,6 +161,7 @@ namespace Netina.Domain.Mappers
|
|||
result.Name = p22.Name;
|
||||
result.BlogCount = funcMain8(p22.Blogs == null ? null : (int?)p22.Blogs.Count, result.BlogCount);
|
||||
result.Description = p22.Description;
|
||||
result.Slug = p22.Slug;
|
||||
result.Id = p22.Id;
|
||||
result.CreatedAt = p22.CreatedAt;
|
||||
return result;
|
||||
|
@ -168,6 +172,7 @@ namespace Netina.Domain.Mappers
|
|||
Name = p26.Name,
|
||||
BlogCount = p26.Blogs.Count,
|
||||
Description = p26.Description,
|
||||
Slug = p26.Slug,
|
||||
Id = p26.Id,
|
||||
CreatedAt = p26.CreatedAt
|
||||
};
|
||||
|
|
|
@ -131,6 +131,7 @@ namespace Netina.Domain.Mappers
|
|||
return p19 == null ? null : new ProductCategory()
|
||||
{
|
||||
Name = p19.Name,
|
||||
Slug = p19.Slug,
|
||||
Description = p19.Description,
|
||||
IsMain = p19.IsMain,
|
||||
ParentId = (Guid?)p19.ParentId,
|
||||
|
@ -152,6 +153,7 @@ namespace Netina.Domain.Mappers
|
|||
ProductCategory result = p21 ?? new ProductCategory();
|
||||
|
||||
result.Name = p20.Name;
|
||||
result.Slug = p20.Slug;
|
||||
result.Description = p20.Description;
|
||||
result.IsMain = p20.IsMain;
|
||||
result.ParentId = (Guid?)p20.ParentId;
|
||||
|
@ -167,6 +169,7 @@ namespace Netina.Domain.Mappers
|
|||
{
|
||||
Name = p24.Name,
|
||||
Description = p24.Description,
|
||||
Slug = p24.Slug,
|
||||
IsMain = p24.IsMain,
|
||||
ParentId = p24.ParentId == null ? default(Guid) : (Guid)p24.ParentId,
|
||||
ParentName = p24.Parent != null ? p24.Parent.Name : string.Empty,
|
||||
|
@ -185,6 +188,7 @@ namespace Netina.Domain.Mappers
|
|||
|
||||
result.Name = p25.Name;
|
||||
result.Description = p25.Description;
|
||||
result.Slug = p25.Slug;
|
||||
result.IsMain = p25.IsMain;
|
||||
result.ParentId = p25.ParentId == null ? default(Guid) : (Guid)p25.ParentId;
|
||||
result.ParentName = p25.Parent != null ? p25.Parent.Name : string.Empty;
|
||||
|
@ -198,6 +202,7 @@ namespace Netina.Domain.Mappers
|
|||
{
|
||||
Name = p27.Name,
|
||||
Description = p27.Description,
|
||||
Slug = p27.Slug,
|
||||
IsMain = p27.IsMain,
|
||||
ParentId = p27.ParentId == null ? default(Guid) : (Guid)p27.ParentId,
|
||||
ParentName = p27.Parent != null ? p27.Parent.Name : string.Empty,
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
namespace Netina.Domain.MartenEntities.Settings;
|
||||
|
||||
public class NavMenuSetting
|
||||
{
|
||||
public bool ShowProductCategories { get; set; }
|
||||
public bool ShowBlogCategories { get; set; }
|
||||
public List<NavMenuItem> 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<NavMenuItem> Children { get; set; } = new();
|
||||
}
|
|
@ -78,6 +78,7 @@
|
|||
<Using Include="Netina.Domain.Entities.Users" />
|
||||
<Using Include="Netina.Domain.Entities.Warehouses" />
|
||||
<Using Include="Netina.Domain.Enums" />
|
||||
<Using Include="Netina.Domain.MartenEntities.Settings" />
|
||||
<Using Include="System.ComponentModel.DataAnnotations" />
|
||||
<Using Include="System.Diagnostics" />
|
||||
<Using Include="System.Reflection" />
|
||||
|
|
|
@ -14,13 +14,18 @@ public class GetBlogsQueryHandler : IRequestHandler<GetBlogsQuery,GetBlogsRespon
|
|||
public async Task<GetBlogsResponseDto> Handle (GetBlogsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var response = new GetBlogsResponseDto();
|
||||
int count = 20;
|
||||
if (request.Count != null)
|
||||
count = request.Count.Value;
|
||||
var query = _repositoryWrapper.SetRepository<Blog>().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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue