From 6e3ab61706a8abfe06cf6dcf6449e7c033999efd Mon Sep 17 00:00:00 2001 From: Jp Date: Fri, 29 Nov 2024 16:37:53 -0300 Subject: [PATCH 1/2] mudado a pasta --- Prova2_Henrique/Prova/Application/.DS_Store | Bin 0 -> 6148 bytes .../Prova/Application/Application.csproj | 13 ++ .../Services/EnderecoService.cs | 0 .../Services/JwtTokenService.cs | 0 .../Services/MarcaService.cs | 0 .../Services/ProdutoService.cs | 0 .../Services/UsuarioService.cs | 0 .../Prova/{ => Core}/DTO/EnderecoDTO.cs | 0 .../{ => Core}/DTO/UsuarioAtualizacaoDTO.cs | 0 .../{ => Core}/DTO/UsuarioCadastroDTO.cs | 0 .../Prova/{ => Core}/DTO/UsuarioComToken.cs | 0 .../{ => Core}/DTO/UsuarioRespostaDTO.cs | 0 .../Prova/{ => Core}/Models/Endereco.cs | 0 .../Prova/{ => Core}/Models/Marca.cs | 0 .../Prova/{ => Core}/Models/Produto.cs | 0 .../Prova/{ => Core}/Models/Usuario.cs | 0 .../Repositories/EnderecoRepository.cs | 0 .../Repositories/MarcaRepository.cs | 2 +- .../Repositories/ProdutoRepository.cs | 2 +- .../Repositories/UsuarioRepository.cs | 2 +- .../Prova/Core/Services/EnderecoService.cs | 0 .../Prova/Core/Services/JwtTokenService.cs | 72 +++++++++ .../Prova/Core/Services/MarcaService.cs | 32 ++++ .../Prova/Core/Services/ProdutoService.cs | 48 ++++++ .../Prova/Core/Services/UsuarioService.cs | 139 ++++++++++++++++++ Prova2_Henrique/Prova/Core/core.csproj | 6 + .../Prova/Infrastructure/.DS_Store | Bin 0 -> 6148 bytes .../Infrastructure/Infrastructure.csproj | 22 +++ .../Repositories}/Data/AppDbContext.cs | 2 +- .../20241023181253_InitialCreate.Designer.cs | 2 +- .../20241023181253_InitialCreate.cs | 0 .../20241023182454_AjusteEndereco.Designer.cs | 2 +- .../20241023182454_AjusteEndereco.cs | 0 ...3035_AlterEnderecoIdGeneration.Designer.cs | 2 +- ...0241023183035_AlterEnderecoIdGeneration.cs | 0 ...20241101235914_NomeDaMigration.Designer.cs | 2 +- .../20241101235914_NomeDaMigration.cs | 0 .../20241118214851_secondCreate.Designer.cs | 2 +- .../Migrations/20241118214851_secondCreate.cs | 0 .../20241127022231_produtos.Designer.cs | 2 +- .../Migrations/20241127022231_produtos.cs | 0 .../20241127171458_lista.Designer.cs | 2 +- .../Data}/Migrations/20241127171458_lista.cs | 0 .../20241127193747_funcionapfv.Designer.cs | 2 +- .../Migrations/20241127193747_funcionapfv.cs | 0 ...41129060230_atualizandoUsuario.Designer.cs | 2 +- .../20241129060230_atualizandoUsuario.cs | 0 ...129071042_mudandoOTipoDaImagem.Designer.cs | 2 +- .../20241129071042_mudandoOTipoDaImagem.cs | 0 ..._mudandoOTipoDaIamgemNovamente.Designer.cs | 2 +- ...129071811_mudandoOTipoDaIamgemNovamente.cs | 0 ...mudandoOTipoDaIamgemNovamente2.Designer.cs | 2 +- ...29072043_mudandoOTipoDaIamgemNovamente2.cs | 0 ...mudandoOTipoDaIamgemNovamente3.Designer.cs | 2 +- ...29072432_mudandoOTipoDaIamgemNovamente3.cs | 0 ...mudandoOTipoDaIamgemNovamente5.Designer.cs | 2 +- ...29073354_mudandoOTipoDaIamgemNovamente5.cs | 0 ...mudandoOTipoDaIamgemNovamente7.Designer.cs | 2 +- ...29073810_mudandoOTipoDaIamgemNovamente7.cs | 0 ...mudandoOTipoDaIamgemNovamente8.Designer.cs | 2 +- ...29074050_mudandoOTipoDaIamgemNovamente8.cs | 0 ...udandoOTipoDaIamgemNovamente10.Designer.cs | 2 +- ...9080256_mudandoOTipoDaIamgemNovamente10.cs | 0 ...udandoOTipoDaIamgemNovamente12.Designer.cs | 2 +- ...9081217_mudandoOTipoDaIamgemNovamente12.cs | 0 ...udandoOTipoDaIamgemNovamente13.Designer.cs | 2 +- ...9081646_mudandoOTipoDaIamgemNovamente13.cs | 0 ...udandoOTipoDaIamgemNovamente15.Designer.cs | 2 +- ...9082124_mudandoOTipoDaIamgemNovamente15.cs | 0 ...udandoOTipoDaIamgemNovamente18.Designer.cs | 2 +- ...9083237_mudandoOTipoDaIamgemNovamente18.cs | 0 ...9173606_NomeDaMigration1221212.Designer.cs | 2 +- .../20241129173606_NomeDaMigration1221212.cs | 0 .../Migrations/AppDbContextModelSnapshot.cs | 2 +- .../Repositories/EnderecoRepository.cs | 0 .../Repositories/MarcaRepository.cs | 36 +++++ .../Repositories/ProdutoRepository.cs | 64 ++++++++ .../Repositories/UsuarioRepository.cs | 54 +++++++ .../Controllers/MarcasController.cs | 0 .../Controllers/ProduotsController.cs | 0 .../Controllers/UsuarioController.cs | 0 .../Prova/Presentation/Presentation.csproj | 6 + .../Prova/{ => Presentation}/Program.cs | 2 +- .../Properties/launchSettings.json | 0 Prova2_Henrique/Prova/Prova.csproj | 8 + 85 files changed, 528 insertions(+), 28 deletions(-) create mode 100644 Prova2_Henrique/Prova/Application/.DS_Store create mode 100644 Prova2_Henrique/Prova/Application/Application.csproj rename Prova2_Henrique/Prova/{ => Application}/Services/EnderecoService.cs (100%) rename Prova2_Henrique/Prova/{ => Application}/Services/JwtTokenService.cs (100%) rename Prova2_Henrique/Prova/{ => Application}/Services/MarcaService.cs (100%) rename Prova2_Henrique/Prova/{ => Application}/Services/ProdutoService.cs (100%) rename Prova2_Henrique/Prova/{ => Application}/Services/UsuarioService.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/DTO/EnderecoDTO.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/DTO/UsuarioAtualizacaoDTO.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/DTO/UsuarioCadastroDTO.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/DTO/UsuarioComToken.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/DTO/UsuarioRespostaDTO.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/Models/Endereco.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/Models/Marca.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/Models/Produto.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/Models/Usuario.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/Repositories/EnderecoRepository.cs (100%) rename Prova2_Henrique/Prova/{ => Core}/Repositories/MarcaRepository.cs (94%) rename Prova2_Henrique/Prova/{ => Core}/Repositories/ProdutoRepository.cs (97%) rename Prova2_Henrique/Prova/{ => Core}/Repositories/UsuarioRepository.cs (96%) create mode 100644 Prova2_Henrique/Prova/Core/Services/EnderecoService.cs create mode 100644 Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs create mode 100644 Prova2_Henrique/Prova/Core/Services/MarcaService.cs create mode 100644 Prova2_Henrique/Prova/Core/Services/ProdutoService.cs create mode 100644 Prova2_Henrique/Prova/Core/Services/UsuarioService.cs create mode 100644 Prova2_Henrique/Prova/Core/core.csproj create mode 100644 Prova2_Henrique/Prova/Infrastructure/.DS_Store create mode 100644 Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories}/Data/AppDbContext.cs (96%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241023181253_InitialCreate.Designer.cs (98%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241023181253_InitialCreate.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241023182454_AjusteEndereco.Designer.cs (98%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241023182454_AjusteEndereco.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs (98%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241023183035_AlterEnderecoIdGeneration.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241101235914_NomeDaMigration.Designer.cs (98%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241101235914_NomeDaMigration.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241118214851_secondCreate.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241118214851_secondCreate.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241127022231_produtos.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241127022231_produtos.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241127171458_lista.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241127171458_lista.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241127193747_funcionapfv.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241127193747_funcionapfv.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129060230_atualizandoUsuario.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129060230_atualizandoUsuario.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129071042_mudandoOTipoDaImagem.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs (99%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/20241129173606_NomeDaMigration1221212.cs (100%) rename Prova2_Henrique/Prova/{ => Infrastructure/Repositories/Data}/Migrations/AppDbContextModelSnapshot.cs (99%) create mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/EnderecoRepository.cs create mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs create mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs create mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs rename Prova2_Henrique/Prova/{ => Presentation}/Controllers/MarcasController.cs (100%) rename Prova2_Henrique/Prova/{ => Presentation}/Controllers/ProduotsController.cs (100%) rename Prova2_Henrique/Prova/{ => Presentation}/Controllers/UsuarioController.cs (100%) create mode 100644 Prova2_Henrique/Prova/Presentation/Presentation.csproj rename Prova2_Henrique/Prova/{ => Presentation}/Program.cs (97%) rename Prova2_Henrique/Prova/{ => Presentation}/Properties/launchSettings.json (100%) diff --git a/Prova2_Henrique/Prova/Application/.DS_Store b/Prova2_Henrique/Prova/Application/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f3a89d1bdec64d2e8d9dfc86cfc90b873e9e15cd GIT binary patch literal 6148 zcmeHKu};H44E41gf literal 0 HcmV?d00001 diff --git a/Prova2_Henrique/Prova/Application/Application.csproj b/Prova2_Henrique/Prova/Application/Application.csproj new file mode 100644 index 0000000..35e3a11 --- /dev/null +++ b/Prova2_Henrique/Prova/Application/Application.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/Prova2_Henrique/Prova/Services/EnderecoService.cs b/Prova2_Henrique/Prova/Application/Services/EnderecoService.cs similarity index 100% rename from Prova2_Henrique/Prova/Services/EnderecoService.cs rename to Prova2_Henrique/Prova/Application/Services/EnderecoService.cs diff --git a/Prova2_Henrique/Prova/Services/JwtTokenService.cs b/Prova2_Henrique/Prova/Application/Services/JwtTokenService.cs similarity index 100% rename from Prova2_Henrique/Prova/Services/JwtTokenService.cs rename to Prova2_Henrique/Prova/Application/Services/JwtTokenService.cs diff --git a/Prova2_Henrique/Prova/Services/MarcaService.cs b/Prova2_Henrique/Prova/Application/Services/MarcaService.cs similarity index 100% rename from Prova2_Henrique/Prova/Services/MarcaService.cs rename to Prova2_Henrique/Prova/Application/Services/MarcaService.cs diff --git a/Prova2_Henrique/Prova/Services/ProdutoService.cs b/Prova2_Henrique/Prova/Application/Services/ProdutoService.cs similarity index 100% rename from Prova2_Henrique/Prova/Services/ProdutoService.cs rename to Prova2_Henrique/Prova/Application/Services/ProdutoService.cs diff --git a/Prova2_Henrique/Prova/Services/UsuarioService.cs b/Prova2_Henrique/Prova/Application/Services/UsuarioService.cs similarity index 100% rename from Prova2_Henrique/Prova/Services/UsuarioService.cs rename to Prova2_Henrique/Prova/Application/Services/UsuarioService.cs diff --git a/Prova2_Henrique/Prova/DTO/EnderecoDTO.cs b/Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs similarity index 100% rename from Prova2_Henrique/Prova/DTO/EnderecoDTO.cs rename to Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs diff --git a/Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioAtualizacaoDTO.cs similarity index 100% rename from Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs rename to Prova2_Henrique/Prova/Core/DTO/UsuarioAtualizacaoDTO.cs diff --git a/Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioCadastroDTO.cs similarity index 100% rename from Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs rename to Prova2_Henrique/Prova/Core/DTO/UsuarioCadastroDTO.cs diff --git a/Prova2_Henrique/Prova/DTO/UsuarioComToken.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioComToken.cs similarity index 100% rename from Prova2_Henrique/Prova/DTO/UsuarioComToken.cs rename to Prova2_Henrique/Prova/Core/DTO/UsuarioComToken.cs diff --git a/Prova2_Henrique/Prova/DTO/UsuarioRespostaDTO.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioRespostaDTO.cs similarity index 100% rename from Prova2_Henrique/Prova/DTO/UsuarioRespostaDTO.cs rename to Prova2_Henrique/Prova/Core/DTO/UsuarioRespostaDTO.cs diff --git a/Prova2_Henrique/Prova/Models/Endereco.cs b/Prova2_Henrique/Prova/Core/Models/Endereco.cs similarity index 100% rename from Prova2_Henrique/Prova/Models/Endereco.cs rename to Prova2_Henrique/Prova/Core/Models/Endereco.cs diff --git a/Prova2_Henrique/Prova/Models/Marca.cs b/Prova2_Henrique/Prova/Core/Models/Marca.cs similarity index 100% rename from Prova2_Henrique/Prova/Models/Marca.cs rename to Prova2_Henrique/Prova/Core/Models/Marca.cs diff --git a/Prova2_Henrique/Prova/Models/Produto.cs b/Prova2_Henrique/Prova/Core/Models/Produto.cs similarity index 100% rename from Prova2_Henrique/Prova/Models/Produto.cs rename to Prova2_Henrique/Prova/Core/Models/Produto.cs diff --git a/Prova2_Henrique/Prova/Models/Usuario.cs b/Prova2_Henrique/Prova/Core/Models/Usuario.cs similarity index 100% rename from Prova2_Henrique/Prova/Models/Usuario.cs rename to Prova2_Henrique/Prova/Core/Models/Usuario.cs diff --git a/Prova2_Henrique/Prova/Repositories/EnderecoRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/EnderecoRepository.cs similarity index 100% rename from Prova2_Henrique/Prova/Repositories/EnderecoRepository.cs rename to Prova2_Henrique/Prova/Core/Repositories/EnderecoRepository.cs diff --git a/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs similarity index 94% rename from Prova2_Henrique/Prova/Repositories/MarcaRepository.cs rename to Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs index e7b491b..23ba020 100644 --- a/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs +++ b/Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs @@ -1,8 +1,8 @@ -using Prova.Data; using Prova.Models; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Threading.Tasks; +using Prova.Infrastructure.Repositories.Data; namespace Prova.Repositories { diff --git a/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs similarity index 97% rename from Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs rename to Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs index 96aaed9..51ad2e2 100644 --- a/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs +++ b/Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs @@ -1,8 +1,8 @@ -using Prova.Data; using Prova.Models; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Threading.Tasks; +using Prova.Infrastructure.Repositories.Data; namespace Prova.Repositories { diff --git a/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs similarity index 96% rename from Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs rename to Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs index 96e9f63..fd52e8a 100644 --- a/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs +++ b/Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs @@ -1,5 +1,5 @@ using Microsoft.EntityFrameworkCore; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; using Prova.Models; using System.Collections.Generic; using System.Linq; diff --git a/Prova2_Henrique/Prova/Core/Services/EnderecoService.cs b/Prova2_Henrique/Prova/Core/Services/EnderecoService.cs new file mode 100644 index 0000000..e69de29 diff --git a/Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs b/Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs new file mode 100644 index 0000000..e1d085a --- /dev/null +++ b/Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs @@ -0,0 +1,72 @@ +using Microsoft.IdentityModel.Tokens; +using System.IdentityModel.Tokens.Jwt; +using System.Security.Claims; +using System.Text; + +namespace Prova.Services +{ + public class JwtService + { + private const string _secretKey = "minha-chave-secreta-de-assinatura"; + private const string _issuer = "meu-sistema"; + private const string _audience = "meu-cliente"; + + public string GerarToken(string usuario, string email) + { + var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_secretKey)); + var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + + var claims = new[] + { + new Claim(JwtRegisteredClaimNames.Sub, usuario), + new Claim(JwtRegisteredClaimNames.Email, email), + new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) + }; + + var token = new JwtSecurityToken( + issuer: _issuer, + audience: _audience, + claims: claims, + expires: DateTime.Now.AddHours(10), + signingCredentials: credentials + ); + + var tokenHandler = new JwtSecurityTokenHandler(); + return tokenHandler.WriteToken(token); + } + + public string ValidarToken(string token) + { + var tokenHandler = new JwtSecurityTokenHandler(); + var key = Encoding.UTF8.GetBytes(_secretKey); + + try + { + var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters + { + ValidateIssuer = true, + ValidateAudience = true, + ValidateLifetime = true, + ValidateIssuerSigningKey = true, + IssuerSigningKey = new SymmetricSecurityKey(key), + ValidIssuer = _issuer, + ValidAudience = _audience + }, out var validatedToken); + + return "Token é válido."; + } + catch (SecurityTokenExpiredException) + { + return "Token expirado."; + } + catch (SecurityTokenException) + { + return "Token inválido."; + } + catch (Exception) + { + return "Erro ao validar o token."; + } + } + } +} diff --git a/Prova2_Henrique/Prova/Core/Services/MarcaService.cs b/Prova2_Henrique/Prova/Core/Services/MarcaService.cs new file mode 100644 index 0000000..890942d --- /dev/null +++ b/Prova2_Henrique/Prova/Core/Services/MarcaService.cs @@ -0,0 +1,32 @@ +using Prova.Repositories; +using Prova.Models; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Prova.Services +{ + public class MarcaService + { + private readonly MarcaRepository _marcaRepository; + + public MarcaService(MarcaRepository marcaRepository) + { + _marcaRepository = marcaRepository; + } + + public async Task> GetAllAsync() + { + return await _marcaRepository.GetAllAsync(); + } + + public async Task GetByIdAsync(int id) + { + return await _marcaRepository.GetByIdAsync(id); + } + + public async Task AddAsync(Marca marca) + { + return await _marcaRepository.AddAsync(marca); + } + } +} diff --git a/Prova2_Henrique/Prova/Core/Services/ProdutoService.cs b/Prova2_Henrique/Prova/Core/Services/ProdutoService.cs new file mode 100644 index 0000000..8d8473d --- /dev/null +++ b/Prova2_Henrique/Prova/Core/Services/ProdutoService.cs @@ -0,0 +1,48 @@ +using Prova.Repositories; +using Prova.Models; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Prova.Services +{ + public class ProdutoService + { + private readonly ProdutoRepository _produtoRepository; + + public ProdutoService(ProdutoRepository produtoRepository) + { + _produtoRepository = produtoRepository; + } + + public async Task> GetAllAsync() + { + return await _produtoRepository.GetAllAsync(); + } + + public async Task GetByIdAsync(int id) + { + return await _produtoRepository.GetByIdAsync(id); + } + + public async Task AddAsync(Produto produto) + { + return await _produtoRepository.AddAsync(produto); + } + + public async Task DeleteAllAsync() + { + await _produtoRepository.DeleteAllAsync(); + } + public async Task UpdateByNameAsync(string nome, Produto produtoAtualizado) + { + if (string.IsNullOrWhiteSpace(nome) || produtoAtualizado == null) + { + return null; + } + + return await _produtoRepository.UpdateByNameAsync(nome, produtoAtualizado); + } + + + } +} diff --git a/Prova2_Henrique/Prova/Core/Services/UsuarioService.cs b/Prova2_Henrique/Prova/Core/Services/UsuarioService.cs new file mode 100644 index 0000000..455ac71 --- /dev/null +++ b/Prova2_Henrique/Prova/Core/Services/UsuarioService.cs @@ -0,0 +1,139 @@ +using Prova.Repositories; +using Prova.Models; +using System.Collections.Generic; +using System.Threading.Tasks; +using Prova.DTOs; +using Prova.DTO; + +namespace Prova.Services +{ + public class UsuarioService + { + private readonly UsuarioRepository _usuarioRepository; + private readonly JwtService _jwtService; + + public UsuarioService(UsuarioRepository usuarioRepository, JwtService jwtService) + { + _usuarioRepository = usuarioRepository; + _jwtService = jwtService; + } + + public async Task CriarUsuario(UsuarioCadastroDTO usuarioDto) + { + if (usuarioDto == null) + throw new ArgumentException("Dados do usuário não fornecidos."); + + if (!ValidarCPF(usuarioDto.Cpf)) + throw new ArgumentException("CPF inválido."); + + var emailExistente = await _usuarioRepository.GetByEmailAsync(usuarioDto.Email); + if (emailExistente != null) + throw new InvalidOperationException("Já existe um usuário com este email."); + + var usuario = new Usuario + { + Nome = usuarioDto.Nome, + Sobrenome = usuarioDto.Sobrenome, + Telefone = usuarioDto.Telefone, + Senha = usuarioDto.Senha, + Cpf = usuarioDto.Cpf, + Email = usuarioDto.Email, + }; + + if (usuarioDto.Imagem != null) + { + using (var memoryStream = new MemoryStream()) + { + await usuarioDto.Imagem.CopyToAsync(memoryStream); + usuario.ImagemBase64 = Convert.ToBase64String(memoryStream.ToArray()); + } + } + + var usuarioCriado = await _usuarioRepository.AddAsync(usuario); + + var token = _jwtService.GerarToken(usuarioCriado.Nome, usuarioCriado.Email); + + return new UsuarioComToken + { + Token = token, + Usuario = usuarioCriado + }; + } + + + + public async Task AtualizarUsuario(string email, UsuarioAtualizacaoDTO usuarioAtualizado) + { + var usuarioExistente = await _usuarioRepository.GetByEmailAsync(email); + if (usuarioExistente == null) + throw new InvalidOperationException("Usuário não encontrado."); + + usuarioExistente.Nome = usuarioAtualizado.Nome; + usuarioExistente.Sobrenome = usuarioAtualizado.Sobrenome; + usuarioExistente.Telefone = usuarioAtualizado.Telefone; + usuarioExistente.Senha = usuarioAtualizado.Senha; + + if (usuarioAtualizado.Enderecos != null && usuarioAtualizado.Enderecos.Count > 0) + { + var enderecosExistentes = usuarioExistente.Enderecos.ToList(); + usuarioExistente.Enderecos.Clear(); + foreach (var enderecoDTO in usuarioAtualizado.Enderecos) + { + var endereco = new Endereco + { + Cep = enderecoDTO.Cep, + Cidade = enderecoDTO.Cidade, + Estado = enderecoDTO.Estado, + UsuarioId = usuarioExistente.Id + }; + usuarioExistente.Enderecos.Add(endereco); + } + } + + await _usuarioRepository.UpdateAsync(usuarioExistente); + } + + public async Task AutenticarUsuario(string email, string senha, string token) + { + if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(senha)) + throw new ArgumentException("Email e senha são obrigatórios."); + + var usuario = await _usuarioRepository.GetByEmailAsync(email); + if (usuario == null || usuario.Senha != senha) + throw new InvalidOperationException("Email ou senha inválidos."); + + string tokenStatus = _jwtService.ValidarToken(token); + + return new Usuario + { + Id = usuario.Id, + Nome = usuario.Nome, + Sobrenome = usuario.Sobrenome, + Telefone = usuario.Telefone, + Email = usuario.Email, + Cpf = usuario.Cpf, + Enderecos = usuario.Enderecos, + ImagemBase64 = usuario.ImagemBase64, + }; + } + + private bool ValidarCPF(string cpf) + { + cpf = new string(cpf.Where(char.IsDigit).ToArray()); + if (cpf.Length != 11) return false; + if (cpf.All(c => c == cpf[0])) return false; + + int soma1 = 0; + for (int i = 0; i < 9; i++) soma1 += int.Parse(cpf[i].ToString()) * (10 - i); + int resto1 = soma1 % 11; + int digito1 = (resto1 < 2) ? 0 : 11 - resto1; + if (digito1 != int.Parse(cpf[9].ToString())) return false; + + int soma2 = 0; + for (int i = 0; i < 10; i++) soma2 += int.Parse(cpf[i].ToString()) * (11 - i); + int resto2 = soma2 % 11; + int digito2 = (resto2 < 2) ? 0 : 11 - resto2; + return digito2 == int.Parse(cpf[10].ToString()); + } + } +} diff --git a/Prova2_Henrique/Prova/Core/core.csproj b/Prova2_Henrique/Prova/Core/core.csproj new file mode 100644 index 0000000..39ae10d --- /dev/null +++ b/Prova2_Henrique/Prova/Core/core.csproj @@ -0,0 +1,6 @@ +namespace Prova.Core +{ + public class Class + { + } +} diff --git a/Prova2_Henrique/Prova/Infrastructure/.DS_Store b/Prova2_Henrique/Prova/Infrastructure/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f3057484833f4648be1aa89590b71c8b8a24b490 GIT binary patch literal 6148 zcmeHKOHRWu5FNJ_6wyVOU78i^F4%`ET%f%`6jBN(ArXarB#yu(SaOP<2Z;;t#$z?H z(pGFh2+c_2=gi0ByhNFph|KIcn-YzQXb5HOonY7@>}Tyr&s#=7!)r_z*JV+4;?(eW z8Q^EvrZr#0UE}2~t#)0cAiL_%R01vss3xf;uV#%78MkWq`jA7RnfTtOebt1A{vP0QqOp z3Fds3;2i5Q@>mPP12K{clvLx77)H`zw>~cNSPM!z8CMzW_{zqgP>ib%yLI7YB0(LM z0c9X$pf8tW?*CW&&;MbPUMU00z`tU^4B|yR!!7yV+POLIwHBH{Svam1+@@gSS}|g| d6;Gf}V7EL0MjmTHSRnc%;Aqf68TeHOz5qDZW7Gfu literal 0 HcmV?d00001 diff --git a/Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj b/Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj new file mode 100644 index 0000000..fb8ce65 --- /dev/null +++ b/Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj @@ -0,0 +1,22 @@ + + + + net8.0 + enable + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/Prova2_Henrique/Prova/Data/AppDbContext.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs similarity index 96% rename from Prova2_Henrique/Prova/Data/AppDbContext.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs index c78943a..5bc563a 100644 --- a/Prova2_Henrique/Prova/Data/AppDbContext.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore; using Prova.Models; -namespace Prova.Data +namespace Prova.Infrastructure.Repositories.Data { public class AppDbContext : DbContext { diff --git a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs similarity index 98% rename from Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs index 0369fc8..9df47ac 100644 --- a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs similarity index 98% rename from Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs index 4aea357..ab73fe5 100644 --- a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs similarity index 98% rename from Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs index 9041a66..c925804 100644 --- a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs similarity index 98% rename from Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs index 78533b6..32be257 100644 --- a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs @@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs index 4205dbf..5d4d6b4 100644 --- a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs @@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs index 656b449..2a5b7f9 100644 --- a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs index d70bcdf..68ddca7 100644 --- a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs index 0ebf7f0..6db4de5 100644 --- a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs index a393b03..df03ce3 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs index ac29dcb..ba9e305 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs index 917efe7..356ef66 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs index 39264b1..0fbe598 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs index b156256..9d9a864 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs index d3296d3..7ea1a68 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs index 8d24c52..87ca2e2 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs index e426755..9159d67 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs index 9ebfd45..4f5bede 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs index 2f07757..de37558 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs index 1fc5f9a..fddb075 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs index 420e318..7665634 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs index af83ed1..017bf51 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs diff --git a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs index a85bbae..955e0f0 100644 --- a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.cs similarity index 100% rename from Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.cs diff --git a/Prova2_Henrique/Prova/Migrations/AppDbContextModelSnapshot.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs similarity index 99% rename from Prova2_Henrique/Prova/Migrations/AppDbContextModelSnapshot.cs rename to Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs index e07d6f8..7001347 100644 --- a/Prova2_Henrique/Prova/Migrations/AppDbContextModelSnapshot.cs +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs @@ -4,7 +4,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; #nullable disable diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/EnderecoRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/EnderecoRepository.cs new file mode 100644 index 0000000..e69de29 diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs new file mode 100644 index 0000000..23ba020 --- /dev/null +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs @@ -0,0 +1,36 @@ +using Prova.Models; +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Threading.Tasks; +using Prova.Infrastructure.Repositories.Data; + +namespace Prova.Repositories +{ + public class MarcaRepository + { + private readonly AppDbContext _context; + + public MarcaRepository(AppDbContext context) + { + _context = context; + } + + public async Task> GetAllAsync() + { + return await _context.Marcas.ToListAsync(); + } + + public async Task GetByIdAsync(int id) + { + return await _context.Marcas.FindAsync(id); + } + + public async Task AddAsync(Marca marca) + { + _context.Marcas.Add(marca); + await _context.SaveChangesAsync(); + return marca; + } + + } +} \ No newline at end of file diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs new file mode 100644 index 0000000..51ad2e2 --- /dev/null +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs @@ -0,0 +1,64 @@ +using Prova.Models; +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Threading.Tasks; +using Prova.Infrastructure.Repositories.Data; + +namespace Prova.Repositories +{ + public class ProdutoRepository + { + private readonly AppDbContext _context; + + public ProdutoRepository(AppDbContext context) + { + _context = context; + } + + public async Task> GetAllAsync() + { + return await _context.Produtos.Include(p => p.Marca).ToListAsync(); + } + + public async Task GetByIdAsync(int id) + { + return await _context.Produtos.Include(p => p.Marca).FirstOrDefaultAsync(p => p.Id == id); + } + + public async Task AddAsync(Produto produto) + { + _context.Produtos.Add(produto); + await _context.SaveChangesAsync(); + return produto; + } + + public async Task DeleteAllAsync() + { + var produtos = await _context.Produtos.ToListAsync(); + if (produtos != null && produtos.Count > 0) + { + _context.Produtos.RemoveRange(produtos); + await _context.SaveChangesAsync(); + } + } + + public async Task UpdateByNameAsync(string nome, Produto produtoAtualizado) + { + var produtoExistente = await _context.Produtos.FirstOrDefaultAsync(p => p.Nome == nome); + + if (produtoExistente == null) + { + return null; + } + + produtoExistente.Nome = produtoAtualizado.Nome; + produtoExistente.Descricao = produtoAtualizado.Descricao; + produtoExistente.Preco = produtoAtualizado.Preco; + + + await _context.SaveChangesAsync(); + + return produtoExistente; + } + } +} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs new file mode 100644 index 0000000..fd52e8a --- /dev/null +++ b/Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs @@ -0,0 +1,54 @@ +using Microsoft.EntityFrameworkCore; +using Prova.Infrastructure.Repositories.Data; +using Prova.Models; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Prova.Repositories +{ + public class UsuarioRepository + { + private readonly AppDbContext _context; + + public UsuarioRepository(AppDbContext context) + { + _context = context; + } + + public async Task> GetAllAsync() + { + return await _context.Usuarios.ToListAsync(); + } + + public async Task GetByEmailAsync(string email) + { + return await _context.Usuarios + .Include(u => u.Enderecos) + .FirstOrDefaultAsync(u => u.Email == email); + } + + public async Task AddAsync(Usuario usuario) + { + await _context.Usuarios.AddAsync(usuario); + await _context.SaveChangesAsync(); + return usuario; + } + + public async Task UpdateAsync(Usuario usuario) + { + _context.Usuarios.Update(usuario); + await _context.SaveChangesAsync(); + } + + public async Task DeleteAsync(int id) + { + var usuario = await _context.Usuarios.FindAsync(id); + if (usuario != null) + { + _context.Usuarios.Remove(usuario); + await _context.SaveChangesAsync(); + } + } + } +} diff --git a/Prova2_Henrique/Prova/Controllers/MarcasController.cs b/Prova2_Henrique/Prova/Presentation/Controllers/MarcasController.cs similarity index 100% rename from Prova2_Henrique/Prova/Controllers/MarcasController.cs rename to Prova2_Henrique/Prova/Presentation/Controllers/MarcasController.cs diff --git a/Prova2_Henrique/Prova/Controllers/ProduotsController.cs b/Prova2_Henrique/Prova/Presentation/Controllers/ProduotsController.cs similarity index 100% rename from Prova2_Henrique/Prova/Controllers/ProduotsController.cs rename to Prova2_Henrique/Prova/Presentation/Controllers/ProduotsController.cs diff --git a/Prova2_Henrique/Prova/Controllers/UsuarioController.cs b/Prova2_Henrique/Prova/Presentation/Controllers/UsuarioController.cs similarity index 100% rename from Prova2_Henrique/Prova/Controllers/UsuarioController.cs rename to Prova2_Henrique/Prova/Presentation/Controllers/UsuarioController.cs diff --git a/Prova2_Henrique/Prova/Presentation/Presentation.csproj b/Prova2_Henrique/Prova/Presentation/Presentation.csproj new file mode 100644 index 0000000..9772721 --- /dev/null +++ b/Prova2_Henrique/Prova/Presentation/Presentation.csproj @@ -0,0 +1,6 @@ +namespace Prova.Presentation +{ + public class Class + { + } +} diff --git a/Prova2_Henrique/Prova/Program.cs b/Prova2_Henrique/Prova/Presentation/Program.cs similarity index 97% rename from Prova2_Henrique/Prova/Program.cs rename to Prova2_Henrique/Prova/Presentation/Program.cs index f99de1f..68e6d24 100644 --- a/Prova2_Henrique/Prova/Program.cs +++ b/Prova2_Henrique/Prova/Presentation/Program.cs @@ -1,5 +1,5 @@ using Microsoft.EntityFrameworkCore; -using Prova.Data; +using Prova.Infrastructure.Repositories.Data; using Prova.Repositories; using Prova.Services; diff --git a/Prova2_Henrique/Prova/Properties/launchSettings.json b/Prova2_Henrique/Prova/Presentation/Properties/launchSettings.json similarity index 100% rename from Prova2_Henrique/Prova/Properties/launchSettings.json rename to Prova2_Henrique/Prova/Presentation/Properties/launchSettings.json diff --git a/Prova2_Henrique/Prova/Prova.csproj b/Prova2_Henrique/Prova/Prova.csproj index f42cb52..cc12bc6 100644 --- a/Prova2_Henrique/Prova/Prova.csproj +++ b/Prova2_Henrique/Prova/Prova.csproj @@ -6,6 +6,10 @@ enable + + + + @@ -24,4 +28,8 @@ + + + + From 00eee08f7a259858588d77359b6fe35d366b802c Mon Sep 17 00:00:00 2001 From: Jp Date: Fri, 29 Nov 2024 18:56:50 -0300 Subject: [PATCH 2/2] altaracao de pasta --- Prova2_Henrique/Prova/Application/.DS_Store | Bin 6148 -> 0 bytes .../Prova/Application/Application.csproj | 13 -- .../Application/Services/EnderecoService.cs | 0 .../Application/Services/JwtTokenService.cs | 72 ------ .../Application/Services/MarcaService.cs | 32 --- .../Application/Services/ProdutoService.cs | 48 ---- .../Application/Services/UsuarioService.cs | 139 ----------- .../Controllers/MarcasController.cs | 6 +- .../Controllers/ProduotsController.cs | 6 +- .../Controllers/UsuarioController.cs | 8 +- Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs | 12 - .../Prova/Core/DTO/UsuarioAtualizacaoDTO.cs | 24 -- .../Prova/Core/DTO/UsuarioCadastroDTO.cs | 25 -- .../Prova/Core/DTO/UsuarioComToken.cs | 9 - .../Prova/Core/DTO/UsuarioRespostaDTO.cs | 17 -- Prova2_Henrique/Prova/Core/Models/Endereco.cs | 30 --- Prova2_Henrique/Prova/Core/Models/Marca.cs | 23 -- Prova2_Henrique/Prova/Core/Models/Produto.cs | 35 --- Prova2_Henrique/Prova/Core/Models/Usuario.cs | 45 ---- .../Core/Repositories/EnderecoRepository.cs | 0 .../Core/Repositories/MarcaRepository.cs | 36 --- .../Core/Repositories/ProdutoRepository.cs | 64 ------ .../Core/Repositories/UsuarioRepository.cs | 54 ----- .../Prova/Core/Services/EnderecoService.cs | 0 .../Prova/Core/Services/JwtTokenService.cs | 72 ------ .../Prova/Core/Services/MarcaService.cs | 32 --- .../Prova/Core/Services/ProdutoService.cs | 48 ---- .../Prova/Core/Services/UsuarioService.cs | 139 ----------- Prova2_Henrique/Prova/Core/core.csproj | 6 - .../Prova/Infrastructure/.DS_Store | Bin 6148 -> 0 bytes .../Infrastructure/Infrastructure.csproj | 22 -- .../Repositories/Data/AppDbContext.cs | 46 ---- .../20241023181253_InitialCreate.Designer.cs | 106 --------- .../20241023181253_InitialCreate.cs | 65 ------ .../20241023182454_AjusteEndereco.Designer.cs | 106 --------- .../20241023182454_AjusteEndereco.cs | 19 -- ...3035_AlterEnderecoIdGeneration.Designer.cs | 106 --------- ...0241023183035_AlterEnderecoIdGeneration.cs | 19 -- ...20241101235914_NomeDaMigration.Designer.cs | 107 --------- .../20241101235914_NomeDaMigration.cs | 81 ------- .../20241118214851_secondCreate.Designer.cs | 162 ------------- .../Migrations/20241118214851_secondCreate.cs | 61 ----- .../20241127022231_produtos.Designer.cs | 175 -------------- .../Migrations/20241127022231_produtos.cs | 48 ---- .../20241127171458_lista.Designer.cs | 217 ------------------ .../Data/Migrations/20241127171458_lista.cs | 57 ----- .../20241127193747_funcionapfv.Designer.cs | 217 ------------------ .../Migrations/20241127193747_funcionapfv.cs | 22 -- ...41129060230_atualizandoUsuario.Designer.cs | 183 --------------- .../20241129060230_atualizandoUsuario.cs | 79 ------- ...129071042_mudandoOTipoDaImagem.Designer.cs | 183 --------------- .../20241129071042_mudandoOTipoDaImagem.cs | 28 --- ..._mudandoOTipoDaIamgemNovamente.Designer.cs | 183 --------------- ...129071811_mudandoOTipoDaIamgemNovamente.cs | 22 -- ...mudandoOTipoDaIamgemNovamente2.Designer.cs | 183 --------------- ...29072043_mudandoOTipoDaIamgemNovamente2.cs | 28 --- ...mudandoOTipoDaIamgemNovamente3.Designer.cs | 183 --------------- ...29072432_mudandoOTipoDaIamgemNovamente3.cs | 28 --- ...mudandoOTipoDaIamgemNovamente5.Designer.cs | 179 --------------- ...29073354_mudandoOTipoDaIamgemNovamente5.cs | 29 --- ...mudandoOTipoDaIamgemNovamente7.Designer.cs | 183 --------------- ...29073810_mudandoOTipoDaIamgemNovamente7.cs | 29 --- ...mudandoOTipoDaIamgemNovamente8.Designer.cs | 184 --------------- ...29074050_mudandoOTipoDaIamgemNovamente8.cs | 36 --- ...udandoOTipoDaIamgemNovamente10.Designer.cs | 183 --------------- ...9080256_mudandoOTipoDaIamgemNovamente10.cs | 36 --- ...udandoOTipoDaIamgemNovamente12.Designer.cs | 183 --------------- ...9081217_mudandoOTipoDaIamgemNovamente12.cs | 22 -- ...udandoOTipoDaIamgemNovamente13.Designer.cs | 184 --------------- ...9081646_mudandoOTipoDaIamgemNovamente13.cs | 36 --- ...udandoOTipoDaIamgemNovamente15.Designer.cs | 179 --------------- ...9082124_mudandoOTipoDaIamgemNovamente15.cs | 47 ---- ...udandoOTipoDaIamgemNovamente18.Designer.cs | 179 --------------- ...9083237_mudandoOTipoDaIamgemNovamente18.cs | 128 ----------- ...9173606_NomeDaMigration1221212.Designer.cs | 179 --------------- .../20241129173606_NomeDaMigration1221212.cs | 22 -- .../Migrations/AppDbContextModelSnapshot.cs | 176 -------------- .../Repositories/EnderecoRepository.cs | 0 .../Repositories/MarcaRepository.cs | 36 --- .../Repositories/ProdutoRepository.cs | 64 ------ .../Repositories/UsuarioRepository.cs | 54 ----- .../Prova/Presentation/Presentation.csproj | 6 - .../Prova/{Presentation => }/Program.cs | 9 +- .../Properties/launchSettings.json | 0 Prova2_Henrique/Prova/Prova.csproj | 33 ++- 85 files changed, 44 insertions(+), 6083 deletions(-) delete mode 100644 Prova2_Henrique/Prova/Application/.DS_Store delete mode 100644 Prova2_Henrique/Prova/Application/Application.csproj delete mode 100644 Prova2_Henrique/Prova/Application/Services/EnderecoService.cs delete mode 100644 Prova2_Henrique/Prova/Application/Services/JwtTokenService.cs delete mode 100644 Prova2_Henrique/Prova/Application/Services/MarcaService.cs delete mode 100644 Prova2_Henrique/Prova/Application/Services/ProdutoService.cs delete mode 100644 Prova2_Henrique/Prova/Application/Services/UsuarioService.cs rename Prova2_Henrique/Prova/{Presentation => }/Controllers/MarcasController.cs (94%) rename Prova2_Henrique/Prova/{Presentation => }/Controllers/ProduotsController.cs (96%) rename Prova2_Henrique/Prova/{Presentation => }/Controllers/UsuarioController.cs (96%) delete mode 100644 Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs delete mode 100644 Prova2_Henrique/Prova/Core/DTO/UsuarioAtualizacaoDTO.cs delete mode 100644 Prova2_Henrique/Prova/Core/DTO/UsuarioCadastroDTO.cs delete mode 100644 Prova2_Henrique/Prova/Core/DTO/UsuarioComToken.cs delete mode 100644 Prova2_Henrique/Prova/Core/DTO/UsuarioRespostaDTO.cs delete mode 100644 Prova2_Henrique/Prova/Core/Models/Endereco.cs delete mode 100644 Prova2_Henrique/Prova/Core/Models/Marca.cs delete mode 100644 Prova2_Henrique/Prova/Core/Models/Produto.cs delete mode 100644 Prova2_Henrique/Prova/Core/Models/Usuario.cs delete mode 100644 Prova2_Henrique/Prova/Core/Repositories/EnderecoRepository.cs delete mode 100644 Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs delete mode 100644 Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs delete mode 100644 Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs delete mode 100644 Prova2_Henrique/Prova/Core/Services/EnderecoService.cs delete mode 100644 Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs delete mode 100644 Prova2_Henrique/Prova/Core/Services/MarcaService.cs delete mode 100644 Prova2_Henrique/Prova/Core/Services/ProdutoService.cs delete mode 100644 Prova2_Henrique/Prova/Core/Services/UsuarioService.cs delete mode 100644 Prova2_Henrique/Prova/Core/core.csproj delete mode 100644 Prova2_Henrique/Prova/Infrastructure/.DS_Store delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/EnderecoRepository.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs delete mode 100644 Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs delete mode 100644 Prova2_Henrique/Prova/Presentation/Presentation.csproj rename Prova2_Henrique/Prova/{Presentation => }/Program.cs (94%) rename Prova2_Henrique/Prova/{Presentation => }/Properties/launchSettings.json (100%) diff --git a/Prova2_Henrique/Prova/Application/.DS_Store b/Prova2_Henrique/Prova/Application/.DS_Store deleted file mode 100644 index f3a89d1bdec64d2e8d9dfc86cfc90b873e9e15cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKu};H44E41gf diff --git a/Prova2_Henrique/Prova/Application/Application.csproj b/Prova2_Henrique/Prova/Application/Application.csproj deleted file mode 100644 index 35e3a11..0000000 --- a/Prova2_Henrique/Prova/Application/Application.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - diff --git a/Prova2_Henrique/Prova/Application/Services/EnderecoService.cs b/Prova2_Henrique/Prova/Application/Services/EnderecoService.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Prova2_Henrique/Prova/Application/Services/JwtTokenService.cs b/Prova2_Henrique/Prova/Application/Services/JwtTokenService.cs deleted file mode 100644 index e1d085a..0000000 --- a/Prova2_Henrique/Prova/Application/Services/JwtTokenService.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.IdentityModel.Tokens; -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using System.Text; - -namespace Prova.Services -{ - public class JwtService - { - private const string _secretKey = "minha-chave-secreta-de-assinatura"; - private const string _issuer = "meu-sistema"; - private const string _audience = "meu-cliente"; - - public string GerarToken(string usuario, string email) - { - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_secretKey)); - var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - - var claims = new[] - { - new Claim(JwtRegisteredClaimNames.Sub, usuario), - new Claim(JwtRegisteredClaimNames.Email, email), - new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) - }; - - var token = new JwtSecurityToken( - issuer: _issuer, - audience: _audience, - claims: claims, - expires: DateTime.Now.AddHours(10), - signingCredentials: credentials - ); - - var tokenHandler = new JwtSecurityTokenHandler(); - return tokenHandler.WriteToken(token); - } - - public string ValidarToken(string token) - { - var tokenHandler = new JwtSecurityTokenHandler(); - var key = Encoding.UTF8.GetBytes(_secretKey); - - try - { - var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters - { - ValidateIssuer = true, - ValidateAudience = true, - ValidateLifetime = true, - ValidateIssuerSigningKey = true, - IssuerSigningKey = new SymmetricSecurityKey(key), - ValidIssuer = _issuer, - ValidAudience = _audience - }, out var validatedToken); - - return "Token é válido."; - } - catch (SecurityTokenExpiredException) - { - return "Token expirado."; - } - catch (SecurityTokenException) - { - return "Token inválido."; - } - catch (Exception) - { - return "Erro ao validar o token."; - } - } - } -} diff --git a/Prova2_Henrique/Prova/Application/Services/MarcaService.cs b/Prova2_Henrique/Prova/Application/Services/MarcaService.cs deleted file mode 100644 index 890942d..0000000 --- a/Prova2_Henrique/Prova/Application/Services/MarcaService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Prova.Repositories; -using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Prova.Services -{ - public class MarcaService - { - private readonly MarcaRepository _marcaRepository; - - public MarcaService(MarcaRepository marcaRepository) - { - _marcaRepository = marcaRepository; - } - - public async Task> GetAllAsync() - { - return await _marcaRepository.GetAllAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _marcaRepository.GetByIdAsync(id); - } - - public async Task AddAsync(Marca marca) - { - return await _marcaRepository.AddAsync(marca); - } - } -} diff --git a/Prova2_Henrique/Prova/Application/Services/ProdutoService.cs b/Prova2_Henrique/Prova/Application/Services/ProdutoService.cs deleted file mode 100644 index 8d8473d..0000000 --- a/Prova2_Henrique/Prova/Application/Services/ProdutoService.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Prova.Repositories; -using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Prova.Services -{ - public class ProdutoService - { - private readonly ProdutoRepository _produtoRepository; - - public ProdutoService(ProdutoRepository produtoRepository) - { - _produtoRepository = produtoRepository; - } - - public async Task> GetAllAsync() - { - return await _produtoRepository.GetAllAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _produtoRepository.GetByIdAsync(id); - } - - public async Task AddAsync(Produto produto) - { - return await _produtoRepository.AddAsync(produto); - } - - public async Task DeleteAllAsync() - { - await _produtoRepository.DeleteAllAsync(); - } - public async Task UpdateByNameAsync(string nome, Produto produtoAtualizado) - { - if (string.IsNullOrWhiteSpace(nome) || produtoAtualizado == null) - { - return null; - } - - return await _produtoRepository.UpdateByNameAsync(nome, produtoAtualizado); - } - - - } -} diff --git a/Prova2_Henrique/Prova/Application/Services/UsuarioService.cs b/Prova2_Henrique/Prova/Application/Services/UsuarioService.cs deleted file mode 100644 index 455ac71..0000000 --- a/Prova2_Henrique/Prova/Application/Services/UsuarioService.cs +++ /dev/null @@ -1,139 +0,0 @@ -using Prova.Repositories; -using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; -using Prova.DTOs; -using Prova.DTO; - -namespace Prova.Services -{ - public class UsuarioService - { - private readonly UsuarioRepository _usuarioRepository; - private readonly JwtService _jwtService; - - public UsuarioService(UsuarioRepository usuarioRepository, JwtService jwtService) - { - _usuarioRepository = usuarioRepository; - _jwtService = jwtService; - } - - public async Task CriarUsuario(UsuarioCadastroDTO usuarioDto) - { - if (usuarioDto == null) - throw new ArgumentException("Dados do usuário não fornecidos."); - - if (!ValidarCPF(usuarioDto.Cpf)) - throw new ArgumentException("CPF inválido."); - - var emailExistente = await _usuarioRepository.GetByEmailAsync(usuarioDto.Email); - if (emailExistente != null) - throw new InvalidOperationException("Já existe um usuário com este email."); - - var usuario = new Usuario - { - Nome = usuarioDto.Nome, - Sobrenome = usuarioDto.Sobrenome, - Telefone = usuarioDto.Telefone, - Senha = usuarioDto.Senha, - Cpf = usuarioDto.Cpf, - Email = usuarioDto.Email, - }; - - if (usuarioDto.Imagem != null) - { - using (var memoryStream = new MemoryStream()) - { - await usuarioDto.Imagem.CopyToAsync(memoryStream); - usuario.ImagemBase64 = Convert.ToBase64String(memoryStream.ToArray()); - } - } - - var usuarioCriado = await _usuarioRepository.AddAsync(usuario); - - var token = _jwtService.GerarToken(usuarioCriado.Nome, usuarioCriado.Email); - - return new UsuarioComToken - { - Token = token, - Usuario = usuarioCriado - }; - } - - - - public async Task AtualizarUsuario(string email, UsuarioAtualizacaoDTO usuarioAtualizado) - { - var usuarioExistente = await _usuarioRepository.GetByEmailAsync(email); - if (usuarioExistente == null) - throw new InvalidOperationException("Usuário não encontrado."); - - usuarioExistente.Nome = usuarioAtualizado.Nome; - usuarioExistente.Sobrenome = usuarioAtualizado.Sobrenome; - usuarioExistente.Telefone = usuarioAtualizado.Telefone; - usuarioExistente.Senha = usuarioAtualizado.Senha; - - if (usuarioAtualizado.Enderecos != null && usuarioAtualizado.Enderecos.Count > 0) - { - var enderecosExistentes = usuarioExistente.Enderecos.ToList(); - usuarioExistente.Enderecos.Clear(); - foreach (var enderecoDTO in usuarioAtualizado.Enderecos) - { - var endereco = new Endereco - { - Cep = enderecoDTO.Cep, - Cidade = enderecoDTO.Cidade, - Estado = enderecoDTO.Estado, - UsuarioId = usuarioExistente.Id - }; - usuarioExistente.Enderecos.Add(endereco); - } - } - - await _usuarioRepository.UpdateAsync(usuarioExistente); - } - - public async Task AutenticarUsuario(string email, string senha, string token) - { - if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(senha)) - throw new ArgumentException("Email e senha são obrigatórios."); - - var usuario = await _usuarioRepository.GetByEmailAsync(email); - if (usuario == null || usuario.Senha != senha) - throw new InvalidOperationException("Email ou senha inválidos."); - - string tokenStatus = _jwtService.ValidarToken(token); - - return new Usuario - { - Id = usuario.Id, - Nome = usuario.Nome, - Sobrenome = usuario.Sobrenome, - Telefone = usuario.Telefone, - Email = usuario.Email, - Cpf = usuario.Cpf, - Enderecos = usuario.Enderecos, - ImagemBase64 = usuario.ImagemBase64, - }; - } - - private bool ValidarCPF(string cpf) - { - cpf = new string(cpf.Where(char.IsDigit).ToArray()); - if (cpf.Length != 11) return false; - if (cpf.All(c => c == cpf[0])) return false; - - int soma1 = 0; - for (int i = 0; i < 9; i++) soma1 += int.Parse(cpf[i].ToString()) * (10 - i); - int resto1 = soma1 % 11; - int digito1 = (resto1 < 2) ? 0 : 11 - resto1; - if (digito1 != int.Parse(cpf[9].ToString())) return false; - - int soma2 = 0; - for (int i = 0; i < 10; i++) soma2 += int.Parse(cpf[i].ToString()) * (11 - i); - int resto2 = soma2 % 11; - int digito2 = (resto2 < 2) ? 0 : 11 - resto2; - return digito2 == int.Parse(cpf[10].ToString()); - } - } -} diff --git a/Prova2_Henrique/Prova/Presentation/Controllers/MarcasController.cs b/Prova2_Henrique/Prova/Controllers/MarcasController.cs similarity index 94% rename from Prova2_Henrique/Prova/Presentation/Controllers/MarcasController.cs rename to Prova2_Henrique/Prova/Controllers/MarcasController.cs index 1f73dea..7f24f66 100644 --- a/Prova2_Henrique/Prova/Presentation/Controllers/MarcasController.cs +++ b/Prova2_Henrique/Prova/Controllers/MarcasController.cs @@ -1,10 +1,10 @@ using Microsoft.AspNetCore.Mvc; -using Prova.Models; -using Prova.Services; +using Core.Models; +using Core.Services; using System.Collections.Generic; using System.Threading.Tasks; -namespace Prova.Controllers +namespace Core.Controllers { [Route("api/[controller]")] [ApiController] diff --git a/Prova2_Henrique/Prova/Presentation/Controllers/ProduotsController.cs b/Prova2_Henrique/Prova/Controllers/ProduotsController.cs similarity index 96% rename from Prova2_Henrique/Prova/Presentation/Controllers/ProduotsController.cs rename to Prova2_Henrique/Prova/Controllers/ProduotsController.cs index df396cf..5d3caf0 100644 --- a/Prova2_Henrique/Prova/Presentation/Controllers/ProduotsController.cs +++ b/Prova2_Henrique/Prova/Controllers/ProduotsController.cs @@ -1,10 +1,10 @@ using Microsoft.AspNetCore.Mvc; -using Prova.Models; -using Prova.Services; +using Core.Models; +using Core.Services; using System.Collections.Generic; using System.Threading.Tasks; -namespace Prova.Controllers +namespace Core.Controllers { [Route("api/[controller]")] [ApiController] diff --git a/Prova2_Henrique/Prova/Presentation/Controllers/UsuarioController.cs b/Prova2_Henrique/Prova/Controllers/UsuarioController.cs similarity index 96% rename from Prova2_Henrique/Prova/Presentation/Controllers/UsuarioController.cs rename to Prova2_Henrique/Prova/Controllers/UsuarioController.cs index f66962c..86ca82c 100644 --- a/Prova2_Henrique/Prova/Presentation/Controllers/UsuarioController.cs +++ b/Prova2_Henrique/Prova/Controllers/UsuarioController.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore.Mvc; -using Prova.DTOs; -using Prova.Models; -using Prova.Services; +using Core.DTOs; +using Core.Models; +using Core.Services; -namespace Prova.Controllers +namespace Core.Controllers { [ApiController] [Route("api/[controller]")] diff --git a/Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs b/Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs deleted file mode 100644 index ff2247a..0000000 --- a/Prova2_Henrique/Prova/Core/DTO/EnderecoDTO.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Prova.DTOs -{ - public class EnderecoDTO - { - public string Cidade { get; set; } = string.Empty; - public string Estado { get; set; } = string.Empty; - public string Cep { get; set; } = string.Empty; - public int UsuarioId { get; set; } - } -} \ No newline at end of file diff --git a/Prova2_Henrique/Prova/Core/DTO/UsuarioAtualizacaoDTO.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioAtualizacaoDTO.cs deleted file mode 100644 index 7e07675..0000000 --- a/Prova2_Henrique/Prova/Core/DTO/UsuarioAtualizacaoDTO.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using Prova.Models; - -namespace Prova.DTOs -{ - public class UsuarioAtualizacaoDTO - { - public string Nome { get; set; } = string.Empty; - public string Sobrenome { get; set; } = string.Empty; - public string Telefone { get; set; } = string.Empty; - public string Senha { get; set; } = string.Empty; - - public List Enderecos { get; set; } = new List(); - - public UsuarioAtualizacaoDTO(string nome, string sobrenome, string telefone, string senha) - { - Nome = nome; - Sobrenome = sobrenome; - Telefone = telefone; - Senha = senha; - } - } -} diff --git a/Prova2_Henrique/Prova/Core/DTO/UsuarioCadastroDTO.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioCadastroDTO.cs deleted file mode 100644 index cebcf0c..0000000 --- a/Prova2_Henrique/Prova/Core/DTO/UsuarioCadastroDTO.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; -using Prova.Models; - -namespace Prova.DTOs -{ - public class UsuarioCadastroDTO - { - public string Nome { get; set; } = string.Empty; - public string Sobrenome { get; set; } = string.Empty; - public string Telefone { get; set; } = string.Empty; - public string Senha { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public string Cpf { get; set; } = string.Empty; - - [NotMapped] - [JsonIgnore] - public IFormFile? Imagem { get; set; } - - public List Enderecos { get; set; } = new List(); - - } -} diff --git a/Prova2_Henrique/Prova/Core/DTO/UsuarioComToken.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioComToken.cs deleted file mode 100644 index d05c7e2..0000000 --- a/Prova2_Henrique/Prova/Core/DTO/UsuarioComToken.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Prova.DTO -{ - public class UsuarioComToken - { - public string Token { get; set; } - public Usuario Usuario { get; set; } - } - -} diff --git a/Prova2_Henrique/Prova/Core/DTO/UsuarioRespostaDTO.cs b/Prova2_Henrique/Prova/Core/DTO/UsuarioRespostaDTO.cs deleted file mode 100644 index 88b1883..0000000 --- a/Prova2_Henrique/Prova/Core/DTO/UsuarioRespostaDTO.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Prova.Models; - -namespace Prova.Services -{ - internal class UsuarioRespostaDTO - { - public int Id { get; set; } - public string Nome { get; set; } - public string Sobrenome { get; set; } - public string Telefone { get; set; } - public string Email { get; set; } - public string Cpf { get; set; } - public List Enderecos { get; set; } - public string ImagemBase64 { get; set; } - public string Token { get; set; } - } -} \ No newline at end of file diff --git a/Prova2_Henrique/Prova/Core/Models/Endereco.cs b/Prova2_Henrique/Prova/Core/Models/Endereco.cs deleted file mode 100644 index 56bb3e5..0000000 --- a/Prova2_Henrique/Prova/Core/Models/Endereco.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; - -namespace Prova.Models { - public class Endereco { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [JsonIgnore] - public int Id { get; set; } - - public string? Cep { get; set; } - public string? Cidade { get; set; } - public string? Estado { get; set; } - - [JsonIgnore] - public int UsuarioId { get; set; } - - [JsonIgnore] - public Usuario? Usuario { get; set; } - - public Endereco() { } - - public Endereco(string cep, string cidade, string estado) { - Cep = cep; - Cidade = cidade; - Estado = estado; - } - } -} diff --git a/Prova2_Henrique/Prova/Core/Models/Marca.cs b/Prova2_Henrique/Prova/Core/Models/Marca.cs deleted file mode 100644 index 4488bd9..0000000 --- a/Prova2_Henrique/Prova/Core/Models/Marca.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Text.Json.Serialization; - -namespace Prova.Models -{ - public class Marca - { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [JsonIgnore] - public int Id { get; set; } - - public string? Nome { get; set; } - - public Marca() { } - - public Marca(string nome) - { - Nome = nome; - } - } -} diff --git a/Prova2_Henrique/Prova/Core/Models/Produto.cs b/Prova2_Henrique/Prova/Core/Models/Produto.cs deleted file mode 100644 index 3112d52..0000000 --- a/Prova2_Henrique/Prova/Core/Models/Produto.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Prova.Models -{ - public class Produto - { - [Key] - [JsonIgnore] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } - - public string Nome { get; set; } = string.Empty; - public string Descricao { get; set; } = string.Empty; - public string Preco { get; set; } = string.Empty; - - public int IdMarca { get; set; } - - [ForeignKey("IdMarca")] - public Marca? Marca { get; set; } - - public Produto() { } - - public Produto(string nome, string descricao, string preco, Marca marca) - { - Nome = nome; - Descricao = descricao; - Preco = preco; - Marca = marca ?? throw new ArgumentNullException(nameof(marca)); - } - - } -} diff --git a/Prova2_Henrique/Prova/Core/Models/Usuario.cs b/Prova2_Henrique/Prova/Core/Models/Usuario.cs deleted file mode 100644 index 1e813c0..0000000 --- a/Prova2_Henrique/Prova/Core/Models/Usuario.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Prova.Models; -using System.ComponentModel.DataAnnotations.Schema; -using System.ComponentModel.DataAnnotations; -using System.Text.Json.Serialization; -using Swashbuckle.AspNetCore.Annotations; - -public class Usuario -{ - [Key] - [JsonIgnore] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - - public int Id { get; set; } - - public string Nome { get; set; } = string.Empty; - public string Sobrenome { get; set; } = string.Empty; - public string Telefone { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public string Senha { get; set; } = string.Empty; - - public string Cpf { get; set; } = string.Empty; - public List Enderecos { get; set; } = new List(); - public DateTime DataNascimento { get; set; } - - [NotMapped] - [JsonIgnore] - public IFormFile? Imagem { get; set; } - - [NotMapped] - public string ImagemBase64 { get; set; } = string.Empty; - - - public Usuario() { } - - public Usuario(string nome, string sobrenome, string telefone, string email, string senha, DateTime dataNascimento, string cpf) - { - Nome = nome; - Sobrenome = sobrenome; - Telefone = telefone; - Email = email; - Senha = senha; - DataNascimento = dataNascimento; - Cpf = cpf; - } -} diff --git a/Prova2_Henrique/Prova/Core/Repositories/EnderecoRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/EnderecoRepository.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs deleted file mode 100644 index 23ba020..0000000 --- a/Prova2_Henrique/Prova/Core/Repositories/MarcaRepository.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Prova.Models; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; -using Prova.Infrastructure.Repositories.Data; - -namespace Prova.Repositories -{ - public class MarcaRepository - { - private readonly AppDbContext _context; - - public MarcaRepository(AppDbContext context) - { - _context = context; - } - - public async Task> GetAllAsync() - { - return await _context.Marcas.ToListAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _context.Marcas.FindAsync(id); - } - - public async Task AddAsync(Marca marca) - { - _context.Marcas.Add(marca); - await _context.SaveChangesAsync(); - return marca; - } - - } -} \ No newline at end of file diff --git a/Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs deleted file mode 100644 index 51ad2e2..0000000 --- a/Prova2_Henrique/Prova/Core/Repositories/ProdutoRepository.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Prova.Models; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; -using Prova.Infrastructure.Repositories.Data; - -namespace Prova.Repositories -{ - public class ProdutoRepository - { - private readonly AppDbContext _context; - - public ProdutoRepository(AppDbContext context) - { - _context = context; - } - - public async Task> GetAllAsync() - { - return await _context.Produtos.Include(p => p.Marca).ToListAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _context.Produtos.Include(p => p.Marca).FirstOrDefaultAsync(p => p.Id == id); - } - - public async Task AddAsync(Produto produto) - { - _context.Produtos.Add(produto); - await _context.SaveChangesAsync(); - return produto; - } - - public async Task DeleteAllAsync() - { - var produtos = await _context.Produtos.ToListAsync(); - if (produtos != null && produtos.Count > 0) - { - _context.Produtos.RemoveRange(produtos); - await _context.SaveChangesAsync(); - } - } - - public async Task UpdateByNameAsync(string nome, Produto produtoAtualizado) - { - var produtoExistente = await _context.Produtos.FirstOrDefaultAsync(p => p.Nome == nome); - - if (produtoExistente == null) - { - return null; - } - - produtoExistente.Nome = produtoAtualizado.Nome; - produtoExistente.Descricao = produtoAtualizado.Descricao; - produtoExistente.Preco = produtoAtualizado.Preco; - - - await _context.SaveChangesAsync(); - - return produtoExistente; - } - } -} diff --git a/Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs b/Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs deleted file mode 100644 index fd52e8a..0000000 --- a/Prova2_Henrique/Prova/Core/Repositories/UsuarioRepository.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Prova.Infrastructure.Repositories.Data; -using Prova.Models; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Prova.Repositories -{ - public class UsuarioRepository - { - private readonly AppDbContext _context; - - public UsuarioRepository(AppDbContext context) - { - _context = context; - } - - public async Task> GetAllAsync() - { - return await _context.Usuarios.ToListAsync(); - } - - public async Task GetByEmailAsync(string email) - { - return await _context.Usuarios - .Include(u => u.Enderecos) - .FirstOrDefaultAsync(u => u.Email == email); - } - - public async Task AddAsync(Usuario usuario) - { - await _context.Usuarios.AddAsync(usuario); - await _context.SaveChangesAsync(); - return usuario; - } - - public async Task UpdateAsync(Usuario usuario) - { - _context.Usuarios.Update(usuario); - await _context.SaveChangesAsync(); - } - - public async Task DeleteAsync(int id) - { - var usuario = await _context.Usuarios.FindAsync(id); - if (usuario != null) - { - _context.Usuarios.Remove(usuario); - await _context.SaveChangesAsync(); - } - } - } -} diff --git a/Prova2_Henrique/Prova/Core/Services/EnderecoService.cs b/Prova2_Henrique/Prova/Core/Services/EnderecoService.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs b/Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs deleted file mode 100644 index e1d085a..0000000 --- a/Prova2_Henrique/Prova/Core/Services/JwtTokenService.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.IdentityModel.Tokens; -using System.IdentityModel.Tokens.Jwt; -using System.Security.Claims; -using System.Text; - -namespace Prova.Services -{ - public class JwtService - { - private const string _secretKey = "minha-chave-secreta-de-assinatura"; - private const string _issuer = "meu-sistema"; - private const string _audience = "meu-cliente"; - - public string GerarToken(string usuario, string email) - { - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_secretKey)); - var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - - var claims = new[] - { - new Claim(JwtRegisteredClaimNames.Sub, usuario), - new Claim(JwtRegisteredClaimNames.Email, email), - new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) - }; - - var token = new JwtSecurityToken( - issuer: _issuer, - audience: _audience, - claims: claims, - expires: DateTime.Now.AddHours(10), - signingCredentials: credentials - ); - - var tokenHandler = new JwtSecurityTokenHandler(); - return tokenHandler.WriteToken(token); - } - - public string ValidarToken(string token) - { - var tokenHandler = new JwtSecurityTokenHandler(); - var key = Encoding.UTF8.GetBytes(_secretKey); - - try - { - var principal = tokenHandler.ValidateToken(token, new TokenValidationParameters - { - ValidateIssuer = true, - ValidateAudience = true, - ValidateLifetime = true, - ValidateIssuerSigningKey = true, - IssuerSigningKey = new SymmetricSecurityKey(key), - ValidIssuer = _issuer, - ValidAudience = _audience - }, out var validatedToken); - - return "Token é válido."; - } - catch (SecurityTokenExpiredException) - { - return "Token expirado."; - } - catch (SecurityTokenException) - { - return "Token inválido."; - } - catch (Exception) - { - return "Erro ao validar o token."; - } - } - } -} diff --git a/Prova2_Henrique/Prova/Core/Services/MarcaService.cs b/Prova2_Henrique/Prova/Core/Services/MarcaService.cs deleted file mode 100644 index 890942d..0000000 --- a/Prova2_Henrique/Prova/Core/Services/MarcaService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Prova.Repositories; -using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Prova.Services -{ - public class MarcaService - { - private readonly MarcaRepository _marcaRepository; - - public MarcaService(MarcaRepository marcaRepository) - { - _marcaRepository = marcaRepository; - } - - public async Task> GetAllAsync() - { - return await _marcaRepository.GetAllAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _marcaRepository.GetByIdAsync(id); - } - - public async Task AddAsync(Marca marca) - { - return await _marcaRepository.AddAsync(marca); - } - } -} diff --git a/Prova2_Henrique/Prova/Core/Services/ProdutoService.cs b/Prova2_Henrique/Prova/Core/Services/ProdutoService.cs deleted file mode 100644 index 8d8473d..0000000 --- a/Prova2_Henrique/Prova/Core/Services/ProdutoService.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Prova.Repositories; -using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Prova.Services -{ - public class ProdutoService - { - private readonly ProdutoRepository _produtoRepository; - - public ProdutoService(ProdutoRepository produtoRepository) - { - _produtoRepository = produtoRepository; - } - - public async Task> GetAllAsync() - { - return await _produtoRepository.GetAllAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _produtoRepository.GetByIdAsync(id); - } - - public async Task AddAsync(Produto produto) - { - return await _produtoRepository.AddAsync(produto); - } - - public async Task DeleteAllAsync() - { - await _produtoRepository.DeleteAllAsync(); - } - public async Task UpdateByNameAsync(string nome, Produto produtoAtualizado) - { - if (string.IsNullOrWhiteSpace(nome) || produtoAtualizado == null) - { - return null; - } - - return await _produtoRepository.UpdateByNameAsync(nome, produtoAtualizado); - } - - - } -} diff --git a/Prova2_Henrique/Prova/Core/Services/UsuarioService.cs b/Prova2_Henrique/Prova/Core/Services/UsuarioService.cs deleted file mode 100644 index 455ac71..0000000 --- a/Prova2_Henrique/Prova/Core/Services/UsuarioService.cs +++ /dev/null @@ -1,139 +0,0 @@ -using Prova.Repositories; -using Prova.Models; -using System.Collections.Generic; -using System.Threading.Tasks; -using Prova.DTOs; -using Prova.DTO; - -namespace Prova.Services -{ - public class UsuarioService - { - private readonly UsuarioRepository _usuarioRepository; - private readonly JwtService _jwtService; - - public UsuarioService(UsuarioRepository usuarioRepository, JwtService jwtService) - { - _usuarioRepository = usuarioRepository; - _jwtService = jwtService; - } - - public async Task CriarUsuario(UsuarioCadastroDTO usuarioDto) - { - if (usuarioDto == null) - throw new ArgumentException("Dados do usuário não fornecidos."); - - if (!ValidarCPF(usuarioDto.Cpf)) - throw new ArgumentException("CPF inválido."); - - var emailExistente = await _usuarioRepository.GetByEmailAsync(usuarioDto.Email); - if (emailExistente != null) - throw new InvalidOperationException("Já existe um usuário com este email."); - - var usuario = new Usuario - { - Nome = usuarioDto.Nome, - Sobrenome = usuarioDto.Sobrenome, - Telefone = usuarioDto.Telefone, - Senha = usuarioDto.Senha, - Cpf = usuarioDto.Cpf, - Email = usuarioDto.Email, - }; - - if (usuarioDto.Imagem != null) - { - using (var memoryStream = new MemoryStream()) - { - await usuarioDto.Imagem.CopyToAsync(memoryStream); - usuario.ImagemBase64 = Convert.ToBase64String(memoryStream.ToArray()); - } - } - - var usuarioCriado = await _usuarioRepository.AddAsync(usuario); - - var token = _jwtService.GerarToken(usuarioCriado.Nome, usuarioCriado.Email); - - return new UsuarioComToken - { - Token = token, - Usuario = usuarioCriado - }; - } - - - - public async Task AtualizarUsuario(string email, UsuarioAtualizacaoDTO usuarioAtualizado) - { - var usuarioExistente = await _usuarioRepository.GetByEmailAsync(email); - if (usuarioExistente == null) - throw new InvalidOperationException("Usuário não encontrado."); - - usuarioExistente.Nome = usuarioAtualizado.Nome; - usuarioExistente.Sobrenome = usuarioAtualizado.Sobrenome; - usuarioExistente.Telefone = usuarioAtualizado.Telefone; - usuarioExistente.Senha = usuarioAtualizado.Senha; - - if (usuarioAtualizado.Enderecos != null && usuarioAtualizado.Enderecos.Count > 0) - { - var enderecosExistentes = usuarioExistente.Enderecos.ToList(); - usuarioExistente.Enderecos.Clear(); - foreach (var enderecoDTO in usuarioAtualizado.Enderecos) - { - var endereco = new Endereco - { - Cep = enderecoDTO.Cep, - Cidade = enderecoDTO.Cidade, - Estado = enderecoDTO.Estado, - UsuarioId = usuarioExistente.Id - }; - usuarioExistente.Enderecos.Add(endereco); - } - } - - await _usuarioRepository.UpdateAsync(usuarioExistente); - } - - public async Task AutenticarUsuario(string email, string senha, string token) - { - if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(senha)) - throw new ArgumentException("Email e senha são obrigatórios."); - - var usuario = await _usuarioRepository.GetByEmailAsync(email); - if (usuario == null || usuario.Senha != senha) - throw new InvalidOperationException("Email ou senha inválidos."); - - string tokenStatus = _jwtService.ValidarToken(token); - - return new Usuario - { - Id = usuario.Id, - Nome = usuario.Nome, - Sobrenome = usuario.Sobrenome, - Telefone = usuario.Telefone, - Email = usuario.Email, - Cpf = usuario.Cpf, - Enderecos = usuario.Enderecos, - ImagemBase64 = usuario.ImagemBase64, - }; - } - - private bool ValidarCPF(string cpf) - { - cpf = new string(cpf.Where(char.IsDigit).ToArray()); - if (cpf.Length != 11) return false; - if (cpf.All(c => c == cpf[0])) return false; - - int soma1 = 0; - for (int i = 0; i < 9; i++) soma1 += int.Parse(cpf[i].ToString()) * (10 - i); - int resto1 = soma1 % 11; - int digito1 = (resto1 < 2) ? 0 : 11 - resto1; - if (digito1 != int.Parse(cpf[9].ToString())) return false; - - int soma2 = 0; - for (int i = 0; i < 10; i++) soma2 += int.Parse(cpf[i].ToString()) * (11 - i); - int resto2 = soma2 % 11; - int digito2 = (resto2 < 2) ? 0 : 11 - resto2; - return digito2 == int.Parse(cpf[10].ToString()); - } - } -} diff --git a/Prova2_Henrique/Prova/Core/core.csproj b/Prova2_Henrique/Prova/Core/core.csproj deleted file mode 100644 index 39ae10d..0000000 --- a/Prova2_Henrique/Prova/Core/core.csproj +++ /dev/null @@ -1,6 +0,0 @@ -namespace Prova.Core -{ - public class Class - { - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/.DS_Store b/Prova2_Henrique/Prova/Infrastructure/.DS_Store deleted file mode 100644 index f3057484833f4648be1aa89590b71c8b8a24b490..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKOHRWu5FNJ_6wyVOU78i^F4%`ET%f%`6jBN(ArXarB#yu(SaOP<2Z;;t#$z?H z(pGFh2+c_2=gi0ByhNFph|KIcn-YzQXb5HOonY7@>}Tyr&s#=7!)r_z*JV+4;?(eW z8Q^EvrZr#0UE}2~t#)0cAiL_%R01vss3xf;uV#%78MkWq`jA7RnfTtOebt1A{vP0QqOp z3Fds3;2i5Q@>mPP12K{clvLx77)H`zw>~cNSPM!z8CMzW_{zqgP>ib%yLI7YB0(LM z0c9X$pf8tW?*CW&&;MbPUMU00z`tU^4B|yR!!7yV+POLIwHBH{Svam1+@@gSS}|g| d6;Gf}V7EL0MjmTHSRnc%;Aqf68TeHOz5qDZW7Gfu diff --git a/Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj b/Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj deleted file mode 100644 index fb8ce65..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Infrastructure.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net8.0 - enable - enable - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs deleted file mode 100644 index 5bc563a..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/AppDbContext.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Prova.Models; - -namespace Prova.Infrastructure.Repositories.Data -{ - public class AppDbContext : DbContext - { - public DbSet Usuarios { get; set; } - public DbSet Enderecos { get; set; } - public DbSet Marcas { get; set; } - public DbSet Produtos { get; set; } - - public AppDbContext(DbContextOptions options) : base(options) - { - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity() - .HasOne(e => e.Usuario) - .WithMany(u => u.Enderecos) - .HasForeignKey(e => e.UsuarioId); - - modelBuilder.Entity() - .Property(e => e.Id) - .ValueGeneratedOnAdd(); - - modelBuilder.Entity() - .HasOne() - .WithMany() - .HasForeignKey(p => p.IdMarca) - .OnDelete(DeleteBehavior.Cascade); - - modelBuilder.Entity() - .Property(m => m.Id) - .ValueGeneratedOnAdd(); - - modelBuilder.Entity() - .Property(p => p.Id) - .ValueGeneratedOnAdd(); - - - base.OnModelCreating(modelBuilder); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs deleted file mode 100644 index 9df47ac..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241023181253_InitialCreate")] - partial class InitialCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.cs deleted file mode 100644 index b1f186e..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023181253_InitialCreate.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class InitialCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Usuarios", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: false), - Sobrenome = table.Column(type: "nvarchar(max)", nullable: false), - Telefone = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Senha = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Usuarios", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Enderecos", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Cep = table.Column(type: "nvarchar(max)", nullable: false), - Cidade = table.Column(type: "nvarchar(max)", nullable: false), - Estado = table.Column(type: "nvarchar(max)", nullable: false), - UsuarioId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Enderecos", x => x.Id); - table.ForeignKey( - name: "FK_Enderecos_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Enderecos_UsuarioId", - table: "Enderecos", - column: "UsuarioId"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Enderecos"); - - migrationBuilder.DropTable( - name: "Usuarios"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs deleted file mode 100644 index ab73fe5..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241023182454_AjusteEndereco")] - partial class AjusteEndereco - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.cs deleted file mode 100644 index 775a1da..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023182454_AjusteEndereco.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class AjusteEndereco : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs deleted file mode 100644 index c925804..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241023183035_AlterEnderecoIdGeneration")] - partial class AlterEnderecoIdGeneration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.cs deleted file mode 100644 index cf8267a..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241023183035_AlterEnderecoIdGeneration.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class AlterEnderecoIdGeneration : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs deleted file mode 100644 index 32be257..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.Designer.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241101235914_NomeDaMigration")] - partial class NomeDaMigration - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.cs deleted file mode 100644 index b09ed19..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241101235914_NomeDaMigration.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class NomeDaMigration : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "DataNascimento", - table: "Usuarios", - type: "datetime2", - nullable: false, - defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); - - migrationBuilder.AlterColumn( - name: "Estado", - table: "Enderecos", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Cidade", - table: "Enderecos", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AlterColumn( - name: "Cep", - table: "Enderecos", - type: "nvarchar(max)", - nullable: true, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DataNascimento", - table: "Usuarios"); - - migrationBuilder.AlterColumn( - name: "Estado", - table: "Enderecos", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Cidade", - table: "Enderecos", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "Cep", - table: "Enderecos", - type: "nvarchar(max)", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "nvarchar(max)", - oldNullable: true); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs deleted file mode 100644 index 5d4d6b4..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.Designer.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241118214851_secondCreate")] - partial class secondCreate - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.10") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.cs deleted file mode 100644 index 216cf8a..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241118214851_secondCreate.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - public partial class secondCreate : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Marcas", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Marcas", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Produtos", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: false), - Descricao = table.Column(type: "nvarchar(max)", nullable: false), - Preco = table.Column(type: "nvarchar(max)", nullable: false), - IdMarca = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Produtos", x => x.Id); - table.ForeignKey( - name: "FK_Produtos_Marcas_IdMarca", - column: x => x.IdMarca, - principalTable: "Marcas", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Produtos_IdMarca", - table: "Produtos", - column: "IdMarca"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Produtos"); - - migrationBuilder.DropTable( - name: "Marcas"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs deleted file mode 100644 index 2a5b7f9..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.Designer.cs +++ /dev/null @@ -1,175 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241127022231_produtos")] - partial class produtos - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.cs deleted file mode 100644 index 6b84e63..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127022231_produtos.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class produtos : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "MarcaId", - table: "Produtos", - type: "int", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Produtos_MarcaId", - table: "Produtos", - column: "MarcaId"); - - migrationBuilder.AddForeignKey( - name: "FK_Produtos_Marcas_MarcaId", - table: "Produtos", - column: "MarcaId", - principalTable: "Marcas", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Produtos_Marcas_MarcaId", - table: "Produtos"); - - migrationBuilder.DropIndex( - name: "IX_Produtos_MarcaId", - table: "Produtos"); - - migrationBuilder.DropColumn( - name: "MarcaId", - table: "Produtos"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs deleted file mode 100644 index 68ddca7..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.Designer.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241127171458_lista")] - partial class lista - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProdutoId") - .HasColumnType("int"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProdutoId"); - - b.HasIndex("UsuarioId"); - - b.ToTable("ListaDeProdutosPorClientes"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.HasOne("Prova.Models.Produto", "Produto") - .WithMany() - .HasForeignKey("ProdutoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany() - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Produto"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.cs deleted file mode 100644 index 63fea38..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127171458_lista.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class lista : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ListaDeProdutosPorClientes", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - UsuarioId = table.Column(type: "int", nullable: false), - ProdutoId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ListaDeProdutosPorClientes", x => x.Id); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Produtos_ProdutoId", - column: x => x.ProdutoId, - principalTable: "Produtos", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_ProdutoId", - table: "ListaDeProdutosPorClientes", - column: "ProdutoId"); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_UsuarioId", - table: "ListaDeProdutosPorClientes", - column: "UsuarioId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ListaDeProdutosPorClientes"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs deleted file mode 100644 index 6db4de5..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.Designer.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241127193747_funcionapfv")] - partial class funcionapfv - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ProdutoId") - .HasColumnType("int"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ProdutoId"); - - b.HasIndex("UsuarioId"); - - b.ToTable("ListaDeProdutosPorClientes"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.listaDeProdutosPorCliente", b => - { - b.HasOne("Prova.Models.Produto", "Produto") - .WithMany() - .HasForeignKey("ProdutoId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany() - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Produto"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.cs deleted file mode 100644 index 7e8ee82..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241127193747_funcionapfv.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class funcionapfv : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs deleted file mode 100644 index df03ce3..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129060230_atualizandoUsuario")] - partial class atualizandoUsuario - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Imagem") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.cs deleted file mode 100644 index 273f33f..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129060230_atualizandoUsuario.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class atualizandoUsuario : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ListaDeProdutosPorClientes"); - - migrationBuilder.AddColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Imagem", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Cpf", - table: "Usuarios"); - - migrationBuilder.DropColumn( - name: "Imagem", - table: "Usuarios"); - - migrationBuilder.CreateTable( - name: "ListaDeProdutosPorClientes", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ProdutoId = table.Column(type: "int", nullable: false), - UsuarioId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ListaDeProdutosPorClientes", x => x.Id); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Produtos_ProdutoId", - column: x => x.ProdutoId, - principalTable: "Produtos", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ListaDeProdutosPorClientes_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_ProdutoId", - table: "ListaDeProdutosPorClientes", - column: "ProdutoId"); - - migrationBuilder.CreateIndex( - name: "IX_ListaDeProdutosPorClientes_UsuarioId", - table: "ListaDeProdutosPorClientes", - column: "UsuarioId"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs deleted file mode 100644 index ba9e305..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129071042_mudandoOTipoDaImagem")] - partial class mudandoOTipoDaImagem - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.cs deleted file mode 100644 index d59ec10..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071042_mudandoOTipoDaImagem.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaImagem : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Imagem", - table: "Usuarios", - newName: "ImagemUrl"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ImagemUrl", - table: "Usuarios", - newName: "Imagem"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs deleted file mode 100644 index 356ef66..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129071811_mudandoOTipoDaIamgemNovamente")] - partial class mudandoOTipoDaIamgemNovamente - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs deleted file mode 100644 index fe44e0b..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs deleted file mode 100644 index 0fbe598..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129072043_mudandoOTipoDaIamgemNovamente2")] - partial class mudandoOTipoDaIamgemNovamente2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Imagem") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs deleted file mode 100644 index 6c43546..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ImagemUrl", - table: "Usuarios", - newName: "Imagem"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Imagem", - table: "Usuarios", - newName: "ImagemUrl"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs deleted file mode 100644 index 9d9a864..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129072432_mudandoOTipoDaIamgemNovamente3")] - partial class mudandoOTipoDaIamgemNovamente3 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemUrl") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs deleted file mode 100644 index 42644a2..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Imagem", - table: "Usuarios", - newName: "ImagemUrl"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "ImagemUrl", - table: "Usuarios", - newName: "Imagem"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs deleted file mode 100644 index 7ea1a68..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129073354_mudandoOTipoDaIamgemNovamente5")] - partial class mudandoOTipoDaIamgemNovamente5 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs deleted file mode 100644 index 94e283a..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente5 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ImagemUrl", - table: "Usuarios"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ImagemUrl", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs deleted file mode 100644 index 87ca2e2..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129073810_mudandoOTipoDaIamgemNovamente7")] - partial class mudandoOTipoDaIamgemNovamente7 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs deleted file mode 100644 index c1df9a1..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente7 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "ImagemBase64", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ImagemBase64", - table: "Usuarios"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs deleted file mode 100644 index 9159d67..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs +++ /dev/null @@ -1,184 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129074050_mudandoOTipoDaIamgemNovamente8")] - partial class mudandoOTipoDaIamgemNovamente8 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(11) - .HasColumnType("nvarchar(11)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Prova.Models.Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Prova.Models.Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs deleted file mode 100644 index d64ff07..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente8 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs deleted file mode 100644 index 4f5bede..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129080256_mudandoOTipoDaIamgemNovamente10")] - partial class mudandoOTipoDaIamgemNovamente10 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs deleted file mode 100644 index 5fd21c9..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente10 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs deleted file mode 100644 index de37558..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs +++ /dev/null @@ -1,183 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129081217_mudandoOTipoDaIamgemNovamente12")] - partial class mudandoOTipoDaIamgemNovamente12 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs deleted file mode 100644 index 7857f13..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente12 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs deleted file mode 100644 index fddb075..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs +++ /dev/null @@ -1,184 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129081646_mudandoOTipoDaIamgemNovamente13")] - partial class mudandoOTipoDaIamgemNovamente13 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(11) - .HasColumnType("nvarchar(11)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ImagemBase64") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs deleted file mode 100644 index 5605ef4..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente13 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs deleted file mode 100644 index 7665634..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129082124_mudandoOTipoDaIamgemNovamente15")] - partial class mudandoOTipoDaIamgemNovamente15 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs deleted file mode 100644 index 02bc1b0..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente15 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ImagemBase64", - table: "Usuarios"); - - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(11)", - oldMaxLength: 11); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "Cpf", - table: "Usuarios", - type: "nvarchar(11)", - maxLength: 11, - nullable: false, - oldClrType: typeof(string), - oldType: "nvarchar(max)"); - - migrationBuilder.AddColumn( - name: "ImagemBase64", - table: "Usuarios", - type: "nvarchar(max)", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs deleted file mode 100644 index 017bf51..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129083237_mudandoOTipoDaIamgemNovamente18")] - partial class mudandoOTipoDaIamgemNovamente18 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs deleted file mode 100644 index 193de1f..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class mudandoOTipoDaIamgemNovamente18 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Marcas", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Marcas", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Usuarios", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: false), - Sobrenome = table.Column(type: "nvarchar(max)", nullable: false), - Telefone = table.Column(type: "nvarchar(max)", nullable: false), - Email = table.Column(type: "nvarchar(max)", nullable: false), - Senha = table.Column(type: "nvarchar(max)", nullable: false), - Cpf = table.Column(type: "nvarchar(max)", nullable: false), - DataNascimento = table.Column(type: "datetime2", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Usuarios", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Produtos", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Nome = table.Column(type: "nvarchar(max)", nullable: false), - Descricao = table.Column(type: "nvarchar(max)", nullable: false), - Preco = table.Column(type: "nvarchar(max)", nullable: false), - IdMarca = table.Column(type: "int", nullable: false), - MarcaId = table.Column(type: "int", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Produtos", x => x.Id); - table.ForeignKey( - name: "FK_Produtos_Marcas_IdMarca", - column: x => x.IdMarca, - principalTable: "Marcas", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Produtos_Marcas_MarcaId", - column: x => x.MarcaId, - principalTable: "Marcas", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Enderecos", - columns: table => new - { - Id = table.Column(type: "int", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Cep = table.Column(type: "nvarchar(max)", nullable: true), - Cidade = table.Column(type: "nvarchar(max)", nullable: true), - Estado = table.Column(type: "nvarchar(max)", nullable: true), - UsuarioId = table.Column(type: "int", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Enderecos", x => x.Id); - table.ForeignKey( - name: "FK_Enderecos_Usuarios_UsuarioId", - column: x => x.UsuarioId, - principalTable: "Usuarios", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Enderecos_UsuarioId", - table: "Enderecos", - column: "UsuarioId"); - - migrationBuilder.CreateIndex( - name: "IX_Produtos_IdMarca", - table: "Produtos", - column: "IdMarca"); - - migrationBuilder.CreateIndex( - name: "IX_Produtos_MarcaId", - table: "Produtos", - column: "MarcaId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Enderecos"); - - migrationBuilder.DropTable( - name: "Produtos"); - - migrationBuilder.DropTable( - name: "Usuarios"); - - migrationBuilder.DropTable( - name: "Marcas"); - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs deleted file mode 100644 index 955e0f0..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs +++ /dev/null @@ -1,179 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - [Migration("20241129173606_NomeDaMigration1221212")] - partial class NomeDaMigration1221212 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.cs deleted file mode 100644 index 54fb2c5..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/20241129173606_NomeDaMigration1221212.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Prova.Migrations -{ - /// - public partial class NomeDaMigration1221212 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs deleted file mode 100644 index 7001347..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/Data/Migrations/AppDbContextModelSnapshot.cs +++ /dev/null @@ -1,176 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Prova.Infrastructure.Repositories.Data; - -#nullable disable - -namespace Prova.Migrations -{ - [DbContext(typeof(AppDbContext))] - partial class AppDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cep") - .HasColumnType("nvarchar(max)"); - - b.Property("Cidade") - .HasColumnType("nvarchar(max)"); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("UsuarioId") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("UsuarioId"); - - b.ToTable("Enderecos"); - }); - - modelBuilder.Entity("Prova.Models.Marca", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Nome") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Marcas"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Descricao") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("MarcaId") - .HasColumnType("int"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Preco") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("IdMarca"); - - b.HasIndex("MarcaId"); - - b.ToTable("Produtos"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cpf") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("DataNascimento") - .HasColumnType("datetime2"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Nome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Senha") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Sobrenome") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Usuarios"); - }); - - modelBuilder.Entity("Prova.Models.Endereco", b => - { - b.HasOne("Usuario", "Usuario") - .WithMany("Enderecos") - .HasForeignKey("UsuarioId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Prova.Models.Produto", b => - { - b.HasOne("Prova.Models.Marca", null) - .WithMany() - .HasForeignKey("IdMarca") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Prova.Models.Marca", "Marca") - .WithMany() - .HasForeignKey("MarcaId"); - - b.Navigation("Marca"); - }); - - modelBuilder.Entity("Usuario", b => - { - b.Navigation("Enderecos"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/EnderecoRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/EnderecoRepository.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs deleted file mode 100644 index 23ba020..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/MarcaRepository.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Prova.Models; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; -using Prova.Infrastructure.Repositories.Data; - -namespace Prova.Repositories -{ - public class MarcaRepository - { - private readonly AppDbContext _context; - - public MarcaRepository(AppDbContext context) - { - _context = context; - } - - public async Task> GetAllAsync() - { - return await _context.Marcas.ToListAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _context.Marcas.FindAsync(id); - } - - public async Task AddAsync(Marca marca) - { - _context.Marcas.Add(marca); - await _context.SaveChangesAsync(); - return marca; - } - - } -} \ No newline at end of file diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs deleted file mode 100644 index 51ad2e2..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/ProdutoRepository.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Prova.Models; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; -using Prova.Infrastructure.Repositories.Data; - -namespace Prova.Repositories -{ - public class ProdutoRepository - { - private readonly AppDbContext _context; - - public ProdutoRepository(AppDbContext context) - { - _context = context; - } - - public async Task> GetAllAsync() - { - return await _context.Produtos.Include(p => p.Marca).ToListAsync(); - } - - public async Task GetByIdAsync(int id) - { - return await _context.Produtos.Include(p => p.Marca).FirstOrDefaultAsync(p => p.Id == id); - } - - public async Task AddAsync(Produto produto) - { - _context.Produtos.Add(produto); - await _context.SaveChangesAsync(); - return produto; - } - - public async Task DeleteAllAsync() - { - var produtos = await _context.Produtos.ToListAsync(); - if (produtos != null && produtos.Count > 0) - { - _context.Produtos.RemoveRange(produtos); - await _context.SaveChangesAsync(); - } - } - - public async Task UpdateByNameAsync(string nome, Produto produtoAtualizado) - { - var produtoExistente = await _context.Produtos.FirstOrDefaultAsync(p => p.Nome == nome); - - if (produtoExistente == null) - { - return null; - } - - produtoExistente.Nome = produtoAtualizado.Nome; - produtoExistente.Descricao = produtoAtualizado.Descricao; - produtoExistente.Preco = produtoAtualizado.Preco; - - - await _context.SaveChangesAsync(); - - return produtoExistente; - } - } -} diff --git a/Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs b/Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs deleted file mode 100644 index fd52e8a..0000000 --- a/Prova2_Henrique/Prova/Infrastructure/Repositories/UsuarioRepository.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Prova.Infrastructure.Repositories.Data; -using Prova.Models; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Prova.Repositories -{ - public class UsuarioRepository - { - private readonly AppDbContext _context; - - public UsuarioRepository(AppDbContext context) - { - _context = context; - } - - public async Task> GetAllAsync() - { - return await _context.Usuarios.ToListAsync(); - } - - public async Task GetByEmailAsync(string email) - { - return await _context.Usuarios - .Include(u => u.Enderecos) - .FirstOrDefaultAsync(u => u.Email == email); - } - - public async Task AddAsync(Usuario usuario) - { - await _context.Usuarios.AddAsync(usuario); - await _context.SaveChangesAsync(); - return usuario; - } - - public async Task UpdateAsync(Usuario usuario) - { - _context.Usuarios.Update(usuario); - await _context.SaveChangesAsync(); - } - - public async Task DeleteAsync(int id) - { - var usuario = await _context.Usuarios.FindAsync(id); - if (usuario != null) - { - _context.Usuarios.Remove(usuario); - await _context.SaveChangesAsync(); - } - } - } -} diff --git a/Prova2_Henrique/Prova/Presentation/Presentation.csproj b/Prova2_Henrique/Prova/Presentation/Presentation.csproj deleted file mode 100644 index 9772721..0000000 --- a/Prova2_Henrique/Prova/Presentation/Presentation.csproj +++ /dev/null @@ -1,6 +0,0 @@ -namespace Prova.Presentation -{ - public class Class - { - } -} diff --git a/Prova2_Henrique/Prova/Presentation/Program.cs b/Prova2_Henrique/Prova/Program.cs similarity index 94% rename from Prova2_Henrique/Prova/Presentation/Program.cs rename to Prova2_Henrique/Prova/Program.cs index 68e6d24..a339ab0 100644 --- a/Prova2_Henrique/Prova/Presentation/Program.cs +++ b/Prova2_Henrique/Prova/Program.cs @@ -1,7 +1,9 @@ +using Core.Repositories; +using Core.Services; +using Infrastructure.Repositories.Data; using Microsoft.EntityFrameworkCore; -using Prova.Infrastructure.Repositories.Data; -using Prova.Repositories; -using Prova.Services; + + var builder = WebApplication.CreateBuilder(args); @@ -22,6 +24,7 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); + // Registro do UsuarioRepository builder.Services.AddScoped(); // Adicionando o registro do UsuarioRepository diff --git a/Prova2_Henrique/Prova/Presentation/Properties/launchSettings.json b/Prova2_Henrique/Prova/Properties/launchSettings.json similarity index 100% rename from Prova2_Henrique/Prova/Presentation/Properties/launchSettings.json rename to Prova2_Henrique/Prova/Properties/launchSettings.json diff --git a/Prova2_Henrique/Prova/Prova.csproj b/Prova2_Henrique/Prova/Prova.csproj index cc12bc6..edb97da 100644 --- a/Prova2_Henrique/Prova/Prova.csproj +++ b/Prova2_Henrique/Prova/Prova.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -6,8 +6,33 @@ enable + + - + + + + + + + + <_WebToolingArtifacts Remove="Properties\launchSettings.json" /> + + + + + + + + + + + + + PreserveNewest + true + PreserveNewest + @@ -28,8 +53,6 @@ - - - +