diff --git a/Prova2_Henrique/Prova/Controllers/MarcasController.cs b/Prova2_Henrique/Prova/Controllers/MarcasController.cs index 1f73dea..7f24f66 100644 --- a/Prova2_Henrique/Prova/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/Controllers/ProduotsController.cs b/Prova2_Henrique/Prova/Controllers/ProduotsController.cs index df396cf..5d3caf0 100644 --- a/Prova2_Henrique/Prova/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/Controllers/UsuarioController.cs b/Prova2_Henrique/Prova/Controllers/UsuarioController.cs index f66962c..86ca82c 100644 --- a/Prova2_Henrique/Prova/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/DTO/EnderecoDTO.cs b/Prova2_Henrique/Prova/DTO/EnderecoDTO.cs deleted file mode 100644 index ff2247a..0000000 --- a/Prova2_Henrique/Prova/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/DTO/UsuarioAtualizacaoDTO.cs b/Prova2_Henrique/Prova/DTO/UsuarioAtualizacaoDTO.cs deleted file mode 100644 index 7e07675..0000000 --- a/Prova2_Henrique/Prova/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/DTO/UsuarioCadastroDTO.cs b/Prova2_Henrique/Prova/DTO/UsuarioCadastroDTO.cs deleted file mode 100644 index cebcf0c..0000000 --- a/Prova2_Henrique/Prova/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/DTO/UsuarioComToken.cs b/Prova2_Henrique/Prova/DTO/UsuarioComToken.cs deleted file mode 100644 index d05c7e2..0000000 --- a/Prova2_Henrique/Prova/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/DTO/UsuarioRespostaDTO.cs b/Prova2_Henrique/Prova/DTO/UsuarioRespostaDTO.cs deleted file mode 100644 index 88b1883..0000000 --- a/Prova2_Henrique/Prova/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/Data/AppDbContext.cs b/Prova2_Henrique/Prova/Data/AppDbContext.cs deleted file mode 100644 index c78943a..0000000 --- a/Prova2_Henrique/Prova/Data/AppDbContext.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Prova.Models; - -namespace Prova.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/Migrations/20241023181253_InitialCreate.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.Designer.cs deleted file mode 100644 index 0369fc8..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241023181253_InitialCreate.cs b/Prova2_Henrique/Prova/Migrations/20241023181253_InitialCreate.cs deleted file mode 100644 index b1f186e..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241023182454_AjusteEndereco.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.Designer.cs deleted file mode 100644 index 4aea357..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241023182454_AjusteEndereco.cs b/Prova2_Henrique/Prova/Migrations/20241023182454_AjusteEndereco.cs deleted file mode 100644 index 775a1da..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.Designer.cs deleted file mode 100644 index 9041a66..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241023183035_AlterEnderecoIdGeneration.cs b/Prova2_Henrique/Prova/Migrations/20241023183035_AlterEnderecoIdGeneration.cs deleted file mode 100644 index cf8267a..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241101235914_NomeDaMigration.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.Designer.cs deleted file mode 100644 index 78533b6..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241101235914_NomeDaMigration.cs b/Prova2_Henrique/Prova/Migrations/20241101235914_NomeDaMigration.cs deleted file mode 100644 index b09ed19..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241118214851_secondCreate.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.Designer.cs deleted file mode 100644 index 4205dbf..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241118214851_secondCreate.cs b/Prova2_Henrique/Prova/Migrations/20241118214851_secondCreate.cs deleted file mode 100644 index 216cf8a..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241127022231_produtos.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.Designer.cs deleted file mode 100644 index 656b449..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241127022231_produtos.cs b/Prova2_Henrique/Prova/Migrations/20241127022231_produtos.cs deleted file mode 100644 index 6b84e63..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241127171458_lista.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241127171458_lista.Designer.cs deleted file mode 100644 index d70bcdf..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241127171458_lista.cs b/Prova2_Henrique/Prova/Migrations/20241127171458_lista.cs deleted file mode 100644 index 63fea38..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241127193747_funcionapfv.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.Designer.cs deleted file mode 100644 index 0ebf7f0..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241127193747_funcionapfv.cs b/Prova2_Henrique/Prova/Migrations/20241127193747_funcionapfv.cs deleted file mode 100644 index 7e8ee82..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129060230_atualizandoUsuario.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.Designer.cs deleted file mode 100644 index a393b03..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129060230_atualizandoUsuario.cs b/Prova2_Henrique/Prova/Migrations/20241129060230_atualizandoUsuario.cs deleted file mode 100644 index 273f33f..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.Designer.cs deleted file mode 100644 index ac29dcb..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129071042_mudandoOTipoDaImagem.cs b/Prova2_Henrique/Prova/Migrations/20241129071042_mudandoOTipoDaImagem.cs deleted file mode 100644 index d59ec10..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.Designer.cs deleted file mode 100644 index 917efe7..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs b/Prova2_Henrique/Prova/Migrations/20241129071811_mudandoOTipoDaIamgemNovamente.cs deleted file mode 100644 index fe44e0b..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.Designer.cs deleted file mode 100644 index 39264b1..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs b/Prova2_Henrique/Prova/Migrations/20241129072043_mudandoOTipoDaIamgemNovamente2.cs deleted file mode 100644 index 6c43546..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.Designer.cs deleted file mode 100644 index b156256..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs b/Prova2_Henrique/Prova/Migrations/20241129072432_mudandoOTipoDaIamgemNovamente3.cs deleted file mode 100644 index 42644a2..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.Designer.cs deleted file mode 100644 index d3296d3..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs b/Prova2_Henrique/Prova/Migrations/20241129073354_mudandoOTipoDaIamgemNovamente5.cs deleted file mode 100644 index 94e283a..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.Designer.cs deleted file mode 100644 index 8d24c52..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs b/Prova2_Henrique/Prova/Migrations/20241129073810_mudandoOTipoDaIamgemNovamente7.cs deleted file mode 100644 index c1df9a1..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.Designer.cs deleted file mode 100644 index e426755..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs b/Prova2_Henrique/Prova/Migrations/20241129074050_mudandoOTipoDaIamgemNovamente8.cs deleted file mode 100644 index d64ff07..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.Designer.cs deleted file mode 100644 index 9ebfd45..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs b/Prova2_Henrique/Prova/Migrations/20241129080256_mudandoOTipoDaIamgemNovamente10.cs deleted file mode 100644 index 5fd21c9..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.Designer.cs deleted file mode 100644 index 2f07757..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs b/Prova2_Henrique/Prova/Migrations/20241129081217_mudandoOTipoDaIamgemNovamente12.cs deleted file mode 100644 index 7857f13..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.Designer.cs deleted file mode 100644 index 1fc5f9a..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs b/Prova2_Henrique/Prova/Migrations/20241129081646_mudandoOTipoDaIamgemNovamente13.cs deleted file mode 100644 index 5605ef4..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.Designer.cs deleted file mode 100644 index 420e318..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs b/Prova2_Henrique/Prova/Migrations/20241129082124_mudandoOTipoDaIamgemNovamente15.cs deleted file mode 100644 index 02bc1b0..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.Designer.cs deleted file mode 100644 index af83ed1..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs b/Prova2_Henrique/Prova/Migrations/20241129083237_mudandoOTipoDaIamgemNovamente18.cs deleted file mode 100644 index 193de1f..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs b/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.Designer.cs deleted file mode 100644 index a85bbae..0000000 --- a/Prova2_Henrique/Prova/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.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/Migrations/20241129173606_NomeDaMigration1221212.cs b/Prova2_Henrique/Prova/Migrations/20241129173606_NomeDaMigration1221212.cs deleted file mode 100644 index 54fb2c5..0000000 --- a/Prova2_Henrique/Prova/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/Migrations/AppDbContextModelSnapshot.cs b/Prova2_Henrique/Prova/Migrations/AppDbContextModelSnapshot.cs deleted file mode 100644 index e07d6f8..0000000 --- a/Prova2_Henrique/Prova/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.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/Models/Endereco.cs b/Prova2_Henrique/Prova/Models/Endereco.cs deleted file mode 100644 index 56bb3e5..0000000 --- a/Prova2_Henrique/Prova/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/Models/Marca.cs b/Prova2_Henrique/Prova/Models/Marca.cs deleted file mode 100644 index 4488bd9..0000000 --- a/Prova2_Henrique/Prova/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/Models/Produto.cs b/Prova2_Henrique/Prova/Models/Produto.cs deleted file mode 100644 index 3112d52..0000000 --- a/Prova2_Henrique/Prova/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/Models/Usuario.cs b/Prova2_Henrique/Prova/Models/Usuario.cs deleted file mode 100644 index 1e813c0..0000000 --- a/Prova2_Henrique/Prova/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/Program.cs b/Prova2_Henrique/Prova/Program.cs index f99de1f..a339ab0 100644 --- a/Prova2_Henrique/Prova/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.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/Prova.csproj b/Prova2_Henrique/Prova/Prova.csproj index f42cb52..edb97da 100644 --- a/Prova2_Henrique/Prova/Prova.csproj +++ b/Prova2_Henrique/Prova/Prova.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -6,6 +6,35 @@ enable + + + + + + + + + + + <_WebToolingArtifacts Remove="Properties\launchSettings.json" /> + + + + + + + + + + + + + PreserveNewest + true + PreserveNewest + + + @@ -24,4 +53,6 @@ + + diff --git a/Prova2_Henrique/Prova/Repositories/EnderecoRepository.cs b/Prova2_Henrique/Prova/Repositories/EnderecoRepository.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs b/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs deleted file mode 100644 index e7b491b..0000000 --- a/Prova2_Henrique/Prova/Repositories/MarcaRepository.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Prova.Data; -using Prova.Models; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; - -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/Repositories/ProdutoRepository.cs b/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs deleted file mode 100644 index 96aaed9..0000000 --- a/Prova2_Henrique/Prova/Repositories/ProdutoRepository.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Prova.Data; -using Prova.Models; -using Microsoft.EntityFrameworkCore; -using System.Collections.Generic; -using System.Threading.Tasks; - -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/Repositories/UsuarioRepository.cs b/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs deleted file mode 100644 index 96e9f63..0000000 --- a/Prova2_Henrique/Prova/Repositories/UsuarioRepository.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Prova.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/Services/EnderecoService.cs b/Prova2_Henrique/Prova/Services/EnderecoService.cs deleted file mode 100644 index e69de29..0000000 diff --git a/Prova2_Henrique/Prova/Services/JwtTokenService.cs b/Prova2_Henrique/Prova/Services/JwtTokenService.cs deleted file mode 100644 index e1d085a..0000000 --- a/Prova2_Henrique/Prova/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/Services/MarcaService.cs b/Prova2_Henrique/Prova/Services/MarcaService.cs deleted file mode 100644 index 890942d..0000000 --- a/Prova2_Henrique/Prova/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/Services/ProdutoService.cs b/Prova2_Henrique/Prova/Services/ProdutoService.cs deleted file mode 100644 index 8d8473d..0000000 --- a/Prova2_Henrique/Prova/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/Services/UsuarioService.cs b/Prova2_Henrique/Prova/Services/UsuarioService.cs deleted file mode 100644 index 455ac71..0000000 --- a/Prova2_Henrique/Prova/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()); - } - } -}