fix: tornar suite da API compativel com MVE audit
This commit is contained in:
parent
6af6674468
commit
ae378ba9cc
|
|
@ -5408,17 +5408,17 @@ namespace line_gestao_api.Controllers
|
||||||
let clienteOriginal = (line.Cliente ?? "").Trim()
|
let clienteOriginal = (line.Cliente ?? "").Trim()
|
||||||
let clientePorLinha = (udLine.Cliente ?? "").Trim()
|
let clientePorLinha = (udLine.Cliente ?? "").Trim()
|
||||||
let clientePorItem = (udItem.Cliente ?? "").Trim()
|
let clientePorItem = (udItem.Cliente ?? "").Trim()
|
||||||
let isStock = EF.Functions.ILike(clienteOriginal, "RESERVA")
|
let isStock = clienteOriginal.ToUpper() == "RESERVA"
|
||||||
let clienteEfetivo = isStock
|
let clienteEfetivo = isStock
|
||||||
? "ESTOQUE"
|
? "ESTOQUE"
|
||||||
: (!string.IsNullOrEmpty(clienteOriginal) &&
|
: (!string.IsNullOrEmpty(clienteOriginal) &&
|
||||||
!EF.Functions.ILike(clienteOriginal, "RESERVA"))
|
clienteOriginal.ToUpper() != "RESERVA")
|
||||||
? clienteOriginal
|
? clienteOriginal
|
||||||
: (!string.IsNullOrEmpty(clientePorLinha) &&
|
: (!string.IsNullOrEmpty(clientePorLinha) &&
|
||||||
!EF.Functions.ILike(clientePorLinha, "RESERVA"))
|
clientePorLinha.ToUpper() != "RESERVA")
|
||||||
? clientePorLinha
|
? clientePorLinha
|
||||||
: (!string.IsNullOrEmpty(clientePorItem) &&
|
: (!string.IsNullOrEmpty(clientePorItem) &&
|
||||||
!EF.Functions.ILike(clientePorItem, "RESERVA"))
|
clientePorItem.ToUpper() != "RESERVA")
|
||||||
? clientePorItem
|
? clientePorItem
|
||||||
: ""
|
: ""
|
||||||
select new ReservaLineProjection
|
select new ReservaLineProjection
|
||||||
|
|
@ -5455,9 +5455,9 @@ namespace line_gestao_api.Controllers
|
||||||
private static IQueryable<MobileLine> ApplyReservaContextFilter(IQueryable<MobileLine> query)
|
private static IQueryable<MobileLine> ApplyReservaContextFilter(IQueryable<MobileLine> query)
|
||||||
{
|
{
|
||||||
return query.Where(x =>
|
return query.Where(x =>
|
||||||
EF.Functions.ILike((x.Usuario ?? "").Trim(), "RESERVA") ||
|
(x.Usuario ?? "").Trim().ToUpper() == "RESERVA" ||
|
||||||
EF.Functions.ILike((x.Skil ?? "").Trim(), "RESERVA") ||
|
(x.Skil ?? "").Trim().ToUpper() == "RESERVA" ||
|
||||||
EF.Functions.ILike((x.Cliente ?? "").Trim(), "RESERVA"));
|
(x.Cliente ?? "").Trim().ToUpper() == "RESERVA");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IQueryable<ReservaLineProjection> ApplyReservaMode(
|
private static IQueryable<ReservaLineProjection> ApplyReservaMode(
|
||||||
|
|
@ -5470,7 +5470,7 @@ namespace line_gestao_api.Controllers
|
||||||
"stock" => query.Where(x => x.IsStock),
|
"stock" => query.Where(x => x.IsStock),
|
||||||
"assigned" => query.Where(x =>
|
"assigned" => query.Where(x =>
|
||||||
!x.IsStock &&
|
!x.IsStock &&
|
||||||
!EF.Functions.ILike((x.Cliente ?? "").Trim(), "RESERVA")),
|
(x.Cliente ?? "").Trim().ToUpper() != "RESERVA"),
|
||||||
_ => query
|
_ => query
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -5489,9 +5489,9 @@ namespace line_gestao_api.Controllers
|
||||||
private static IQueryable<MobileLine> ExcludeReservaContext(IQueryable<MobileLine> query)
|
private static IQueryable<MobileLine> ExcludeReservaContext(IQueryable<MobileLine> query)
|
||||||
{
|
{
|
||||||
return query.Where(x =>
|
return query.Where(x =>
|
||||||
!EF.Functions.ILike((x.Usuario ?? "").Trim(), "RESERVA") &&
|
(x.Usuario ?? "").Trim().ToUpper() != "RESERVA" &&
|
||||||
!EF.Functions.ILike((x.Skil ?? "").Trim(), "RESERVA") &&
|
(x.Skil ?? "").Trim().ToUpper() != "RESERVA" &&
|
||||||
!EF.Functions.ILike((x.Cliente ?? "").Trim(), "RESERVA"));
|
(x.Cliente ?? "").Trim().ToUpper() != "RESERVA");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IQueryable<MobileLine> ApplyAdditionalFilters(
|
private static IQueryable<MobileLine> ApplyAdditionalFilters(
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ public sealed class MveAuditSchemaBootstrapper
|
||||||
|
|
||||||
public async Task EnsureSchemaAsync(CancellationToken cancellationToken = default)
|
public async Task EnsureSchemaAsync(CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
|
if (!_db.Database.IsRelational())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await _db.Database.ExecuteSqlRawAsync(
|
await _db.Database.ExecuteSqlRawAsync(
|
||||||
"""
|
"""
|
||||||
ALTER TABLE "Aparelhos"
|
ALTER TABLE "Aparelhos"
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@ using line_gestao_api.Data;
|
||||||
using line_gestao_api.Dtos;
|
using line_gestao_api.Dtos;
|
||||||
using line_gestao_api.Models;
|
using line_gestao_api.Models;
|
||||||
using line_gestao_api.Services;
|
using line_gestao_api.Services;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
@ -324,6 +326,7 @@ public class SystemTenantIntegrationTests
|
||||||
|
|
||||||
services.RemoveAll<AppDbContext>();
|
services.RemoveAll<AppDbContext>();
|
||||||
services.RemoveAll<DbContextOptions<AppDbContext>>();
|
services.RemoveAll<DbContextOptions<AppDbContext>>();
|
||||||
|
services.RemoveAll<IDbContextOptionsConfiguration<AppDbContext>>();
|
||||||
|
|
||||||
services.AddDbContext<AppDbContext>(options =>
|
services.AddDbContext<AppDbContext>(options =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue