Compare commits

...

2 Commits

133 changed files with 4729 additions and 519 deletions

View File

@ -1 +1 @@
0.22.25.45 0.23.26.46

View File

@ -1,8 +1,8 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", "PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;",
"Postgres": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi", "Postgres": "Host=pg-0;Username=visabarterAgent;Password=xHTpBf4wC+bPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=HamyanDB;Application Name=HamyanApi",
"MartenDB": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopMartenDB;" "MartenDB": "Host=pg-0;Username=visabarterAgent;Password=xHTpBf4wC+bPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=HamyanMartenDB;"
}, },
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
@ -17,38 +17,38 @@
"TaxesFee": 9 "TaxesFee": 9
}, },
"SiteSettings": { "SiteSettings": {
"BaseUrl": "https://api.vesmeh.com", "BaseUrl": "https://api.hamyan.visabartar.com",
"WebSiteUrl": "https://vesmeh.com", "WebSiteUrl": "https://hamyan.visabartar.com",
"AdminPanelBaseUrl": "https://admin.vesmeh.com", "AdminPanelBaseUrl": "https://admin.hamyan.visabartar.com",
"StorageBaseUrl": "https://storage.vesmeh.com", "StorageBaseUrl": "https://storage.visabartar.com",
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
"UserSetting": { "UserSetting": {
"Username": "09214802813", "Username": "09214802813",
"Email": "avvampier@gmail.com", "Email": "avvampier@gmail.com",
"Password": "eF79o4P4BopCUbUK", "Password": "2Tsr87RWRn5T",
"Phone": "09214802813", "Phone": "09214802813",
"RoleName": "RootAdmin", "RoleName": "RootAdmin",
"FirstName": "همه کاره", "FirstName": "همه کاره",
"LastName": "سیستم" "LastName": "سیستم"
}, },
"Manager": { "Manager": {
"Username": "09128387004", "Username": "09122171024",
"Email": "mahanmasiha6@gmail.com", "Email": "kamran_mirzayi@gmail.com",
"Password": "eF79o4P4BopCUbUK", "Password": "YAWEheKEi7gh",
"Phone": "09128387004", "Phone": "09128387004",
"RoleName": "Manager", "RoleName": "Manager",
"FirstName": "ماهان", "FirstName": "کامران",
"LastName": "" "LastName": "میرزایی"
}, },
"StorageSetting": { "StorageSetting": {
"AccessKey": "979313b7-30fb-40ff-94d8-d0390d3fa876", "AccessKey": "de129835-b43a-4552-8ed4-865e2635ab3d",
"SecretKey": "d37a1cc6acfea3a6f92c538ef0f6601f1edcdc9143942b6470e5d1032aa6bfe2", "SecretKey": "f00197a766336e818023f90408ba3b88b4fdc86d0e7180f74f199d9f03db7575",
"BucketKey": "vesmeh-content" "BucketKey": "hamyan-content"
}, },
"JwtSettings": { "JwtSettings": {
"SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_nw+8E0EABj0Wg8c4mHg/bDBf5qGMhmBPb6u16DVe9/MzYva1e+/J1zImyIoQX2Lmra2kvzsIjGiwP7r3Znd_YA_JADE_NASABE_v+Ro/CDixScDv6EkpZnkBv9MFdPnSmFXNGMH9gA1BzQUoC1iSX9Aq+pMIw/cMKXI9WA==_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET", "SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_Co0F8AlDfth0PmBuY/0xZQX25iKGQsro5HNkm+gGto4ijSm3hJQ7SViLmR2/BtHN_YA_JADE_NASABE_MSwIOzaxUqn8awSbMx02MSwIOzaxUqn8awSbMx02_EegU4lf9LB5LOyZWXLzLCyXtAp0moUh0_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET",
"Issuer": "Brizco", "Issuer": "Hamyan",
"Audience": "Brizco", "Audience": "Hamyan",
"ExpireAddDay": "15" "ExpireAddDay": "15"
} }
}, },

View File

@ -17,15 +17,15 @@
"TaxesFee": 9 "TaxesFee": 9
}, },
"SiteSettings": { "SiteSettings": {
"BaseUrl": "http://localhost:32770", "BaseUrl": "https://api.hamyan.visabartar.com",
"WebSiteUrl": "https://hamyanedalat.com", "WebSiteUrl": "https://hamyan.visabartar.com",
"AdminPanelBaseUrl": "https://admin.hamyanedalat.com", "AdminPanelBaseUrl": "https://admin.hamyan.visabartar.com",
"StorageBaseUrl": "https://storage.hamyanedalat.com", "StorageBaseUrl": "https://storage.visabartar.com",
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
"UserSetting": { "UserSetting": {
"Username": "09214802813", "Username": "09214802813",
"Email": "avvampier@gmail.com", "Email": "avvampier@gmail.com",
"Password": "eF79o4P4BopCUbUK", "Password": "2Tsr87RWRn5T",
"Phone": "09214802813", "Phone": "09214802813",
"RoleName": "RootAdmin", "RoleName": "RootAdmin",
"FirstName": "همه کاره", "FirstName": "همه کاره",
@ -33,9 +33,9 @@
}, },
"Manager": { "Manager": {
"Username": "09122171024", "Username": "09122171024",
"Email": "info@hamyanedalat.com", "Email": "kamran_mirzayi@gmail.com",
"Password": "eF79o4P4BopCUbUK", "Password": "YAWEheKEi7gh",
"Phone": "09122171024", "Phone": "09128387004",
"RoleName": "Manager", "RoleName": "Manager",
"FirstName": "کامران", "FirstName": "کامران",
"LastName": "میرزایی" "LastName": "میرزایی"
@ -46,9 +46,9 @@
"BucketKey": "hamyan-content" "BucketKey": "hamyan-content"
}, },
"JwtSettings": { "JwtSettings": {
"SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_nw+8E0EABj0Wg8c4mHg/bDBf5qGMhmBPb6u16DVe9/MzYva1e+/J1zImyIoQX2Lmra2kvzsIjGiwP7r3Znd_YA_JADE_NASABE_v+Ro/CDixScDv6EkpZnkBv9MFdPnSmFXNGMH9gA1BzQUoC1iSX9Aq+pMIw/cMKXI9WA==_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET", "SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_Co0F8AlDfth0PmBuY/0xZQX25iKGQsro5HNkm+gGto4ijSm3hJQ7SViLmR2/BtHN_YA_JADE_NASABE_MSwIOzaxUqn8awSbMx02MSwIOzaxUqn8awSbMx02_EegU4lf9LB5LOyZWXLzLCyXtAp0moUh0_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET",
"Issuer": "HamaynEdalat", "Issuer": "Hamyan",
"Audience": "HamaynEdalat", "Audience": "Hamyan",
"ExpireAddDay": "15" "ExpireAddDay": "15"
} }
}, },

