Compare commits
2 Commits
b7dbe67e7f
...
51721e3c50
Author | SHA1 | Date |
---|---|---|
|
51721e3c50 | |
|
9f6af37e7f |
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"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,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopDB02;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS",
|
"Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=HamyanDB;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;"
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
|
@ -13,11 +13,8 @@
|
||||||
"Microsoft.AspNetCore.Http.Connections": "Debug"
|
"Microsoft.AspNetCore.Http.Connections": "Debug"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ShopSettings": {
|
|
||||||
"TaxesFee": 9
|
|
||||||
},
|
|
||||||
"SiteSettings": {
|
"SiteSettings": {
|
||||||
"BaseUrl": "http://localhost:32770",
|
"BaseUrl": "https://api.hamyanedalat.com",
|
||||||
"WebSiteUrl": "https://hamyanedalat.com",
|
"WebSiteUrl": "https://hamyanedalat.com",
|
||||||
"AdminPanelBaseUrl": "https://admin.hamyanedalat.com",
|
"AdminPanelBaseUrl": "https://admin.hamyanedalat.com",
|
||||||
"StorageBaseUrl": "https://storage.hamyanedalat.com",
|
"StorageBaseUrl": "https://storage.hamyanedalat.com",
|
||||||
|
@ -28,18 +25,14 @@
|
||||||
"Email": "avvampier@gmail.com",
|
"Email": "avvampier@gmail.com",
|
||||||
"Password": "2Tsr87RWRn5T",
|
"Password": "2Tsr87RWRn5T",
|
||||||
"Phone": "09214802813",
|
"Phone": "09214802813",
|
||||||
"RoleName": "RootAdmin",
|
"RoleName": "RootAdmin"
|
||||||
"FirstName": "همه کاره",
|
|
||||||
"LastName": "سیستم"
|
|
||||||
},
|
},
|
||||||
"Manager": {
|
"Manager": {
|
||||||
"Username": "09122171024",
|
"Username": "09122171024",
|
||||||
"Email": "kamran_mirzayi@gmail.com",
|
"Email": "kamran_mirzayi@gmail.com",
|
||||||
"Password": "YAWEheKEi7gh",
|
"Password": "YAWEheKEi7gh",
|
||||||
"Phone": "09128387004",
|
"Phone": "09128387004",
|
||||||
"RoleName": "Manager",
|
"RoleName": "Manager"
|
||||||
"FirstName": "کامران",
|
|
||||||
"LastName": "میرزایی"
|
|
||||||
},
|
},
|
||||||
"StorageSetting": {
|
"StorageSetting": {
|
||||||
"AccessKey": "de129835-b43a-4552-8ed4-865e2635ab3d",
|
"AccessKey": "de129835-b43a-4552-8ed4-865e2635ab3d",
|
||||||
|
|
|
@ -17,6 +17,8 @@ public class SeedController : ICarterModule
|
||||||
var group = app.NewVersionedApi("Seed")
|
var group = app.NewVersionedApi("Seed")
|
||||||
.MapGroup("api/seed");
|
.MapGroup("api/seed");
|
||||||
|
|
||||||
|
group.MapPost("sitemap", CreateSiteMapAsync)
|
||||||
|
.HasApiVersion(1.0);
|
||||||
|
|
||||||
group.MapPost("product/categories", SeedCategoriesAsync)
|
group.MapPost("product/categories", SeedCategoriesAsync)
|
||||||
.WithDisplayName("SeedCategoriesAsync")
|
.WithDisplayName("SeedCategoriesAsync")
|
||||||
|
@ -43,6 +45,16 @@ public class SeedController : ICarterModule
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IResult> CreateSiteMapAsync([FromQuery] string key, ISiteMapService siteMapService, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
if (key != "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A==")
|
||||||
|
throw new AppException("Key is not valid", ApiResultStatusCode.UnAuthorized);
|
||||||
|
|
||||||
|
await siteMapService.CreateSiteMapAsync();
|
||||||
|
|
||||||
|
return TypedResults.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IResult> SeedProductsAsync([FromBody] List<CreateProductCommand> request, [FromQuery] string key, IMediator mediator, CancellationToken cancellationToken)
|
public async Task<IResult> SeedProductsAsync([FromBody] List<CreateProductCommand> request, [FromQuery] string key, IMediator mediator, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (key != "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A==")
|
if (key != "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A==")
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<AssemblyVersion>0.27.38.60</AssemblyVersion>
|
<AssemblyVersion>1.0.0.1</AssemblyVersion>
|
||||||
<FileVersion>0.27.38.60</FileVersion>
|
<FileVersion>1.0.0.1</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Netina.Api.WebFramework.ScalarUi;
|
||||||
using Netina.Repository.Behaviors;
|
using Netina.Repository.Behaviors;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
@ -8,7 +9,7 @@ string env = builder.Environment.IsDevelopment() == true ? "Development" : "Prod
|
||||||
builder.Host.UseContentRoot(Directory.GetCurrentDirectory());
|
builder.Host.UseContentRoot(Directory.GetCurrentDirectory());
|
||||||
if (builder.Environment.IsDevelopment())
|
if (builder.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
string projectName = "Vesmeh";
|
string projectName = "Hamyan";
|
||||||
builder.Configuration.AddJsonFile($"AppSettings/appsettings.json").AddJsonFile($"AppSettings/appsettings.{env}{projectName}.json");
|
builder.Configuration.AddJsonFile($"AppSettings/appsettings.json").AddJsonFile($"AppSettings/appsettings.{env}{projectName}.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,12 +98,13 @@ var app = builder.Build();
|
||||||
|
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
|
||||||
{
|
//app.UseCustomSwagger(siteSetting.BaseUrl);
|
||||||
//app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
app.MapScalarUi();
|
||||||
//app.UseSwaggerUI();
|
//app.UseSwaggerUI();
|
||||||
}
|
|
||||||
else
|
if (app.Environment.IsProduction())
|
||||||
{
|
{
|
||||||
app.UseHsts();
|
app.UseHsts();
|
||||||
}
|
}
|
||||||
|
@ -113,7 +115,6 @@ app.UseCors(x => x
|
||||||
.AllowCredentials());
|
.AllowCredentials());
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseCustomSwagger(siteSetting.BaseUrl);
|
|
||||||
|
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"Docker": {
|
"Docker": {
|
||||||
"commandName": "Docker",
|
"commandName": "Docker",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/scalar/v1",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_URLS": "http://+:80"
|
"ASPNETCORE_URLS": "http://+:80"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
namespace Netina.Api.WebFramework.ScalarUi;
|
||||||
|
|
||||||
|
public static class ScalarUiConfiguration
|
||||||
|
{
|
||||||
|
public static void MapScalarUi(this IEndpointRouteBuilder app)
|
||||||
|
{
|
||||||
|
app.MapGet("/scalar/{documentName}", (string documentName) =>
|
||||||
|
{
|
||||||
|
|
||||||
|
var scalarScript = $$"""
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Scalar API Reference</title>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- Add your own OpenAPI/Swagger specification URL here: -->
|
||||||
|
<!-- Note: The example is our public proxy (to avoid CORS issues). You can remove the `data-proxy-url` attribute if you don’t need it. -->
|
||||||
|
<script
|
||||||
|
id="api-reference"
|
||||||
|
data-url="/swagger/{{documentName}}/swagger.json"></script>
|
||||||
|
|
||||||
|
<!-- Optional: You can set a full configuration object like this: -->
|
||||||
|
<script>
|
||||||
|
var configuration = {
|
||||||
|
theme: 'bluePlanet',
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('api-reference').dataset.configuration =
|
||||||
|
JSON.stringify(configuration)
|
||||||
|
</script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""";
|
||||||
|
|
||||||
|
return Results.Content(scalarScript, "text/html");
|
||||||
|
}).ExcludeFromDescription();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,6 @@
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Netina.Core.Models;
|
using Netina.Core.Models;
|
||||||
using Netina.Domain.Entities.Blogs;
|
|
||||||
using Netina.Domain.Entities.Brands;
|
|
||||||
using Netina.Domain.Entities.ProductCategories;
|
using Netina.Domain.Entities.ProductCategories;
|
||||||
|
|
||||||
namespace Netina.Core.BaseServices;
|
namespace Netina.Core.BaseServices;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using MediatR;
|
using Netina.Domain.Dtos.ResponseDtos.Zarehbin;
|
||||||
using Netina.Domain.Dtos.ResponseDtos.Torob;
|
|
||||||
using Netina.Domain.Dtos.ResponseDtos.Zarehbin;
|
|
||||||
using Netina.Domain.Entities.ProductCategories;
|
using Netina.Domain.Entities.ProductCategories;
|
||||||
|
|
||||||
namespace Netina.Core.CoreServices;
|
namespace Netina.Core.CoreServices;
|
||||||
|
@ -15,17 +13,16 @@ public class SearchService : ISearchService
|
||||||
}
|
}
|
||||||
public async Task<SearchResponseDto> SearchAsync(string name, CancellationToken cancellationToken = default)
|
public async Task<SearchResponseDto> SearchAsync(string name, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var searchQuery = name.ToLower().Trim();
|
var searchQuery = name;
|
||||||
int minSimilarityThreshold = 20;
|
|
||||||
var products = await _repositoryWrapper.SetRepository<Product>()
|
var products = await _repositoryWrapper.SetRepository<Product>()
|
||||||
.TableNoTracking
|
.TableNoTracking
|
||||||
.Where(p => FuzzySharp.Fuzz.PartialRatio(p.PersianName.ToLower().Trim(), searchQuery) >= minSimilarityThreshold)
|
.OrderByDescending(p => EF.Functions.TrigramsSimilarity(p.PersianName, searchQuery))
|
||||||
.Select(ProductMapper.ProjectToSDto)
|
.Select(ProductMapper.ProjectToSDto)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
var categories = await _repositoryWrapper.SetRepository<ProductCategory>()
|
var categories = await _repositoryWrapper.SetRepository<ProductCategory>()
|
||||||
.TableNoTracking
|
.TableNoTracking
|
||||||
.Where(p => FuzzySharp.Fuzz.PartialRatio(p.Name.ToLower().Trim(), searchQuery) >= minSimilarityThreshold)
|
.OrderByDescending(p => EF.Functions.TrigramsSimilarity(p.Name, searchQuery))
|
||||||
.Select(ProductCategoryMapper.ProjectToSDto)
|
.Select(ProductCategoryMapper.ProjectToSDto)
|
||||||
.ToListAsync(cancellationToken);
|
.ToListAsync(cancellationToken);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Netina.Common.Models.Api;
|
using SixLabors.ImageSharp;
|
||||||
using SixLabors.ImageSharp;
|
|
||||||
using SixLabors.ImageSharp.Processing;
|
using SixLabors.ImageSharp.Processing;
|
||||||
|
|
||||||
namespace Netina.Core.Utilities;
|
namespace Netina.Core.Utilities;
|
||||||
|
|
2044
Netina.Repository/Migrations/20240528071721_EditBlogCategoryAddIsMain.Designer.cs
generated
100644
2044
Netina.Repository/Migrations/20240528071721_EditBlogCategoryAddIsMain.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,77 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace NetinaShop.Repository.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class EditBlogCategoryAddIsMain : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AlterDatabase()
|
||||||
|
.Annotation("Npgsql:PostgresExtension:fuzzystrmatch", ",,")
|
||||||
|
.Annotation("Npgsql:PostgresExtension:pg_trgm", ",,");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>(
|
||||||
|
name: "IsMain",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories",
|
||||||
|
type: "boolean",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: false);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "ParentId",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories",
|
||||||
|
type: "uuid",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_BlogCategories_ParentId",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories",
|
||||||
|
column: "ParentId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_BlogCategories_BlogCategories_ParentId",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories",
|
||||||
|
column: "ParentId",
|
||||||
|
principalSchema: "public",
|
||||||
|
principalTable: "BlogCategories",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_BlogCategories_BlogCategories_ParentId",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_BlogCategories_ParentId",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "IsMain",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ParentId",
|
||||||
|
schema: "public",
|
||||||
|
table: "BlogCategories");
|
||||||
|
|
||||||
|
migrationBuilder.AlterDatabase()
|
||||||
|
.OldAnnotation("Npgsql:PostgresExtension:fuzzystrmatch", ",,")
|
||||||
|
.OldAnnotation("Npgsql:PostgresExtension:pg_trgm", ",,");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,8 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.HasAnnotation("ProductVersion", "8.0.4")
|
.HasAnnotation("ProductVersion", "8.0.4")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch");
|
||||||
|
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "pg_trgm");
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
|
||||||
|
@ -283,6 +285,9 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("IsMain")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
b.Property<bool>("IsRemoved")
|
b.Property<bool>("IsRemoved")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
@ -297,6 +302,9 @@ namespace NetinaShop.Repository.Migrations
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ParentId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<DateTime>("RemovedAt")
|
b.Property<DateTime>("RemovedAt")
|
||||||
.HasColumnType("timestamp without time zone");
|
.HasColumnType("timestamp without time zone");
|
||||||
|
|
||||||
|
@ -310,6 +318,8 @@ namespace NetinaShop.Repository.Migrations
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
b.ToTable("BlogCategories", "public");
|
b.ToTable("BlogCategories", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1700,6 +1710,15 @@ namespace NetinaShop.Repository.Migrations
|
||||||
b.Navigation("Category");
|
b.Navigation("Category");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Parent")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ParentId");
|
||||||
|
|
||||||
|
b.Navigation("Parent");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b =>
|
modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Netina.Domain.Entities.Users.Marketer", "Marketer")
|
b.HasOne("Netina.Domain.Entities.Users.Marketer", "Marketer")
|
||||||
|
|
Loading…
Reference in New Issue