net8, language features, bugfixes
This commit is contained in:
parent
1591618c2c
commit
ce99053a10
353 changed files with 3245 additions and 3944 deletions
|
|
@ -1,6 +1,6 @@
|
|||
using Insight.Infrastructure.Entities;
|
||||
using Insight.Infrastructure.Models;
|
||||
using Insight.Infrastructure.Services;
|
||||
using Insight.Infrastructure.Web;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MongoDB.Bson;
|
||||
|
|
@ -11,20 +11,16 @@ using System.Text.RegularExpressions;
|
|||
namespace Insight.Api.Controllers;
|
||||
|
||||
[ApiController, Route("api/inventory")]
|
||||
public class InventoryController : ControllerBase
|
||||
public class InventoryController(IServiceScopeFactory scopeFactory) : ControllerBase
|
||||
{
|
||||
private readonly InventoryService _inventoryService;
|
||||
private readonly ILogger<InventoryController> _logger;
|
||||
|
||||
public InventoryController(InventoryService inventoryService, ILogger<InventoryController> logger)
|
||||
{
|
||||
_inventoryService = inventoryService;
|
||||
_logger = logger;
|
||||
}
|
||||
private readonly IServiceScopeFactory _scopeFactory = scopeFactory;
|
||||
|
||||
[HttpGet, Authorize]
|
||||
public async Task<IActionResult> Get([FromQuery] HostApplicationEntity request, [FromQuery] PagedDataRequest meta, CancellationToken cancellationToken)
|
||||
{
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
var collection = scope.ServiceProvider.GetRequiredService<IMongoDatabase>().HostApplication();
|
||||
|
||||
try
|
||||
{
|
||||
var filter = Builders<HostApplicationEntity>.Filter.Empty;
|
||||
|
|
@ -38,7 +34,7 @@ public class InventoryController : ControllerBase
|
|||
if (request.Name is not null)
|
||||
filter &= Builders<HostApplicationEntity>.Filter.Regex(p => p.Name, new BsonRegularExpression(new Regex(request.Name, RegexOptions.IgnoreCase)));
|
||||
|
||||
var result = await _inventoryService.GetAsync(
|
||||
var result = await collection.GetPagedAsync(
|
||||
filter: filter,
|
||||
offset: meta.Offset,
|
||||
limit: meta.Limit,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue