Compare commits
2 Commits
a311cf9f3e
...
27dd2af627
Author | SHA1 | Date | |
---|---|---|---|
27dd2af627 | |||
0452f379c6 |
@ -17,6 +17,10 @@ namespace RhSolutions.Api.Controllers
|
||||
this.parser = parser;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает все продукты в базе данных
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IAsyncEnumerable<Product> GetProducts()
|
||||
{
|
||||
@ -24,6 +28,11 @@ namespace RhSolutions.Api.Controllers
|
||||
.AsAsyncEnumerable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает продукт по номеру артикула
|
||||
/// </summary>
|
||||
/// <param name="id">Номер артикула</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}")]
|
||||
public IEnumerable<Product> GetProduct(string id)
|
||||
{
|
||||
@ -31,6 +40,10 @@ namespace RhSolutions.Api.Controllers
|
||||
.Where(p => p.Id.Equals(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Загрузка прайс-листа в формате xlsx в базу данных
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult PostProductsFromXls()
|
||||
{
|
||||
@ -62,6 +75,10 @@ namespace RhSolutions.Api.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удаление всех продуктов из базы данных
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public IActionResult DeleteAllProducts()
|
||||
{
|
||||
|
@ -14,6 +14,11 @@ namespace RhSolutions.Api.Controllers
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск артикула в базе данных через предварительную мультиклассовую классификацию с применением ML-модели артикулов
|
||||
/// </summary>
|
||||
/// <param name="query">Запрос в свободной форме</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public IAsyncEnumerable<Product> SearchProducts([FromQuery] string query)
|
||||
{
|
||||
|
@ -5,6 +5,8 @@ using RhSolutions.Api.Middleware;
|
||||
using RhSolutions.QueryModifiers;
|
||||
using RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
|
||||
using RhSolutions.QueryModifiers.DrinkingWaterHeatingPipes;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Reflection;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@ -60,10 +62,35 @@ builder.Services.AddKeyedTransient<IProductQueryModifier, Sleeve>("Монтаж
|
||||
.AddKeyedTransient<IProductQueryModifier, StabilPipe>("Stabil")
|
||||
.AddKeyedTransient<IProductQueryModifier, BlackPipe>("Black");
|
||||
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Version = "v1",
|
||||
Title = "RhSolutions API",
|
||||
Description = "API к базе данных артикулов РЕХАУ для поиска с помощью ML.NET и полнотестового поиска PostgreSQL",
|
||||
Contact = new OpenApiContact
|
||||
{
|
||||
Name = "Serghei Cebotari",
|
||||
Url = new Uri("https://cebotari.ru/"),
|
||||
Email = @"serghei@cebotari.ru"
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<QueryModifier>();
|
||||
app.UseSwagger().UseSwaggerUI(options =>
|
||||
{
|
||||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
|
||||
options.RoutePrefix = string.Empty;
|
||||
});
|
||||
|
||||
var context = app.Services.CreateScope().ServiceProvider
|
||||
.GetRequiredService<RhSolutionsContext>();
|
||||
|
@ -5,6 +5,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>1c307973-55cf-4d5c-a4f8-1def6b58ee3c</UserSecretsId>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -19,6 +21,7 @@
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
|
||||
<PackageReference Include="Rhsolutions.ProductSku" Version="1.0.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user