View File

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", "PostgresServer": "Host=185.220.227.88;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi",
"Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS", "Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS",
"MartenDB": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopMartenDB;" "MartenDB": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopMartenDB;"
}, },

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Exception; using Netina.Domain.Entities.Blogs;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Blogs;
using Netina.Domain.Models.Claims;
using Netina.Repository.Repositories.Base.Contracts;
namespace Netina.Api.Controller; namespace Netina.Api.Controller;
@ -41,7 +37,7 @@ public class BlogCategoryController : ICarterModule
if (page != null) if (page != null)
{ {
return TypedResults.Ok(await repositoryWrapper.SetRepository<BlogCategory>().TableNoTracking return TypedResults.Ok(await repositoryWrapper.SetRepository<BlogCategory>().TableNoTracking
.OrderByDescending(b => b.CreatedAt).Skip(page.Value * 10).Take(10) .OrderByDescending(b => b.Name).Skip(page.Value * 10).Take(10)
.Select(BlogCategoryMapper.ProjectToSDto) .Select(BlogCategoryMapper.ProjectToSDto)
.ToListAsync(cancellationToken)); .ToListAsync(cancellationToken));
} }
@ -49,7 +45,7 @@ public class BlogCategoryController : ICarterModule
{ {
return TypedResults.Ok(await repositoryWrapper.SetRepository<BlogCategory>().TableNoTracking return TypedResults.Ok(await repositoryWrapper.SetRepository<BlogCategory>().TableNoTracking
.OrderByDescending(b => b.CreatedAt) .OrderByDescending(b => b.Name)
.Select(BlogCategoryMapper.ProjectToSDto) .Select(BlogCategoryMapper.ProjectToSDto)
.ToListAsync(cancellationToken)); .ToListAsync(cancellationToken));
} }

View File

@ -23,24 +23,27 @@ public class BlogController : ICarterModule
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapPost("", Post) group.MapPost("", Post)
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs)) .RequireAuthorization(builder =>
builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()
.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapPut("", Put) group.MapPut("", Put)
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs)) .RequireAuthorization(builder =>
builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()
.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapDelete("{id}", Delete) group.MapDelete("{id}", Delete)
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs)) .RequireAuthorization(builder =>
builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()
.RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageBlogs))
.HasApiVersion(1.0); .HasApiVersion(1.0);
} }
// GET:Get All Entity // 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] Guid? blogCategoryId, IMediator mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await repositoryWrapper.SetRepository<Blog>().TableNoTracking => TypedResults.Ok(await mediator.Send(new GetBlogsQuery(page, CategoryId: blogCategoryId), cancellationToken));
.OrderByDescending(b=>b.CreatedAt)
.Skip(page*10).Take(10)
.Select(BlogMapper.ProjectToSDto).ToListAsync(cancellationToken));
// GET:Get An Entity By Id // GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) public async Task<IResult> GetAsync(Guid id, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)

View File

@ -34,7 +34,7 @@ public class SeedController : ICarterModule
.WithDisplayName("SeedBlogsAsync") .WithDisplayName("SeedBlogsAsync")
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapPost("blog/categories", SeedBlogCategoriesAsync) group.MapPost("blog/categories", SeedBlogCategoriesSlugAsync)
.WithDisplayName("SeedBlogCategoriesAsync") .WithDisplayName("SeedBlogCategoriesAsync")
.HasApiVersion(1.0); .HasApiVersion(1.0);
} }
@ -105,7 +105,15 @@ public class SeedController : ICarterModule
throw new AppException("Key is not valid", ApiResultStatusCode.UnAuthorized); throw new AppException("Key is not valid", ApiResultStatusCode.UnAuthorized);
foreach (var seedBlogRequestDto in request) foreach (var seedBlogRequestDto in request)
{ {
var ent = Blog.Create(seedBlogRequestDto.Title, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime, if (seedBlogRequestDto.CategoryId == default)
{
var noCategory = await repositoryWrapper.SetRepository<BlogCategory>()
.TableNoTracking
.FirstOrDefaultAsync(bc => bc.Name == "دسته بندی نشده", cancellationToken);
if(noCategory != null)
seedBlogRequestDto.CategoryId = noCategory.Id;
}
var ent = Blog.Create(seedBlogRequestDto.Title,seedBlogRequestDto.Slug, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime,
seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId); seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId);
foreach (var storageFileSDto in seedBlogRequestDto.Files) foreach (var storageFileSDto in seedBlogRequestDto.Files)
@ -133,12 +141,34 @@ public class SeedController : ICarterModule
categories.Add(0, baseCategory.Id); categories.Add(0, baseCategory.Id);
foreach (var requestDto in request) foreach (var requestDto in request)
{ {
var ent = BlogCategory.Create(requestDto.Name, requestDto.Description); var ent = BlogCategory.Create(requestDto.Name,requestDto.Slug, requestDto.Description);
repositoryWrapper.SetRepository<BlogCategory>().Add(ent); repositoryWrapper.SetRepository<BlogCategory>().Add(ent);
await repositoryWrapper.SaveChangesAsync(cancellationToken); await repositoryWrapper.SaveChangesAsync(cancellationToken);
categories.Add(requestDto.BaseCategoryId, ent.Id); categories.Add(requestDto.BaseCategoryId, ent.Id);
} }
return TypedResults.Ok(categories);
}
public async Task<IResult> SeedBlogCategoriesSlugAsync([FromBody] List<SeedBlogCategoryRequestDto> request, [FromQuery] string key, [FromServices] IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken)
{
if (key != "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A==")
throw new AppException("Key is not valid", ApiResultStatusCode.UnAuthorized);
Dictionary<int, Guid> categories = new Dictionary<int, Guid>();
foreach (var requestDto in request)
{
var ent = await repositoryWrapper.SetRepository<BlogCategory>()
.TableNoTracking
.FirstOrDefaultAsync(bc=>bc.Name==requestDto.Name,cancellationToken);
if (ent == null)
continue;
ent.Slug = requestDto.Slug;
repositoryWrapper.SetRepository<BlogCategory>().Update(ent);
await repositoryWrapper.SaveChangesAsync(cancellationToken);
categories.Add(requestDto.BaseCategoryId, ent.Id);
}
return TypedResults.Ok(categories); return TypedResults.Ok(categories);
} }
} }

View File

@ -11,7 +11,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" /> <PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" /> <PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
@ -19,25 +19,25 @@
<PackageReference Include="FluentValidation" Version="11.9.0" /> <PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" /> <PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.0.0" /> <PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.3"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.4">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Autofac" Version="8.0.0" /> <PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.0.17" /> <PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.0.17" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.3" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.20.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Sentry.Serilog" Version="4.2.1" /> <PackageReference Include="Sentry.Serilog" Version="4.4.0" />
<PackageReference Include="Serilog" Version="3.1.1" /> <PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" /> <PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" /> <PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
@ -52,7 +52,7 @@
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.1" /> <PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.3" /> <PackageReference Include="System.Drawing.Common" Version="8.0.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -6,7 +6,7 @@ builder.Host.UseSerilog();
LoggerConfig.ConfigureSerilog(); LoggerConfig.ConfigureSerilog();
string env = builder.Environment.IsDevelopment() == true ? "Development" : "Production"; string env = builder.Environment.IsDevelopment() == true ? "Development" : "Production";
builder.Host.UseContentRoot(Directory.GetCurrentDirectory()); builder.Host.UseContentRoot(Directory.GetCurrentDirectory());
string projectName = "Hamyan"; string projectName = "Vesmeh";
if (builder.Environment.IsDevelopment()) if (builder.Environment.IsDevelopment())
builder.Configuration.AddJsonFile($"AppSettings/appsettings.json").AddJsonFile($"AppSettings/appsettings.{env}{projectName}.json"); builder.Configuration.AddJsonFile($"AppSettings/appsettings.json").AddJsonFile($"AppSettings/appsettings.{env}{projectName}.json");
@ -17,7 +17,6 @@ var siteSetting = configuration.GetSection(nameof(SiteSettings)).Get<SiteSetting
builder.Services.Configure<SiteSettings>(configuration.GetSection(nameof(SiteSettings))); builder.Services.Configure<SiteSettings>(configuration.GetSection(nameof(SiteSettings)));
// Add services to the container. // Add services to the container.
builder.Services.AddControllers(); builder.Services.AddControllers();

View File

@ -1,14 +1,29 @@
using Marten; using Autofac.Extras.Quartz;
using Netina.Domain.Entities.Users; using Marten;
using Netina.Domain.Models.Settings; using System.Collections.Specialized;
using Netina.Repository.Extensions; using Netina.Core.QuartzServices;
using Netina.Repository.Models;
using Weasel.Core; using Weasel.Core;
namespace Netina.Api.WebFramework.Configurations; namespace Netina.Api.WebFramework.Configurations;
public static class ServiceExtensions public static class ServiceExtensions
{ {
public static void AddSchedulerToAutoFac(this ContainerBuilder builder)
{
// configure and register Quartz
var schedulerConfig = new NameValueCollection {
{"quartz.threadPool.threadCount", "3"},
{"quartz.scheduler.threadName", "BrizCo_Scheduler"}
};
builder.RegisterModule(new QuartzAutofacFactoryModule
{
ConfigurationProvider = c => schedulerConfig
});
builder.RegisterModule(new QuartzAutofacJobsModule(typeof(JobScheduler).Assembly));
builder.RegisterType<JobScheduler>().AsSelf();
}
public static void AddIpRateLimit(this IServiceCollection services, IConfigurationRoot configuration) public static void AddIpRateLimit(this IServiceCollection services, IConfigurationRoot configuration)
{ {

View File

@ -1,7 +1,14 @@
namespace Netina.Common.Extensions using System.Web;
using System.Xml.Linq;
namespace Netina.Common.Extensions
{ {
public static class StringExtensions public static class StringExtensions
{ {
public static string GetSlug(string title)
{
return HttpUtility.UrlEncode(title.Replace(' ', '-'));
}
public static string ToPriceWhitPriceType(this long price, string priceType) public static string ToPriceWhitPriceType(this long price, string priceType)
{ {
return price.ToString("N0") + " " + priceType; return price.ToString("N0") + " " + priceType;

View File

@ -11,7 +11,7 @@
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" /> <PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.4.1" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />
</ItemGroup> </ItemGroup>
<!--<PropertyGroup> <!--<PropertyGroup>

View File

@ -1,15 +1,10 @@
using System.IO.Compression; using System.IO.Compression;
using System.Web; using System.Web;
using System.Xml; using System.Xml;
using Netina.Common.Models.Api;
using Netina.Core.Abstracts;
using Netina.Core.BaseServices.Abstracts;
using Netina.Core.Models; using Netina.Core.Models;
using Netina.Domain.Entities.Blogs; using Netina.Domain.Entities.Blogs;
using Netina.Domain.Entities.ProductCategories; using Netina.Domain.Entities.ProductCategories;
using Netina.Domain.Entities.Products; using Netina.Domain.Entities.Products;
using Netina.Domain.Models.Settings;
using Netina.Repository.Repositories.Base.Contracts;
namespace Netina.Core.BaseServices; namespace Netina.Core.BaseServices;
@ -190,7 +185,7 @@ public class SiteMapService : ISiteMapService
foreach (var product in group) foreach (var product in group)
{ {
var productUrl = $"{_siteSetting.WebSiteUrl}/products/{product.Id}/{HttpUtility.UrlEncode(product.PersianName.Replace(' ', '-'))}"; var productUrl = $"{_siteSetting.WebSiteUrl}/products/{product.Id}/{product.Slug}";
XmlElement urlElement = doc.CreateElement("url", doc.DocumentElement?.NamespaceURI); XmlElement urlElement = doc.CreateElement("url", doc.DocumentElement?.NamespaceURI);
root.AppendChild(urlElement); root.AppendChild(urlElement);
@ -284,7 +279,7 @@ public class SiteMapService : ISiteMapService
root.AppendChild(urlElement); root.AppendChild(urlElement);
XmlElement loc = doc.CreateElement("loc", doc.DocumentElement?.NamespaceURI); XmlElement loc = doc.CreateElement("loc", doc.DocumentElement?.NamespaceURI);
loc.InnerText = Path.Combine(blog.Title); loc.InnerText = Path.Combine($"{_siteSetting.WebSiteUrl}/blogs/{blog.Id}/{blog.Slug}");
urlElement.AppendChild(loc); urlElement.AppendChild(loc);
XmlElement lastmod = doc.CreateElement("lastmod", doc.DocumentElement?.NamespaceURI); XmlElement lastmod = doc.CreateElement("lastmod", doc.DocumentElement?.NamespaceURI);

View File

@ -12,9 +12,9 @@
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" /> <PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
<PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" /> <PackageReference Include="Autofac.Extras.Quartz" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.3" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageReference Include="Quartz" Version="3.8.1" /> <PackageReference Include="Quartz" Version="3.8.1" />
<PackageReference Include="Syncfusion.Pdf.Net.Core" Version="24.1.41" /> <PackageReference Include="Syncfusion.Pdf.Net.Core" Version="25.1.40" />
</ItemGroup> </ItemGroup>

View File

@ -0,0 +1,42 @@
using Microsoft.Extensions.Logging;
using Quartz;
namespace Netina.Core.QuartzServices;
public class JobScheduler
{
private readonly IScheduler _scheduler;
private readonly ILogger<JobScheduler> _logger;
public JobScheduler(IScheduler scheduler, ILogger<JobScheduler> logger)
{
_scheduler = scheduler;
_logger = logger;
}
public void Start()
{
_scheduler.Start();
IJobDetail job = JobBuilder.Create<SiteMapScheduledJob>()
.WithIdentity("SiteMapJob", "admin")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("SiteMapJobTrigger", "admin")
.WithSchedule(CronScheduleBuilder.AtHourAndMinuteOnGivenDaysOfWeek(3, 0,
DayOfWeek.Saturday,
DayOfWeek.Sunday,
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday))
.StartNow()
.Build();
var offset = _scheduler.ScheduleJob(job, trigger);
_logger.LogInformation($"======== Table Schedulers Set For {offset.Result.ToString()} IN {DateTime.Now.ToString()} ===========");
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.Extensions.Logging;
using Quartz;
namespace Netina.Core.QuartzServices;
public class SiteMapScheduledJob : IJob
{
private readonly ILogger<SiteMapScheduledJob> _logger;
private readonly ISiteMapService _siteMapService;
public SiteMapScheduledJob(ILogger<SiteMapScheduledJob> logger,ISiteMapService siteMapService)
{
_logger = logger;
_siteMapService = siteMapService;
}
public async Task Execute(IJobExecutionContext context)
{
await _siteMapService.CreateSiteMapAsync();
_logger.LogInformation($"Site Map Job Done At : {DateTime.Now}");
}
}

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; 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<BrandSDto>;

View File

@ -1,8 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Commands;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Enums;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateDiscountCommand(string Code, public sealed record CreateDiscountCommand(string Code,
string Description, string Description,

View File

@ -1,9 +1,4 @@
using Netina.Domain.Dtos.RequestDtos; namespace Netina.Domain.CommandQueries.Commands;
using Netina.Domain.Dtos.ResponseDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Enums;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateOrderCommand(string DiscountCode, List<OrderProductSDto> OrderProducts, OrderDeliverySDto OrderDelivery) : IRequest<OrderSDto>; public sealed record CreateOrderCommand(string DiscountCode, List<OrderProductSDto> OrderProducts, OrderDeliverySDto OrderDelivery) : IRequest<OrderSDto>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Entities.Orders; namespace Netina.Domain.CommandQueries.Commands;
using Netina.Domain.Enums;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateBaseOrderCommand(Guid UserId) : IRequest<Order>; public sealed record CreateBaseOrderCommand(Guid UserId) : IRequest<Order>;

View File

@ -1,5 +1,3 @@
using Netina.Domain.Enums; namespace Netina.Domain.CommandQueries.Commands;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateOrUpdatePaymentCommand(Guid? Id,string FactorNumber, double Amount, string Description, string TransactionCode, string CardPan, string Authority, PaymentType Type, PaymentStatus Status, Guid OrderId, Guid UserId) : IRequest<bool>; public sealed record CreateOrUpdatePaymentCommand(Guid? Id,string FactorNumber, double Amount, string Description, string TransactionCode, string CardPan, string Authority, PaymentType Type, PaymentStatus Status, Guid OrderId, Guid UserId) : IRequest<bool>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Commands;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateProductCategoryCommand( public sealed record CreateProductCategoryCommand(
string Name, string Name,

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Commands;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateProductCommand( public sealed record CreateProductCommand(
string PersianName, string PersianName,

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.CommandQueries.Commands;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateReviewCommand(string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId) : IRequest<ReviewSDto>; public sealed record CreateReviewCommand(string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId) : IRequest<ReviewSDto>;
public sealed record UpdateReviewCommand(Guid Id,string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId): IRequest<bool>; public sealed record UpdateReviewCommand(Guid Id,string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId): IRequest<bool>;

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.CommandQueries.Commands;
namespace Netina.Domain.CommandQueries.Commands;
public sealed record CreateShippingCommand ( public sealed record CreateShippingCommand (
string Name, string Name,

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.CommandQueries.Queries;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetAddressesQuery():IRequest<List<UserAddressSDto>>; public sealed record GetAddressesQuery():IRequest<List<UserAddressSDto>>;
public sealed record GetUserAddressesQuery(Guid? UserId) : IRequest<List<UserAddressSDto>>; public sealed record GetUserAddressesQuery(Guid? UserId) : IRequest<List<UserAddressSDto>>;

View File

@ -0,0 +1,4 @@
namespace Netina.Domain.CommandQueries.Queries;
public record GetBlogsQuery(int Page, Guid? CategoryId) : IRequest<GetBlogsResponseDto>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Queries;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.CommandQueries.Queries;
public record GetBrandQuery(Guid Id) : IRequest<BrandLDto>; public record GetBrandQuery(Guid Id) : IRequest<BrandLDto>;
public record GetBrandsQuery(int? Page, string? BrandName , Guid CategoryId) : IRequest<List<BrandSDto>>; public record GetBrandsQuery(int? Page, string? BrandName , Guid CategoryId) : IRequest<List<BrandSDto>>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Queries;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetDiscountQuery(Guid Id) : IRequest<DiscountLDto>; public sealed record GetDiscountQuery(Guid Id) : IRequest<DiscountLDto>;
public sealed record GetDiscountsQuery(int Page = 0) : IRequest<List<DiscountSDto>>; public sealed record GetDiscountsQuery(int Page = 0) : IRequest<List<DiscountSDto>>;

View File

@ -1,5 +1,3 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.CommandQueries.Queries;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetNewsletterMembersQuery(int Page = 0) : IRequest<List<NewsletterMemberSDto>>; public sealed record GetNewsletterMembersQuery(int Page = 0) : IRequest<List<NewsletterMemberSDto>>;

View File

@ -1,5 +1,3 @@
using Netina.Domain.Entities.Orders; namespace Netina.Domain.CommandQueries.Queries;
namespace Netina.Domain.CommandQueries.Queries;
public record GetUserOrderBagQuery() : IRequest<Order>; public record GetUserOrderBagQuery() : IRequest<Order>;

View File

@ -1,9 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Queries;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Enums;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetOrderLDtoQuery(Guid Id) : IRequest<OrderLDto>; public sealed record GetOrderLDtoQuery(Guid Id) : IRequest<OrderLDto>;

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.CommandQueries.Queries;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetPaymentQuery(Guid Id = default , string? Authority = null) : IRequest<PaymentSDto>; public sealed record GetPaymentQuery(Guid Id = default , string? Authority = null) : IRequest<PaymentSDto>;
public sealed record GetPaymentsQuery(int Page = 0) : IRequest<List<PaymentSDto>>; public sealed record GetPaymentsQuery(int Page = 0) : IRequest<List<PaymentSDto>>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Queries;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.CommandQueries.Queries;
public record GetProductCategoryQuery(Guid Id) : IRequest<ProductCategoryLDto>; public record GetProductCategoryQuery(Guid Id) : IRequest<ProductCategoryLDto>;
public record GetProductCategoriesQuery(int? Page , bool? SortByMain, string? CategoryName) : IRequest<List<ProductCategorySDto>>; public record GetProductCategoriesQuery(int? Page , bool? SortByMain, string? CategoryName) : IRequest<List<ProductCategorySDto>>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.ResponseDtos; namespace Netina.Domain.CommandQueries.Queries;
using Netina.Domain.Enums;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetProductQuery(Guid Id) : IRequest<GetProductResponseDto>; public sealed record GetProductQuery(Guid Id) : IRequest<GetProductResponseDto>;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.CommandQueries.Queries;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.CommandQueries.Queries;
public record GetReviewsQuery(int Page = 0) : IRequest<List<ReviewSDto>>; public record GetReviewsQuery(int Page = 0) : IRequest<List<ReviewSDto>>;
public record GetReviewQuery(Guid Id) : IRequest<ReviewLDto>; public record GetReviewQuery(Guid Id) : IRequest<ReviewLDto>;

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.CommandQueries.Queries;
namespace Netina.Domain.CommandQueries.Queries;
public sealed record GetShippingsQuery(int Page = 0) : IRequest<List<ShippingSDto>>; public sealed record GetShippingsQuery(int Page = 0) : IRequest<List<ShippingSDto>>;
public sealed record GetShippingQuery(Guid Id) : IRequest<ShippingSDto>; public sealed record GetShippingQuery(Guid Id) : IRequest<ShippingSDto>;

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Dtos.FilterDtos;
namespace Netina.Domain.Dtos.FilterDtos;
public class BaseFilterDto public class BaseFilterDto
{ {

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Dtos.FilterDtos;
namespace Netina.Domain.Dtos.FilterDtos;
public class ExpressDeliveryFilter : BaseFilterDto public class ExpressDeliveryFilter : BaseFilterDto
{ {

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Dtos.FilterDtos;
namespace Netina.Domain.Dtos.FilterDtos;
public class PriceFilterDto : BaseFilterDto public class PriceFilterDto : BaseFilterDto
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Blogs;
namespace Netina.Domain.Dtos.LargDtos;
public class BlogCategoryLDto : BaseDto<BlogCategoryLDto, BlogCategory> public class BlogCategoryLDto : BaseDto<BlogCategoryLDto, BlogCategory>
{ {

View File

@ -1,14 +1,11 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Blogs;
namespace Netina.Domain.Dtos.LargDtos;
public class BlogLDto : BaseDto<BlogLDto , Blog> public class BlogLDto : BaseDto<BlogLDto , Blog>
{ {
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty; public string Content { get; set; } = string.Empty;
public string Tags { get; set; } = string.Empty; public string Tags { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public int ReadingTime { get; set; } public int ReadingTime { get; set; }
public string Summery { get; set; } = string.Empty; public string Summery { get; set; } = string.Empty;
public bool IsSuggested { get; set; } public bool IsSuggested { get; set; }

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Brands;
namespace Netina.Domain.Dtos.LargDtos;
public class BrandLDto : BaseDto<BrandLDto,Brand> public class BrandLDto : BaseDto<BrandLDto,Brand>
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Entities.Discounts;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.LargDtos;
public class DiscountLDto : BaseDto<DiscountLDto,Discount> public class DiscountLDto : BaseDto<DiscountLDto,Discount>
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.ProductCategories;
namespace Netina.Domain.Dtos.LargDtos;
public class ProductCategoryLDto : BaseDto<ProductCategoryLDto, ProductCategory> public class ProductCategoryLDto : BaseDto<ProductCategoryLDto, ProductCategory>
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Dtos.LargDtos;
public class ProductLDto : BaseDto<ProductLDto,Product> public class ProductLDto : BaseDto<ProductLDto,Product>
{ {
@ -11,6 +7,7 @@ public class ProductLDto : BaseDto<ProductLDto,Product>
public string Summery { get; set; } = string.Empty; public string Summery { get; set; } = string.Empty;
public string ExpertCheck { get; set; } = string.Empty; public string ExpertCheck { get; set; } = string.Empty;
public string Tags { get; set; } = string.Empty; public string Tags { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Warranty { get; set; } = string.Empty; public string Warranty { get; set; } = string.Empty;
public double CostWithDiscount { get; set; } public double CostWithDiscount { get; set; }
public double DiscountPercent { get; set; } public double DiscountPercent { get; set; }

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.LargDtos;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Dtos.LargDtos;
public class ReviewLDto : BaseDto<ReviewLDto,Review> public class ReviewLDto : BaseDto<ReviewLDto,Review>
{ {

View File

@ -9,6 +9,7 @@ public class SeedBlogRequestDto
public string Summery { get; set; } = string.Empty; public string Summery { get; set; } = string.Empty;
public bool IsSuggested { get; set; } public bool IsSuggested { get; set; }
public Guid CategoryId { get; set; } public Guid CategoryId { get; set; }
public string Slug { get; set; } = string.Empty;
public List<StorageFileSDto> Files { get; set; } = new(); public List<StorageFileSDto> Files { get; set; } = new();
} }
@ -16,5 +17,6 @@ public class SeedBlogCategoryRequestDto
{ {
public int BaseCategoryId { get; set; } public int BaseCategoryId { get; set; }
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
} }

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Dtos.RequestDtos;
namespace Netina.Domain.Dtos.RequestDtos;
public class UserActionRequestDto public class UserActionRequestDto
{ {

View File

@ -0,0 +1,8 @@
namespace Netina.Domain.Dtos.ResponseDtos;
public class GetBlogsResponseDto
{
public List<BlogSDto> Blogs { get; set; } = new List<BlogSDto>();
public PagerResponseDto Pager { get; set; } = new PagerResponseDto();
}

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.LargDtos; namespace Netina.Domain.Dtos.ResponseDtos;
namespace Netina.Domain.Dtos.ResponseDtos;
public class GetProductResponseDto public class GetProductResponseDto
{ {

View File

@ -1,5 +1,4 @@
using Netina.Domain.Dtos.FilterDtos; using Netina.Domain.Dtos.FilterDtos;
using Netina.Domain.Dtos.SmallDtos;
namespace Netina.Domain.Dtos.ResponseDtos; namespace Netina.Domain.Dtos.ResponseDtos;

View File

@ -1,6 +1,4 @@
using Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.Dtos.ResponseDtos;
namespace Netina.Domain.Dtos.ResponseDtos;
public class ProfileResponseDto public class ProfileResponseDto
{ {

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Dtos.ResponseDtos;
namespace Netina.Domain.Dtos.ResponseDtos;
public class VerifyCodeResponseDto public class VerifyCodeResponseDto
{ {

View File

@ -1,9 +1,4 @@
using Netina.Common.Extensions; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Common.Models.Mapper;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class ApplicationUserSDto : BaseDto<ApplicationUserSDto, ApplicationUser> public class ApplicationUserSDto : BaseDto<ApplicationUserSDto, ApplicationUser>
{ {

View File

@ -1,5 +1,4 @@
using Netina.Common.Models.Mapper; using Netina.Domain.MartenEntities.Pages;
using Netina.Domain.MartenEntities.Pages;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.Dtos.SmallDtos;

View File

@ -1,10 +1,8 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Blogs;
namespace Netina.Domain.Dtos.SmallDtos;
public class BlogCategorySDto : BaseDto<BlogCategorySDto , BlogCategory> public class BlogCategorySDto : BaseDto<BlogCategorySDto , BlogCategory>
{ {
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public int BlogCount { get; set; }
public string Description { get; set; } = string.Empty; public string Description { get; set; } = string.Empty;
} }

View File

@ -1,12 +1,9 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Blogs;
namespace Netina.Domain.Dtos.SmallDtos;
public class BlogSDto : BaseDto<BlogSDto , Blog> public class BlogSDto : BaseDto<BlogSDto , Blog>
{ {
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty; public string Slug { get; set; } = string.Empty;
public string Tags { get; set; } = string.Empty; public string Tags { get; set; } = string.Empty;
public int ReadingTime { get; set; } public int ReadingTime { get; set; }
public string Summery { get; set; } = string.Empty; public string Summery { get; set; } = string.Empty;

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Brands;
namespace Netina.Domain.Dtos.SmallDtos;
public class BrandSDto : BaseDto<BrandSDto , Brand> public class BrandSDto : BaseDto<BrandSDto , Brand>
{ {

View File

@ -1,9 +1,4 @@
using Netina.Common.Extensions; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Common.Models.Mapper;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class CustomerSDto : BaseDto<CustomerSDto, Customer> public class CustomerSDto : BaseDto<CustomerSDto, Customer>
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Discounts;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class DiscountSDto : BaseDto<DiscountSDto,Discount> public class DiscountSDto : BaseDto<DiscountSDto,Discount>
{ {

View File

@ -1,9 +1,4 @@
using Netina.Common.Extensions; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Common.Models.Mapper;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class ManagerSDto : BaseDto<ManagerSDto, Manager> public class ManagerSDto : BaseDto<ManagerSDto, Manager>
{ {

View File

@ -1,9 +1,4 @@
using Netina.Common.Extensions; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Common.Models.Mapper;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class MarketerSDto : BaseDto<MarketerSDto, Marketer> public class MarketerSDto : BaseDto<MarketerSDto, Marketer>
{ {

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Users;
namespace Netina.Domain.Dtos.SmallDtos;
public class NewsletterMemberSDto : BaseDto<NewsletterMemberSDto,NewsletterMember> public class NewsletterMemberSDto : BaseDto<NewsletterMemberSDto,NewsletterMember>
{ {

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Orders;
namespace Netina.Domain.Dtos.SmallDtos;
public class OrderDeliverySDto : BaseDto<OrderDeliverySDto, OrderDelivery> public class OrderDeliverySDto : BaseDto<OrderDeliverySDto, OrderDelivery>
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class OrderProductSDto : BaseDto<OrderProductSDto, OrderProduct> public class OrderProductSDto : BaseDto<OrderProductSDto, OrderProduct>
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos;
public class OrderSDto : BaseDto<OrderSDto, Order> public class OrderSDto : BaseDto<OrderSDto, Order>
{ {
public double TotalPrice { get; set; } public double TotalPrice { get; set; }

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.ProductCategories;
namespace Netina.Domain.Dtos.SmallDtos;
public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory> public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory>
{ {

View File

@ -1,12 +1,10 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Dtos.SmallDtos;
public class ProductSDto : BaseDto<ProductSDto, Product> public class ProductSDto : BaseDto<ProductSDto, Product>
{ {
public string PersianName { get; set; } = string.Empty; public string PersianName { get; set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string EnglishName { get; set; } = string.Empty; public string EnglishName { get; set; } = string.Empty;
public string Summery { get; set; } = string.Empty; public string Summery { get; set; } = string.Empty;
public string ExpertCheck { get; set; } = string.Empty; public string ExpertCheck { get; set; } = string.Empty;

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Dtos.SmallDtos;
public class ReviewSDto : BaseDto<ReviewSDto, Review> public class ReviewSDto : BaseDto<ReviewSDto, Review>
{ {

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Warehouses;
namespace Netina.Domain.Dtos.SmallDtos;
public class ShippingSDto : BaseDto<ShippingSDto,Shipping> public class ShippingSDto : BaseDto<ShippingSDto,Shipping>
{ {

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Dtos.SmallDtos;
public class SpecificationSDto : BaseDto<SpecificationSDto,Specification> public class SpecificationSDto : BaseDto<SpecificationSDto,Specification>
{ {

View File

@ -1,8 +1,4 @@
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Netina.Common.Extensions;
using Netina.Common.Models.Mapper;
using Netina.Domain.Entities.StorageFiles;
using Netina.Domain.Enums;
namespace Netina.Domain.Dtos.SmallDtos; namespace Netina.Domain.Dtos.SmallDtos;

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Mapper; namespace Netina.Domain.Dtos.SmallDtos;
using Netina.Domain.Entities.Users;
namespace Netina.Domain.Dtos.SmallDtos;
public class UserAddressSDto : BaseDto<UserAddressSDto,UserAddress> public class UserAddressSDto : BaseDto<UserAddressSDto,UserAddress>
{ {

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Entities.Accounting;
namespace Netina.Domain.Entities.Accounting;
public partial class Payment public partial class Payment
{ {

View File

@ -1,9 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Accounting;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Accounting;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]

View File

@ -1,4 +1,4 @@
using Netina.Domain.Enums; using Microsoft.IdentityModel.Tokens;
namespace Netina.Domain.Entities.Blogs; namespace Netina.Domain.Entities.Blogs;
@ -6,9 +6,16 @@ public partial class Blog
{ {
public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId) public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
{ {
return new Blog(title, content, tags, readingTime, summery, isSuggested, categoryId); var slug = StringExtensions.GetSlug(title);
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId);
} }
public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId)
{
if (slug.IsNullOrEmpty())
slug = StringExtensions.GetSlug(title);
return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId);
}
public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType) public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)
{ {
var file = BlogStorageFile.Create(name, fileLocation, fileName, isHeader, isPrimary, fileType, this.Id); var file = BlogStorageFile.Create(name, fileLocation, fileName, isHeader, isPrimary, fileType, this.Id);
@ -27,8 +34,15 @@ public partial class BlogStorageFile
public partial class BlogCategory public partial class BlogCategory
{ {
public static BlogCategory Create(string name,string description) public static BlogCategory Create(string name, string description)
{ {
return new BlogCategory(name, description); var slug = StringExtensions.GetSlug(name);
return new BlogCategory(name, slug, description);
}
public static BlogCategory Create(string name, string slug, string description)
{
if (slug.IsNullOrEmpty())
slug = StringExtensions.GetSlug(name);
return new BlogCategory(name, slug, description);
} }
} }

View File

@ -1,6 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Blogs;
namespace Netina.Domain.Entities.Blogs;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
@ -13,7 +11,7 @@ public partial class Blog : ApiEntity
{ {
} }
public Blog(string title,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId) public Blog(string title,string slug,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId)
{ {
Title = title; Title = title;
Content = content; Content = content;
@ -22,9 +20,11 @@ public partial class Blog : ApiEntity
Summery = summery; Summery = summery;
IsSuggested = isSuggested; IsSuggested = isSuggested;
CategoryId = categoryId; CategoryId = categoryId;
Slug = slug;
} }
public string Title { get; internal set; } = string.Empty; public string Title { get; internal set; } = string.Empty;
public string Content { get; internal set; } = string.Empty; public string Content { get; internal set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Tags { get; internal set; } = string.Empty; public string Tags { get; internal set; } = string.Empty;
public int ReadingTime { get; internal set; } public int ReadingTime { get; internal set; }
public string Summery { get; internal set; } = string.Empty; public string Summery { get; internal set; } = string.Empty;

View File

@ -1,6 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Blogs;
namespace Netina.Domain.Entities.Blogs;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
@ -12,12 +10,14 @@ public partial class BlogCategory : ApiEntity
} }
public BlogCategory(string name, string description) public BlogCategory(string name,string slug, string description)
{ {
Name = name; Name = name;
Slug = slug;
Description = description; Description = description;
} }
public string Name { get; internal set; } = string.Empty; public string Name { get; internal set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; internal set; } = string.Empty; public string Description { get; internal set; } = string.Empty;
public List<Blog> Blogs { get; internal set; } = new(); public List<Blog> Blogs { get; internal set; } = new();
} }

View File

@ -1,12 +1,12 @@
using Netina.Domain.Enums; namespace Netina.Domain.Entities.Brands;
namespace Netina.Domain.Entities.Brands;
public partial class Brand public partial class Brand
{ {
public static Brand Create(string persianName, string englishName, string description, bool hasSpecialPage, string pageUrl) public static Brand Create(string persianName, string englishName, string description, bool hasSpecialPage, string pageUrl)
{ {
return new Brand(persianName,englishName, description, hasSpecialPage, pageUrl);
var slug = StringExtensions.GetSlug(persianName);
return new Brand(persianName, slug, englishName, description, hasSpecialPage, pageUrl);
} }
public BrandStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType) public BrandStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType)

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Brands;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Entities.Brands;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
@ -15,9 +12,10 @@ public partial class Brand : ApiEntity
} }
public Brand(string persianName,string englishName, string description, bool hasSpecialPage, string pageUrl) public Brand(string persianName,string slug,string englishName, string description, bool hasSpecialPage, string pageUrl)
{ {
PersianName = persianName; PersianName = persianName;
Slug = slug;
EnglishName = englishName; EnglishName = englishName;
Description = description; Description = description;
HasSpecialPage = hasSpecialPage; HasSpecialPage = hasSpecialPage;
@ -25,6 +23,7 @@ public partial class Brand : ApiEntity
} }
public string PersianName { get; internal set; } = string.Empty; public string PersianName { get; internal set; } = string.Empty;
public string EnglishName { get; internal set; } = string.Empty; public string EnglishName { get; internal set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; internal set; } = string.Empty; public string Description { get; internal set; } = string.Empty;
public bool HasSpecialPage { get; internal set; } public bool HasSpecialPage { get; internal set; }
public string PageUrl { get; internal set; } = string.Empty; public string PageUrl { get; internal set; } = string.Empty;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Entities.StorageFiles; namespace Netina.Domain.Entities.Brands;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Brands;
public partial class BrandStorageFile : StorageFile public partial class BrandStorageFile : StorageFile
{ {

View File

@ -1,7 +1,4 @@
using Netina.Domain.Entities.ProductCategories; namespace Netina.Domain.Entities.Discounts;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Discounts;
public partial class CategoryDiscount : Discount public partial class CategoryDiscount : Discount
{ {

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Entities.Discounts;
namespace Netina.Domain.Entities.Discounts;
public partial class Discount public partial class Discount
{ {

View File

@ -1,9 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Discounts;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Discounts;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]

View File

@ -1,7 +1,4 @@
using Netina.Domain.Entities.Products; namespace Netina.Domain.Entities.Discounts;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Discounts;
public partial class ProductDiscount : Discount public partial class ProductDiscount : Discount
{ {

View File

@ -1,7 +1,5 @@
using Netina.Common.Extensions; using Netina.Common.Models.Api;
using Netina.Common.Models.Api;
using Netina.Common.Models.Exception; using Netina.Common.Models.Exception;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Orders; namespace Netina.Domain.Entities.Orders;

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Entity; using Netina.Domain.Entities.Accounting;
using Netina.Domain.Entities.Accounting;
using Netina.Domain.Entities.Users;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Orders; namespace Netina.Domain.Entities.Orders;

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Orders;
using Netina.Domain.Entities.Users;
using Netina.Domain.Entities.Warehouses;
namespace Netina.Domain.Entities.Orders;
public partial class OrderDelivery : ApiEntity public partial class OrderDelivery : ApiEntity
{ {

View File

@ -1,8 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Orders;
using Netina.Domain.Entities.Products;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Orders;
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]

View File

@ -1,4 +1,4 @@
using Netina.Domain.Enums; using System.Web;
namespace Netina.Domain.Entities.ProductCategories; namespace Netina.Domain.Entities.ProductCategories;
@ -6,7 +6,8 @@ public partial class ProductCategory
{ {
public static ProductCategory Create(string name, string description,bool isMain) public static ProductCategory Create(string name, string description,bool isMain)
{ {
return new ProductCategory(name, description, isMain); var slug = StringExtensions.GetSlug(name);
return new ProductCategory(name, slug, description, isMain);
} }
public void SetParent(Guid parentId) public void SetParent(Guid parentId)

View File

@ -1,7 +1,5 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.ProductCategories;
using Netina.Domain.Entities.Products;
namespace Netina.Domain.Entities.ProductCategories;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
@ -13,13 +11,15 @@ public partial class ProductCategory : ApiEntity
} }
public ProductCategory(string name, string description,bool isMain) public ProductCategory(string name,string slug, string description,bool isMain)
{ {
Name = name; Name = name;
Slug = slug;
Description = description; Description = description;
IsMain = isMain; IsMain = isMain;
} }
public string Name { get; internal set; } = string.Empty; public string Name { get; internal set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Description { get; internal set; } = string.Empty; public string Description { get; internal set; } = string.Empty;
public bool IsMain { get; set; } public bool IsMain { get; set; }

View File

@ -1,7 +1,4 @@
using Netina.Domain.Entities.StorageFiles; namespace Netina.Domain.Entities.ProductCategories;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.ProductCategories;
public partial class ProductCategoryStorageFile : StorageFile public partial class ProductCategoryStorageFile : StorageFile
{ {

View File

@ -1,4 +1,5 @@
using Netina.Domain.Enums; using System.Web;
using System.Xml.Linq;
namespace Netina.Domain.Entities.Products; namespace Netina.Domain.Entities.Products;
@ -14,9 +15,11 @@ public partial class Product
Guid brandId, Guid brandId,
Guid categoryId) Guid categoryId)
{ {
var slug = StringExtensions.GetSlug(persianName);
return new Product( return new Product(
persianName, persianName,
englishName, englishName,
slug,
summery, summery,
expertCheck, expertCheck,
tags, tags,

View File

@ -1,9 +1,5 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Products;
using Netina.Domain.Entities.Brands;
using Netina.Domain.Entities.Orders;
using Netina.Domain.Entities.ProductCategories;
namespace Netina.Domain.Entities.Products;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget )] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget )]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
@ -16,8 +12,10 @@ public partial class Product : ApiEntity
} }
public Product(string persianName, public Product(
string persianName,
string englishName, string englishName,
string slug,
string summery, string summery,
string expertCheck, string expertCheck,
string tags, string tags,
@ -34,6 +32,7 @@ public partial class Product : ApiEntity
{ {
PersianName = persianName; PersianName = persianName;
EnglishName = englishName; EnglishName = englishName;
Slug = slug;
Summery = summery; Summery = summery;
ExpertCheck = expertCheck; ExpertCheck = expertCheck;
Tags = tags; Tags = tags;
@ -50,6 +49,7 @@ public partial class Product : ApiEntity
} }
public string PersianName { get; internal set; } = string.Empty; public string PersianName { get; internal set; } = string.Empty;
public string EnglishName { get; internal set; } = string.Empty; public string EnglishName { get; internal set; } = string.Empty;
public string Slug { get; set; } = string.Empty;
public string Summery { get; internal set; } = string.Empty; public string Summery { get; internal set; } = string.Empty;
public string ExpertCheck { get; internal set; } = string.Empty; public string ExpertCheck { get; internal set; } = string.Empty;
public string Tags { get; internal set; } = string.Empty; public string Tags { get; internal set; } = string.Empty;

View File

@ -1,7 +1,4 @@
using Netina.Domain.Entities.StorageFiles; namespace Netina.Domain.Entities.Products;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.Products;
public partial class ProductStorageFile : StorageFile public partial class ProductStorageFile : StorageFile
{ {

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Products;
using Netina.Domain.Entities.Users;
namespace Netina.Domain.Entities.Products;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]

View File

@ -1,6 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.Products;
namespace Netina.Domain.Entities.Products;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]

View File

@ -1,6 +1,4 @@
using Netina.Domain.Enums; namespace Netina.Domain.Entities.StorageFiles;
namespace Netina.Domain.Entities.StorageFiles;
public partial class StorageFile public partial class StorageFile
{ {

View File

@ -1,7 +1,4 @@
using Netina.Common.Models.Entity; namespace Netina.Domain.Entities.StorageFiles;
using Netina.Domain.Enums;
namespace Netina.Domain.Entities.StorageFiles;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]

Some files were not shown because too many files have changed in this diff Show More