refactor: removido pacotes depreciados

This commit is contained in:
Jean Gatto
2024-07-25 14:53:06 -03:00
parent 8d697b6829
commit e129f36738
8 changed files with 12 additions and 31 deletions
+2 -5
View File
@@ -7,6 +7,8 @@
<ItemGroup>
<PackageVersion Include="Ardalis.Result" Version="9.1.0" />
<PackageVersion Include="Ardalis.Result.FluentValidation" Version="9.1.0" />
<PackageVersion Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageVersion Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageVersion Include="AspNetCore.HealthChecks.MongoDb" Version="8.0.1" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="8.0.1" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.1" />
@@ -15,15 +17,11 @@
<PackageVersion Include="CorrelationId" Version="3.0.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="coverlet.msbuild" Version="6.0.2" />
<PackageVersion Include="EntityFrameworkCore.DataEncryption" Version="5.0.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FluentValidation" Version="11.9.2" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.2" />
<PackageVersion Include="MediatR" Version="12.4.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.7" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="8.0.7" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7" />
@@ -32,7 +30,6 @@
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.7" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.7" />
<PackageVersion Include="Microsoft.Extensions.Caching.Redis" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.7" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
+2 -2
View File
@@ -1,6 +1,6 @@
### Register a new customer
POST http://localhost:53625/api/customers HTTP/1.1
POST http://localhost:56344/api/customers HTTP/1.1
content-type: application/json
{
@@ -13,5 +13,5 @@ content-type: application/json
### Gets a list of all customers
GET http://localhost:53625/api/customers HTTP/1.1
GET http://localhost:56344/api/customers HTTP/1.1
content-type: application/json
@@ -1,6 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.DataEncryption;
using Microsoft.EntityFrameworkCore.DataEncryption.Providers;
using Shop.Domain.Entities.CustomerAggregate;
using Shop.Infrastructure.Data.Mappings;
@@ -9,15 +7,6 @@ namespace Shop.Infrastructure.Data.Context;
public class WriteDbContext(DbContextOptions<WriteDbContext> dbOptions)
: BaseDbContext<WriteDbContext>(dbOptions)
{
#region Encryption
private static readonly byte[] EncryptionKey = [189, 3, 80, 118, 242, 164, 9, 197, 106, 166, 122, 118, 161, 212, 106, 26, 171, 18, 178, 98, 86, 102, 196, 6, 78, 249, 4, 164, 66, 154, 218, 126];
private static readonly byte[] EncryptionVector = [163, 225, 4, 33, 227, 178, 113, 128, 174, 23, 9, 144, 213, 158, 134, 48];
private readonly IEncryptionProvider _encryptionProvider = new AesProvider(EncryptionKey, EncryptionVector);
#endregion
public DbSet<Customer> Customers => Set<Customer>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
@@ -25,6 +14,5 @@ public class WriteDbContext(DbContextOptions<WriteDbContext> dbOptions)
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new CustomerConfiguration());
modelBuilder.UseEncryption(_encryptionProvider);
}
}
@@ -1,5 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.DataEncryption;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Shop.Domain.Entities.CustomerAggregate;
using Shop.Infrastructure.Data.Extensions;
@@ -36,8 +35,7 @@ internal class CustomerConfiguration : IEntityTypeConfiguration<Customer>
.Property(email => email.Address)
.IsRequired() // NOT NULL
.HasMaxLength(254)
.HasColumnName(nameof(Customer.Email))
.IsEncrypted(); // Encryption
.HasColumnName(nameof(Customer.Email));
// Unique Index
ownedNav
@@ -5,13 +5,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EntityFrameworkCore.DataEncryption" />
<PackageReference Include="MediatR" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" />
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.Extensions.Caching.Redis" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Net.Mime;
using System.Threading.Tasks;
using Asp.Versioning;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+4 -4
View File
@@ -1,5 +1,6 @@
using System.Globalization;
using System.IO.Compression;
using Asp.Versioning;
using CorrelationId;
using CorrelationId.DependencyInjection;
using FluentValidation;
@@ -41,15 +42,14 @@ builder.Services
versioningOptions.ReportApiVersions = true;
versioningOptions.AssumeDefaultVersionWhenUnspecified = true;
})
.AddVersionedApiExplorer(explorerOptions =>
.AddApiExplorer(explorerOptions =>
{
explorerOptions.GroupNameFormat = "'v'VVV";
explorerOptions.SubstituteApiVersionInUrl = true;
})
.AddSwagger();
});
builder.Services.AddSwagger();
builder.Services.AddDataProtection();
builder.Services.AddControllers()
.ConfigureApiBehaviorOptions(behaviorOptions =>
{
+2 -2
View File
@@ -13,14 +13,14 @@
<ItemGroup>
<PackageReference Include="Ardalis.Result" />
<PackageReference Include="Asp.Versioning.Mvc" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" />
<PackageReference Include="AspNetCore.HealthChecks.MongoDb" />
<PackageReference Include="AspNetCore.HealthChecks.Redis" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" />
<PackageReference Include="AutoMapper" />
<PackageReference Include="CorrelationId" />
<PackageReference Include="MediatR" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>