diff --git a/Dockerfile b/Dockerfile index be79cd9..48678f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,9 @@ COPY ["src/WebAPI/WebAPI.csproj", "src/WebAPI/"] COPY ["src/Application/Application.csproj", "src/Application/"] COPY ["src/Domain/Domain.csproj", "src/Domain/"] COPY ["src/Infraestructure/Infraestructure.csproj", "src/Infraestructure/"] -RUN dotnet restore "./src/WebAPI/WebAPI.csproj" +RUN dotnet restore "/src/WebAPI/WebAPI.csproj" COPY . . -WORKDIR ./src/WebAPI +WORKDIR /src/WebAPI RUN dotnet build ./WebAPI.csproj -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish diff --git a/src/Infraestructure/DependencyInjection.cs b/src/Infraestructure/DependencyInjection.cs index b2679b8..782c995 100644 --- a/src/Infraestructure/DependencyInjection.cs +++ b/src/Infraestructure/DependencyInjection.cs @@ -14,7 +14,7 @@ public static IServiceCollection AddInfraestructure( this IServiceCollection services, IConfiguration configuration) { - var connectionString = Environment.GetEnvironmentVariable("DATABASE_URL") ?? configuration.GetConnectionString("FreeASP"); + var connectionString = Environment.GetEnvironmentVariable("DATABASE_URL") ?? configuration.GetConnectionString("AzureSQL"); Console.WriteLine(connectionString); diff --git a/src/Infraestructure/Migrations/20240220231628_agrego-genero-empleado.Designer.cs b/src/Infraestructure/Migrations/20240220231628_agrego-genero-empleado.Designer.cs deleted file mode 100644 index 3baed79..0000000 --- a/src/Infraestructure/Migrations/20240220231628_agrego-genero-empleado.Designer.cs +++ /dev/null @@ -1,959 +0,0 @@ -// -using System; -using Infraestructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Infraestructure.Migrations -{ - [DbContext(typeof(TiendaContext))] - [Migration("20240220231628_agrego-genero-empleado")] - partial class agregogeneroempleado - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.2") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.Property("IdArticulo") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdArticulo")); - - b.Property("Codigo") - .HasColumnType("int"); - - b.Property("Costo") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdCategoria") - .HasColumnType("int"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("IdTipoTalle") - .HasColumnType("int"); - - b.Property("MargenGanancia") - .HasColumnType("int"); - - b.HasKey("IdArticulo"); - - b.HasIndex("IdCategoria"); - - b.HasIndex("IdMarca"); - - b.HasIndex("IdTipoTalle"); - - b.ToTable("Articulo", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Categoria", b => - { - b.Property("IdCategoria") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCategoria")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdCategoria"); - - b.ToTable("Categoria", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.Property("IdCliente") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCliente")); - - b.Property("Apellido") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cuil") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Dni") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("IdCondicionTributaria") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefono") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdCliente"); - - b.HasIndex("IdCondicionTributaria"); - - b.ToTable("Cliente", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Color", b => - { - b.Property("IdColor") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdColor")); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdColor"); - - b.ToTable("Color", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Comprobante", b => - { - b.Property("IdComprobante") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdComprobante")); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.HasKey("IdComprobante"); - - b.HasIndex("IdVenta") - .IsUnique(); - - b.ToTable("Comprobante", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.Property("IdCondicionTributaria") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCondicionTributaria")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdTipoDeComprobante") - .HasColumnType("int"); - - b.HasKey("IdCondicionTributaria"); - - b.HasIndex("IdTipoDeComprobante"); - - b.ToTable("CondicionTributaria", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.Property("IdEmpleado") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdEmpleado")); - - b.Property("Apellido") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("Genero") - .HasColumnType("nvarchar(max)"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("Legajo") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdEmpleado"); - - b.HasIndex("IdSucursal"); - - b.ToTable("Empleado", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.Property("IdInventario") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdInventario")); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdArticulo") - .HasColumnType("int"); - - b.Property("IdColor") - .HasColumnType("int"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("IdTalle") - .HasColumnType("int"); - - b.HasKey("IdInventario"); - - b.HasIndex("IdArticulo"); - - b.HasIndex("IdColor"); - - b.HasIndex("IdSucursal"); - - b.HasIndex("IdTalle"); - - b.ToTable("Inventario", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.LineaDeVenta", b => - { - b.Property("IdLineaDeVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdLineaDeVenta")); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdInventario") - .HasColumnType("int"); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.Property("MontoIVA") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("NetoGravado") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("PorcentajeIVA") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Subtotal") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.HasKey("IdLineaDeVenta"); - - b.HasIndex("IdInventario"); - - b.HasIndex("IdVenta"); - - b.ToTable("LineaDeVenta", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Marca", b => - { - b.Property("IdMarca") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdMarca")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdMarca"); - - b.ToTable("Marca", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Pago", b => - { - b.Property("IdPago") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdPago")); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.Property("Observaciones") - .HasColumnType("nvarchar(max)"); - - b.Property("Ticket") - .HasColumnType("int"); - - b.HasKey("IdPago"); - - b.HasIndex("IdVenta") - .IsUnique(); - - b.ToTable("Pago", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.Property("IdPuntoDeVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdPuntoDeVenta")); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("NumeroPtoVenta") - .HasColumnType("int"); - - b.HasKey("IdPuntoDeVenta"); - - b.HasIndex("IdSucursal"); - - b.ToTable("PuntoDeVenta", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Rol", b => - { - b.Property("IdRol") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdRol")); - - b.Property("Descripcion") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdRol"); - - b.ToTable("Rol", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Sesion", b => - { - b.Property("IdSesion") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdSesion")); - - b.Property("FechaFin") - .HasColumnType("datetime2"); - - b.Property("FechaInicio") - .HasColumnType("datetime2"); - - b.Property("IdPuntoDeVenta") - .HasColumnType("int"); - - b.Property("IdUsuario") - .HasColumnType("int"); - - b.HasKey("IdSesion"); - - b.HasIndex("IdPuntoDeVenta"); - - b.HasIndex("IdUsuario") - .IsUnique(); - - b.ToTable("Sesion", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.Property("IdSucursal") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdSucursal")); - - b.Property("Ciudad") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdTienda") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefono") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdSucursal"); - - b.HasIndex("IdTienda"); - - b.ToTable("Sucursal", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.Property("IdTalle") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTalle")); - - b.Property("IdTipoTalle") - .HasColumnType("int"); - - b.Property("Medida") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTalle"); - - b.HasIndex("IdTipoTalle"); - - b.ToTable("Talle", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.Property("IdTienda") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTienda")); - - b.Property("Cuit") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdCondicionTributaria") - .HasColumnType("int"); - - b.HasKey("IdTienda"); - - b.HasIndex("IdCondicionTributaria") - .IsUnique(); - - b.ToTable("Tienda", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.TipoDeComprobante", b => - { - b.Property("IdTipoDeComprobante") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTipoDeComprobante")); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTipoDeComprobante"); - - b.ToTable("TipoDeComprobante", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.TipoTalle", b => - { - b.Property("IdTipoTalle") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTipoTalle")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTipoTalle"); - - b.ToTable("TipoTalle", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.Property("IdUsuario") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdUsuario")); - - b.Property("Contraseña") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdEmpleado") - .HasColumnType("int"); - - b.Property("IdRol") - .HasColumnType("int"); - - b.Property("NombreUsuario") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdUsuario"); - - b.HasIndex("IdEmpleado") - .IsUnique(); - - b.HasIndex("IdRol"); - - b.ToTable("Usuario", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.Property("IdVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdVenta")); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("int"); - - b.Property("IdPuntoVenta") - .HasColumnType("int"); - - b.Property("IdTipoDeComprobante") - .HasColumnType("int"); - - b.Property("IdUsuario") - .HasColumnType("int"); - - b.Property("Monto") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Observaciones") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdVenta"); - - b.HasIndex("IdCliente"); - - b.HasIndex("IdPuntoVenta"); - - b.HasIndex("IdTipoDeComprobante"); - - b.HasIndex("IdUsuario"); - - b.ToTable("Venta", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.HasOne("Domain.Models.Categoria", "Categoria") - .WithMany("Articulos") - .HasForeignKey("IdCategoria"); - - b.HasOne("Domain.Models.Marca", "Marca") - .WithMany("Articulos") - .HasForeignKey("IdMarca"); - - b.HasOne("Domain.Models.TipoTalle", "TipoTalle") - .WithMany("Articulos") - .HasForeignKey("IdTipoTalle"); - - b.Navigation("Categoria"); - - b.Navigation("Marca"); - - b.Navigation("TipoTalle"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.HasOne("Domain.Models.CondicionTributaria", "CondicionTributaria") - .WithMany("Clientes") - .HasForeignKey("IdCondicionTributaria"); - - b.Navigation("CondicionTributaria"); - }); - - modelBuilder.Entity("Domain.Models.Comprobante", b => - { - b.HasOne("Domain.Models.Venta", "Venta") - .WithOne("Comprobante") - .HasForeignKey("Domain.Models.Comprobante", "IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.HasOne("Domain.Models.TipoDeComprobante", "TipoDeComprobante") - .WithMany("CondicionesTributarias") - .HasForeignKey("IdTipoDeComprobante") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("TipoDeComprobante"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("Empleados") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sucursal"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.HasOne("Domain.Models.Articulo", "Articulo") - .WithMany("Inventarios") - .HasForeignKey("IdArticulo") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Color", "Color") - .WithMany("Inventarios") - .HasForeignKey("IdColor") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("Inventarios") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Talle", "Talle") - .WithMany("Inventarios") - .HasForeignKey("IdTalle") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Articulo"); - - b.Navigation("Color"); - - b.Navigation("Sucursal"); - - b.Navigation("Talle"); - }); - - modelBuilder.Entity("Domain.Models.LineaDeVenta", b => - { - b.HasOne("Domain.Models.Inventario", "Inventario") - .WithMany("LineasDeVentas") - .HasForeignKey("IdInventario") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Venta", "Venta") - .WithMany("LineasDeVentas") - .HasForeignKey("IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Inventario"); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.Pago", b => - { - b.HasOne("Domain.Models.Venta", "Venta") - .WithOne("Pago") - .HasForeignKey("Domain.Models.Pago", "IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("PuntosDeVentas") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sucursal"); - }); - - modelBuilder.Entity("Domain.Models.Sesion", b => - { - b.HasOne("Domain.Models.PuntoDeVenta", "PuntoDeVenta") - .WithMany("Sesiones") - .HasForeignKey("IdPuntoDeVenta"); - - b.HasOne("Domain.Models.Usuario", "Usuario") - .WithOne("Sesion") - .HasForeignKey("Domain.Models.Sesion", "IdUsuario") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PuntoDeVenta"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.HasOne("Domain.Models.Tienda", "Tienda") - .WithMany("Sucursales") - .HasForeignKey("IdTienda") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tienda"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.HasOne("Domain.Models.TipoTalle", "TipoTalle") - .WithMany("Talles") - .HasForeignKey("IdTipoTalle"); - - b.Navigation("TipoTalle"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.HasOne("Domain.Models.CondicionTributaria", "CondicionTributaria") - .WithOne("Tienda") - .HasForeignKey("Domain.Models.Tienda", "IdCondicionTributaria") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CondicionTributaria"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.HasOne("Domain.Models.Empleado", "Empleado") - .WithOne("Usuario") - .HasForeignKey("Domain.Models.Usuario", "IdEmpleado") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Rol", "Rol") - .WithMany("Usuarios") - .HasForeignKey("IdRol"); - - b.Navigation("Empleado"); - - b.Navigation("Rol"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.HasOne("Domain.Models.Cliente", "Cliente") - .WithMany("Ventas") - .HasForeignKey("IdCliente") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.PuntoDeVenta", "PuntoDeVenta") - .WithMany("Ventas") - .HasForeignKey("IdPuntoVenta") - .IsRequired(); - - b.HasOne("Domain.Models.TipoDeComprobante", "TipoDeComprobante") - .WithMany("Ventas") - .HasForeignKey("IdTipoDeComprobante") - .IsRequired(); - - b.HasOne("Domain.Models.Usuario", "Usuario") - .WithMany("Ventas") - .HasForeignKey("IdUsuario") - .IsRequired(); - - b.Navigation("Cliente"); - - b.Navigation("PuntoDeVenta"); - - b.Navigation("TipoDeComprobante"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.Categoria", b => - { - b.Navigation("Articulos"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Color", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.Navigation("Clientes"); - - b.Navigation("Tienda"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.Navigation("LineasDeVentas"); - }); - - modelBuilder.Entity("Domain.Models.Marca", b => - { - b.Navigation("Articulos"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.Navigation("Sesiones"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Rol", b => - { - b.Navigation("Usuarios"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.Navigation("Empleados"); - - b.Navigation("Inventarios"); - - b.Navigation("PuntosDeVentas"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.Navigation("Sucursales"); - }); - - modelBuilder.Entity("Domain.Models.TipoDeComprobante", b => - { - b.Navigation("CondicionesTributarias"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.TipoTalle", b => - { - b.Navigation("Articulos"); - - b.Navigation("Talles"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.Navigation("Sesion"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.Navigation("Comprobante"); - - b.Navigation("LineasDeVentas"); - - b.Navigation("Pago"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infraestructure/Migrations/20240220231628_agrego-genero-empleado.cs b/src/Infraestructure/Migrations/20240220231628_agrego-genero-empleado.cs deleted file mode 100644 index a253878..0000000 --- a/src/Infraestructure/Migrations/20240220231628_agrego-genero-empleado.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infraestructure.Migrations -{ - /// - public partial class agregogeneroempleado : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Genero", - schema: "Admin", - table: "Empleado", - type: "nvarchar(max)", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Genero", - schema: "Admin", - table: "Empleado"); - } - } -} diff --git a/src/Infraestructure/Migrations/20240220231920_saco-genero-empleado.Designer.cs b/src/Infraestructure/Migrations/20240220231920_saco-genero-empleado.Designer.cs deleted file mode 100644 index a92791f..0000000 --- a/src/Infraestructure/Migrations/20240220231920_saco-genero-empleado.Designer.cs +++ /dev/null @@ -1,956 +0,0 @@ -// -using System; -using Infraestructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Infraestructure.Migrations -{ - [DbContext(typeof(TiendaContext))] - [Migration("20240220231920_saco-genero-empleado")] - partial class sacogeneroempleado - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.2") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.Property("IdArticulo") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdArticulo")); - - b.Property("Codigo") - .HasColumnType("int"); - - b.Property("Costo") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdCategoria") - .HasColumnType("int"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("IdTipoTalle") - .HasColumnType("int"); - - b.Property("MargenGanancia") - .HasColumnType("int"); - - b.HasKey("IdArticulo"); - - b.HasIndex("IdCategoria"); - - b.HasIndex("IdMarca"); - - b.HasIndex("IdTipoTalle"); - - b.ToTable("Articulo", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Categoria", b => - { - b.Property("IdCategoria") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCategoria")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdCategoria"); - - b.ToTable("Categoria", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.Property("IdCliente") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCliente")); - - b.Property("Apellido") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cuil") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Dni") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("IdCondicionTributaria") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefono") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdCliente"); - - b.HasIndex("IdCondicionTributaria"); - - b.ToTable("Cliente", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Color", b => - { - b.Property("IdColor") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdColor")); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdColor"); - - b.ToTable("Color", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Comprobante", b => - { - b.Property("IdComprobante") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdComprobante")); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.HasKey("IdComprobante"); - - b.HasIndex("IdVenta") - .IsUnique(); - - b.ToTable("Comprobante", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.Property("IdCondicionTributaria") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCondicionTributaria")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdTipoDeComprobante") - .HasColumnType("int"); - - b.HasKey("IdCondicionTributaria"); - - b.HasIndex("IdTipoDeComprobante"); - - b.ToTable("CondicionTributaria", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.Property("IdEmpleado") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdEmpleado")); - - b.Property("Apellido") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("Legajo") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdEmpleado"); - - b.HasIndex("IdSucursal"); - - b.ToTable("Empleado", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.Property("IdInventario") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdInventario")); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdArticulo") - .HasColumnType("int"); - - b.Property("IdColor") - .HasColumnType("int"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("IdTalle") - .HasColumnType("int"); - - b.HasKey("IdInventario"); - - b.HasIndex("IdArticulo"); - - b.HasIndex("IdColor"); - - b.HasIndex("IdSucursal"); - - b.HasIndex("IdTalle"); - - b.ToTable("Inventario", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.LineaDeVenta", b => - { - b.Property("IdLineaDeVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdLineaDeVenta")); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdInventario") - .HasColumnType("int"); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.Property("MontoIVA") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("NetoGravado") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("PorcentajeIVA") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Subtotal") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.HasKey("IdLineaDeVenta"); - - b.HasIndex("IdInventario"); - - b.HasIndex("IdVenta"); - - b.ToTable("LineaDeVenta", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Marca", b => - { - b.Property("IdMarca") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdMarca")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdMarca"); - - b.ToTable("Marca", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Pago", b => - { - b.Property("IdPago") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdPago")); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.Property("Observaciones") - .HasColumnType("nvarchar(max)"); - - b.Property("Ticket") - .HasColumnType("int"); - - b.HasKey("IdPago"); - - b.HasIndex("IdVenta") - .IsUnique(); - - b.ToTable("Pago", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.Property("IdPuntoDeVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdPuntoDeVenta")); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("NumeroPtoVenta") - .HasColumnType("int"); - - b.HasKey("IdPuntoDeVenta"); - - b.HasIndex("IdSucursal"); - - b.ToTable("PuntoDeVenta", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Rol", b => - { - b.Property("IdRol") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdRol")); - - b.Property("Descripcion") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdRol"); - - b.ToTable("Rol", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Sesion", b => - { - b.Property("IdSesion") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdSesion")); - - b.Property("FechaFin") - .HasColumnType("datetime2"); - - b.Property("FechaInicio") - .HasColumnType("datetime2"); - - b.Property("IdPuntoDeVenta") - .HasColumnType("int"); - - b.Property("IdUsuario") - .HasColumnType("int"); - - b.HasKey("IdSesion"); - - b.HasIndex("IdPuntoDeVenta"); - - b.HasIndex("IdUsuario") - .IsUnique(); - - b.ToTable("Sesion", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.Property("IdSucursal") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdSucursal")); - - b.Property("Ciudad") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdTienda") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefono") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdSucursal"); - - b.HasIndex("IdTienda"); - - b.ToTable("Sucursal", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.Property("IdTalle") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTalle")); - - b.Property("IdTipoTalle") - .HasColumnType("int"); - - b.Property("Medida") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTalle"); - - b.HasIndex("IdTipoTalle"); - - b.ToTable("Talle", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.Property("IdTienda") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTienda")); - - b.Property("Cuit") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdCondicionTributaria") - .HasColumnType("int"); - - b.HasKey("IdTienda"); - - b.HasIndex("IdCondicionTributaria") - .IsUnique(); - - b.ToTable("Tienda", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.TipoDeComprobante", b => - { - b.Property("IdTipoDeComprobante") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTipoDeComprobante")); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTipoDeComprobante"); - - b.ToTable("TipoDeComprobante", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.TipoTalle", b => - { - b.Property("IdTipoTalle") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTipoTalle")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTipoTalle"); - - b.ToTable("TipoTalle", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.Property("IdUsuario") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdUsuario")); - - b.Property("Contraseña") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdEmpleado") - .HasColumnType("int"); - - b.Property("IdRol") - .HasColumnType("int"); - - b.Property("NombreUsuario") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdUsuario"); - - b.HasIndex("IdEmpleado") - .IsUnique(); - - b.HasIndex("IdRol"); - - b.ToTable("Usuario", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.Property("IdVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdVenta")); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("int"); - - b.Property("IdPuntoVenta") - .HasColumnType("int"); - - b.Property("IdTipoDeComprobante") - .HasColumnType("int"); - - b.Property("IdUsuario") - .HasColumnType("int"); - - b.Property("Monto") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Observaciones") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdVenta"); - - b.HasIndex("IdCliente"); - - b.HasIndex("IdPuntoVenta"); - - b.HasIndex("IdTipoDeComprobante"); - - b.HasIndex("IdUsuario"); - - b.ToTable("Venta", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.HasOne("Domain.Models.Categoria", "Categoria") - .WithMany("Articulos") - .HasForeignKey("IdCategoria"); - - b.HasOne("Domain.Models.Marca", "Marca") - .WithMany("Articulos") - .HasForeignKey("IdMarca"); - - b.HasOne("Domain.Models.TipoTalle", "TipoTalle") - .WithMany("Articulos") - .HasForeignKey("IdTipoTalle"); - - b.Navigation("Categoria"); - - b.Navigation("Marca"); - - b.Navigation("TipoTalle"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.HasOne("Domain.Models.CondicionTributaria", "CondicionTributaria") - .WithMany("Clientes") - .HasForeignKey("IdCondicionTributaria"); - - b.Navigation("CondicionTributaria"); - }); - - modelBuilder.Entity("Domain.Models.Comprobante", b => - { - b.HasOne("Domain.Models.Venta", "Venta") - .WithOne("Comprobante") - .HasForeignKey("Domain.Models.Comprobante", "IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.HasOne("Domain.Models.TipoDeComprobante", "TipoDeComprobante") - .WithMany("CondicionesTributarias") - .HasForeignKey("IdTipoDeComprobante") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("TipoDeComprobante"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("Empleados") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sucursal"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.HasOne("Domain.Models.Articulo", "Articulo") - .WithMany("Inventarios") - .HasForeignKey("IdArticulo") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Color", "Color") - .WithMany("Inventarios") - .HasForeignKey("IdColor") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("Inventarios") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Talle", "Talle") - .WithMany("Inventarios") - .HasForeignKey("IdTalle") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Articulo"); - - b.Navigation("Color"); - - b.Navigation("Sucursal"); - - b.Navigation("Talle"); - }); - - modelBuilder.Entity("Domain.Models.LineaDeVenta", b => - { - b.HasOne("Domain.Models.Inventario", "Inventario") - .WithMany("LineasDeVentas") - .HasForeignKey("IdInventario") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Venta", "Venta") - .WithMany("LineasDeVentas") - .HasForeignKey("IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Inventario"); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.Pago", b => - { - b.HasOne("Domain.Models.Venta", "Venta") - .WithOne("Pago") - .HasForeignKey("Domain.Models.Pago", "IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("PuntosDeVentas") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sucursal"); - }); - - modelBuilder.Entity("Domain.Models.Sesion", b => - { - b.HasOne("Domain.Models.PuntoDeVenta", "PuntoDeVenta") - .WithMany("Sesiones") - .HasForeignKey("IdPuntoDeVenta"); - - b.HasOne("Domain.Models.Usuario", "Usuario") - .WithOne("Sesion") - .HasForeignKey("Domain.Models.Sesion", "IdUsuario") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PuntoDeVenta"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.HasOne("Domain.Models.Tienda", "Tienda") - .WithMany("Sucursales") - .HasForeignKey("IdTienda") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tienda"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.HasOne("Domain.Models.TipoTalle", "TipoTalle") - .WithMany("Talles") - .HasForeignKey("IdTipoTalle"); - - b.Navigation("TipoTalle"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.HasOne("Domain.Models.CondicionTributaria", "CondicionTributaria") - .WithOne("Tienda") - .HasForeignKey("Domain.Models.Tienda", "IdCondicionTributaria") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CondicionTributaria"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.HasOne("Domain.Models.Empleado", "Empleado") - .WithOne("Usuario") - .HasForeignKey("Domain.Models.Usuario", "IdEmpleado") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Rol", "Rol") - .WithMany("Usuarios") - .HasForeignKey("IdRol"); - - b.Navigation("Empleado"); - - b.Navigation("Rol"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.HasOne("Domain.Models.Cliente", "Cliente") - .WithMany("Ventas") - .HasForeignKey("IdCliente") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.PuntoDeVenta", "PuntoDeVenta") - .WithMany("Ventas") - .HasForeignKey("IdPuntoVenta") - .IsRequired(); - - b.HasOne("Domain.Models.TipoDeComprobante", "TipoDeComprobante") - .WithMany("Ventas") - .HasForeignKey("IdTipoDeComprobante") - .IsRequired(); - - b.HasOne("Domain.Models.Usuario", "Usuario") - .WithMany("Ventas") - .HasForeignKey("IdUsuario") - .IsRequired(); - - b.Navigation("Cliente"); - - b.Navigation("PuntoDeVenta"); - - b.Navigation("TipoDeComprobante"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.Categoria", b => - { - b.Navigation("Articulos"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Color", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.Navigation("Clientes"); - - b.Navigation("Tienda"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.Navigation("LineasDeVentas"); - }); - - modelBuilder.Entity("Domain.Models.Marca", b => - { - b.Navigation("Articulos"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.Navigation("Sesiones"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Rol", b => - { - b.Navigation("Usuarios"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.Navigation("Empleados"); - - b.Navigation("Inventarios"); - - b.Navigation("PuntosDeVentas"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.Navigation("Sucursales"); - }); - - modelBuilder.Entity("Domain.Models.TipoDeComprobante", b => - { - b.Navigation("CondicionesTributarias"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.TipoTalle", b => - { - b.Navigation("Articulos"); - - b.Navigation("Talles"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.Navigation("Sesion"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.Navigation("Comprobante"); - - b.Navigation("LineasDeVentas"); - - b.Navigation("Pago"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infraestructure/Migrations/20240220231920_saco-genero-empleado.cs b/src/Infraestructure/Migrations/20240220231920_saco-genero-empleado.cs deleted file mode 100644 index 6bf3089..0000000 --- a/src/Infraestructure/Migrations/20240220231920_saco-genero-empleado.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infraestructure.Migrations -{ - /// - public partial class sacogeneroempleado : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Genero", - schema: "Admin", - table: "Empleado"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Genero", - schema: "Admin", - table: "Empleado", - type: "nvarchar(max)", - nullable: true); - } - } -} diff --git a/src/Infraestructure/Migrations/20240221142742_New.Designer.cs b/src/Infraestructure/Migrations/20240221142742_New.Designer.cs deleted file mode 100644 index a88be29..0000000 --- a/src/Infraestructure/Migrations/20240221142742_New.Designer.cs +++ /dev/null @@ -1,956 +0,0 @@ -// -using System; -using Infraestructure.Data; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Infraestructure.Migrations -{ - [DbContext(typeof(TiendaContext))] - [Migration("20240221142742_New")] - partial class New - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.2") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.Property("IdArticulo") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdArticulo")); - - b.Property("Codigo") - .HasColumnType("int"); - - b.Property("Costo") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdCategoria") - .HasColumnType("int"); - - b.Property("IdMarca") - .HasColumnType("int"); - - b.Property("IdTipoTalle") - .HasColumnType("int"); - - b.Property("MargenGanancia") - .HasColumnType("int"); - - b.HasKey("IdArticulo"); - - b.HasIndex("IdCategoria"); - - b.HasIndex("IdMarca"); - - b.HasIndex("IdTipoTalle"); - - b.ToTable("Articulo", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Categoria", b => - { - b.Property("IdCategoria") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCategoria")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdCategoria"); - - b.ToTable("Categoria", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.Property("IdCliente") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCliente")); - - b.Property("Apellido") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Cuil") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Dni") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("IdCondicionTributaria") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefono") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdCliente"); - - b.HasIndex("IdCondicionTributaria"); - - b.ToTable("Cliente", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Color", b => - { - b.Property("IdColor") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdColor")); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdColor"); - - b.ToTable("Color", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Comprobante", b => - { - b.Property("IdComprobante") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdComprobante")); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.HasKey("IdComprobante"); - - b.HasIndex("IdVenta") - .IsUnique(); - - b.ToTable("Comprobante", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.Property("IdCondicionTributaria") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdCondicionTributaria")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdTipoDeComprobante") - .HasColumnType("int"); - - b.HasKey("IdCondicionTributaria"); - - b.HasIndex("IdTipoDeComprobante"); - - b.ToTable("CondicionTributaria", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.Property("IdEmpleado") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdEmpleado")); - - b.Property("Apellido") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .HasColumnType("nvarchar(max)"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("Legajo") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdEmpleado"); - - b.HasIndex("IdSucursal"); - - b.ToTable("Empleado", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.Property("IdInventario") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdInventario")); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdArticulo") - .HasColumnType("int"); - - b.Property("IdColor") - .HasColumnType("int"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("IdTalle") - .HasColumnType("int"); - - b.HasKey("IdInventario"); - - b.HasIndex("IdArticulo"); - - b.HasIndex("IdColor"); - - b.HasIndex("IdSucursal"); - - b.HasIndex("IdTalle"); - - b.ToTable("Inventario", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.LineaDeVenta", b => - { - b.Property("IdLineaDeVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdLineaDeVenta")); - - b.Property("Cantidad") - .HasColumnType("int"); - - b.Property("IdInventario") - .HasColumnType("int"); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.Property("MontoIVA") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("NetoGravado") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("PorcentajeIVA") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Subtotal") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.HasKey("IdLineaDeVenta"); - - b.HasIndex("IdInventario"); - - b.HasIndex("IdVenta"); - - b.ToTable("LineaDeVenta", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Marca", b => - { - b.Property("IdMarca") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdMarca")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdMarca"); - - b.ToTable("Marca", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Pago", b => - { - b.Property("IdPago") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdPago")); - - b.Property("Estado") - .HasColumnType("nvarchar(max)"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdVenta") - .HasColumnType("int"); - - b.Property("Observaciones") - .HasColumnType("nvarchar(max)"); - - b.Property("Ticket") - .HasColumnType("int"); - - b.HasKey("IdPago"); - - b.HasIndex("IdVenta") - .IsUnique(); - - b.ToTable("Pago", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.Property("IdPuntoDeVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdPuntoDeVenta")); - - b.Property("Habilitado") - .HasColumnType("bit"); - - b.Property("IdSucursal") - .HasColumnType("int"); - - b.Property("NumeroPtoVenta") - .HasColumnType("int"); - - b.HasKey("IdPuntoDeVenta"); - - b.HasIndex("IdSucursal"); - - b.ToTable("PuntoDeVenta", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Rol", b => - { - b.Property("IdRol") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdRol")); - - b.Property("Descripcion") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdRol"); - - b.ToTable("Rol", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Sesion", b => - { - b.Property("IdSesion") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdSesion")); - - b.Property("FechaFin") - .HasColumnType("datetime2"); - - b.Property("FechaInicio") - .HasColumnType("datetime2"); - - b.Property("IdPuntoDeVenta") - .HasColumnType("int"); - - b.Property("IdUsuario") - .HasColumnType("int"); - - b.HasKey("IdSesion"); - - b.HasIndex("IdPuntoDeVenta"); - - b.HasIndex("IdUsuario") - .IsUnique(); - - b.ToTable("Sesion", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.Property("IdSucursal") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdSucursal")); - - b.Property("Ciudad") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Domicilio") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdTienda") - .HasColumnType("int"); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telefono") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdSucursal"); - - b.HasIndex("IdTienda"); - - b.ToTable("Sucursal", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.Property("IdTalle") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTalle")); - - b.Property("IdTipoTalle") - .HasColumnType("int"); - - b.Property("Medida") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTalle"); - - b.HasIndex("IdTipoTalle"); - - b.ToTable("Talle", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.Property("IdTienda") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTienda")); - - b.Property("Cuit") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdCondicionTributaria") - .HasColumnType("int"); - - b.HasKey("IdTienda"); - - b.HasIndex("IdCondicionTributaria") - .IsUnique(); - - b.ToTable("Tienda", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.TipoDeComprobante", b => - { - b.Property("IdTipoDeComprobante") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTipoDeComprobante")); - - b.Property("Nombre") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTipoDeComprobante"); - - b.ToTable("TipoDeComprobante", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.TipoTalle", b => - { - b.Property("IdTipoTalle") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdTipoTalle")); - - b.Property("Descripcion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdTipoTalle"); - - b.ToTable("TipoTalle", "Articulo"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.Property("IdUsuario") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdUsuario")); - - b.Property("Contraseña") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("IdEmpleado") - .HasColumnType("int"); - - b.Property("IdRol") - .HasColumnType("int"); - - b.Property("NombreUsuario") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdUsuario"); - - b.HasIndex("IdEmpleado") - .IsUnique(); - - b.HasIndex("IdRol"); - - b.ToTable("Usuario", "Admin"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.Property("IdVenta") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("IdVenta")); - - b.Property("Estado") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Fecha") - .HasColumnType("datetime2"); - - b.Property("IdCliente") - .HasColumnType("int"); - - b.Property("IdPuntoVenta") - .HasColumnType("int"); - - b.Property("IdTipoDeComprobante") - .HasColumnType("int"); - - b.Property("IdUsuario") - .HasColumnType("int"); - - b.Property("Monto") - .HasPrecision(18, 2) - .HasColumnType("decimal(18,2)"); - - b.Property("Observaciones") - .HasColumnType("nvarchar(max)"); - - b.HasKey("IdVenta"); - - b.HasIndex("IdCliente"); - - b.HasIndex("IdPuntoVenta"); - - b.HasIndex("IdTipoDeComprobante"); - - b.HasIndex("IdUsuario"); - - b.ToTable("Venta", "Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.HasOne("Domain.Models.Categoria", "Categoria") - .WithMany("Articulos") - .HasForeignKey("IdCategoria"); - - b.HasOne("Domain.Models.Marca", "Marca") - .WithMany("Articulos") - .HasForeignKey("IdMarca"); - - b.HasOne("Domain.Models.TipoTalle", "TipoTalle") - .WithMany("Articulos") - .HasForeignKey("IdTipoTalle"); - - b.Navigation("Categoria"); - - b.Navigation("Marca"); - - b.Navigation("TipoTalle"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.HasOne("Domain.Models.CondicionTributaria", "CondicionTributaria") - .WithMany("Clientes") - .HasForeignKey("IdCondicionTributaria"); - - b.Navigation("CondicionTributaria"); - }); - - modelBuilder.Entity("Domain.Models.Comprobante", b => - { - b.HasOne("Domain.Models.Venta", "Venta") - .WithOne("Comprobante") - .HasForeignKey("Domain.Models.Comprobante", "IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.HasOne("Domain.Models.TipoDeComprobante", "TipoDeComprobante") - .WithMany("CondicionesTributarias") - .HasForeignKey("IdTipoDeComprobante") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("TipoDeComprobante"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("Empleados") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sucursal"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.HasOne("Domain.Models.Articulo", "Articulo") - .WithMany("Inventarios") - .HasForeignKey("IdArticulo") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Color", "Color") - .WithMany("Inventarios") - .HasForeignKey("IdColor") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("Inventarios") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Talle", "Talle") - .WithMany("Inventarios") - .HasForeignKey("IdTalle") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Articulo"); - - b.Navigation("Color"); - - b.Navigation("Sucursal"); - - b.Navigation("Talle"); - }); - - modelBuilder.Entity("Domain.Models.LineaDeVenta", b => - { - b.HasOne("Domain.Models.Inventario", "Inventario") - .WithMany("LineasDeVentas") - .HasForeignKey("IdInventario") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Venta", "Venta") - .WithMany("LineasDeVentas") - .HasForeignKey("IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Inventario"); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.Pago", b => - { - b.HasOne("Domain.Models.Venta", "Venta") - .WithOne("Pago") - .HasForeignKey("Domain.Models.Pago", "IdVenta") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Venta"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.HasOne("Domain.Models.Sucursal", "Sucursal") - .WithMany("PuntosDeVentas") - .HasForeignKey("IdSucursal") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sucursal"); - }); - - modelBuilder.Entity("Domain.Models.Sesion", b => - { - b.HasOne("Domain.Models.PuntoDeVenta", "PuntoDeVenta") - .WithMany("Sesiones") - .HasForeignKey("IdPuntoDeVenta"); - - b.HasOne("Domain.Models.Usuario", "Usuario") - .WithOne("Sesion") - .HasForeignKey("Domain.Models.Sesion", "IdUsuario") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("PuntoDeVenta"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.HasOne("Domain.Models.Tienda", "Tienda") - .WithMany("Sucursales") - .HasForeignKey("IdTienda") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Tienda"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.HasOne("Domain.Models.TipoTalle", "TipoTalle") - .WithMany("Talles") - .HasForeignKey("IdTipoTalle"); - - b.Navigation("TipoTalle"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.HasOne("Domain.Models.CondicionTributaria", "CondicionTributaria") - .WithOne("Tienda") - .HasForeignKey("Domain.Models.Tienda", "IdCondicionTributaria") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CondicionTributaria"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.HasOne("Domain.Models.Empleado", "Empleado") - .WithOne("Usuario") - .HasForeignKey("Domain.Models.Usuario", "IdEmpleado") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.Rol", "Rol") - .WithMany("Usuarios") - .HasForeignKey("IdRol"); - - b.Navigation("Empleado"); - - b.Navigation("Rol"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.HasOne("Domain.Models.Cliente", "Cliente") - .WithMany("Ventas") - .HasForeignKey("IdCliente") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Domain.Models.PuntoDeVenta", "PuntoDeVenta") - .WithMany("Ventas") - .HasForeignKey("IdPuntoVenta") - .IsRequired(); - - b.HasOne("Domain.Models.TipoDeComprobante", "TipoDeComprobante") - .WithMany("Ventas") - .HasForeignKey("IdTipoDeComprobante") - .IsRequired(); - - b.HasOne("Domain.Models.Usuario", "Usuario") - .WithMany("Ventas") - .HasForeignKey("IdUsuario") - .IsRequired(); - - b.Navigation("Cliente"); - - b.Navigation("PuntoDeVenta"); - - b.Navigation("TipoDeComprobante"); - - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Articulo", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.Categoria", b => - { - b.Navigation("Articulos"); - }); - - modelBuilder.Entity("Domain.Models.Cliente", b => - { - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Color", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.CondicionTributaria", b => - { - b.Navigation("Clientes"); - - b.Navigation("Tienda"); - }); - - modelBuilder.Entity("Domain.Models.Empleado", b => - { - b.Navigation("Usuario"); - }); - - modelBuilder.Entity("Domain.Models.Inventario", b => - { - b.Navigation("LineasDeVentas"); - }); - - modelBuilder.Entity("Domain.Models.Marca", b => - { - b.Navigation("Articulos"); - }); - - modelBuilder.Entity("Domain.Models.PuntoDeVenta", b => - { - b.Navigation("Sesiones"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Rol", b => - { - b.Navigation("Usuarios"); - }); - - modelBuilder.Entity("Domain.Models.Sucursal", b => - { - b.Navigation("Empleados"); - - b.Navigation("Inventarios"); - - b.Navigation("PuntosDeVentas"); - }); - - modelBuilder.Entity("Domain.Models.Talle", b => - { - b.Navigation("Inventarios"); - }); - - modelBuilder.Entity("Domain.Models.Tienda", b => - { - b.Navigation("Sucursales"); - }); - - modelBuilder.Entity("Domain.Models.TipoDeComprobante", b => - { - b.Navigation("CondicionesTributarias"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.TipoTalle", b => - { - b.Navigation("Articulos"); - - b.Navigation("Talles"); - }); - - modelBuilder.Entity("Domain.Models.Usuario", b => - { - b.Navigation("Sesion"); - - b.Navigation("Ventas"); - }); - - modelBuilder.Entity("Domain.Models.Venta", b => - { - b.Navigation("Comprobante"); - - b.Navigation("LineasDeVentas"); - - b.Navigation("Pago"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Infraestructure/Migrations/20240221142742_New.cs b/src/Infraestructure/Migrations/20240221142742_New.cs deleted file mode 100644 index 38af4ff..0000000 --- a/src/Infraestructure/Migrations/20240221142742_New.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Infraestructure.Migrations -{ - /// - public partial class New : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/src/WebAPI/.config/dotnet-tools.json b/src/WebAPI/.config/dotnet-tools.json new file mode 100644 index 0000000..9d58272 --- /dev/null +++ b/src/WebAPI/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "8.0.2", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/src/WebAPI/Program.cs b/src/WebAPI/Program.cs index 3ffda4a..0fb7e7d 100644 --- a/src/WebAPI/Program.cs +++ b/src/WebAPI/Program.cs @@ -8,6 +8,10 @@ var builder = WebApplication.CreateBuilder(args); +/* +var keyVaultEndpoint = new Uri(Environment.GetEnvironmentVariable("https://webapi-vault.vault.azure.net/")); +builder.Configuration.AddAzureKeyVault(keyVaultEndpoint, new DefaultAzureCredential());*/ + // Add services to the container. builder.Services.AddControllers(); @@ -36,17 +40,18 @@ // Configure the HTTP request pipeline. app.UseStaticFiles(); -if (app.Environment.IsDevelopment() || app.Environment.IsProduction()) +app.UseSwagger(); +//app.UseSwaggerThemes(Theme.OneDark); +app.UseSwaggerUI(options => { - app.UseSwagger(); - //app.UseSwaggerThemes(Theme.OneDark); - app.UseSwaggerUI(options => - { - options.DocExpansion(DocExpansion.None); - options.InjectStylesheet("/Swagger/SwaggerDark.css"); - options.EnableTryItOutByDefault(); - }); -} + options.DocExpansion(DocExpansion.None); + options.InjectStylesheet("/Swagger/SwaggerDark.css"); + options.EnableTryItOutByDefault(); +}); + +/*if (app.Environment.IsDevelopment() || app.Environment.IsProduction()) +{ +}*/ app.UseHttpsRedirection(); @@ -54,11 +59,11 @@ app.MapControllers(); -if (app.Environment.IsProduction()) +/*if (app.Environment.IsProduction()) { var port = Environment.GetEnvironmentVariable("PORT"); app.Urls.Add($"http://*:{port}"); -} +}*/ /*var port = Environment.GetEnvironmentVariable("PORT") ?? "8080"; var host = Environment.GetEnvironmentVariable("applicationUrl") ?? "localhost";*/ app.Run(); diff --git a/src/WebAPI/Properties/ServiceDependencies/WebAPI-Tienda - Web Deploy/mssql2.arm.json b/src/WebAPI/Properties/ServiceDependencies/WebAPI-Tienda - Web Deploy/mssql2.arm.json new file mode 100644 index 0000000..781c6b5 --- /dev/null +++ b/src/WebAPI/Properties/ServiceDependencies/WebAPI-Tienda - Web Deploy/mssql2.arm.json @@ -0,0 +1,81 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "resourceGroupName": { + "type": "string", + "defaultValue": "WebAPI_ResourceGroup", + "metadata": { + "_parameterType": "resourceGroup", + "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking." + } + }, + "resourceGroupLocation": { + "type": "string", + "defaultValue": "eastus", + "metadata": { + "_parameterType": "location", + "description": "Location of the resource group. Resource groups could have different location than resources." + } + }, + "resourceLocation": { + "type": "string", + "defaultValue": "[parameters('resourceGroupLocation')]", + "metadata": { + "_parameterType": "location", + "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there." + } + } + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "name": "[parameters('resourceGroupName')]", + "location": "[parameters('resourceGroupLocation')]", + "apiVersion": "2019-10-01" + }, + { + "type": "Microsoft.Resources/deployments", + "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('TIENDADB', subscription().subscriptionId)))]", + "resourceGroup": "[parameters('resourceGroupName')]", + "apiVersion": "2019-10-01", + "dependsOn": [ + "[parameters('resourceGroupName')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "kind": "v12.0", + "location": "[parameters('resourceLocation')]", + "name": "tiendaserver", + "type": "Microsoft.Sql/servers", + "apiVersion": "2017-10-01-preview" + }, + { + "sku": { + "name": "Basic", + "tier": "Basic", + "capacity": 5 + }, + "kind": "v12.0,user", + "location": "[parameters('resourceLocation')]", + "name": "tiendaserver/TIENDADB", + "type": "Microsoft.Sql/servers/databases", + "apiVersion": "2017-10-01-preview", + "dependsOn": [ + "tiendaserver" + ] + } + ] + } + } + } + ], + "metadata": { + "_dependencyType": "mssql.azure" + } +} \ No newline at end of file diff --git a/src/WebAPI/Properties/ServiceDependencies/TiendaAPI - Web Deploy/profile.arm.json b/src/WebAPI/Properties/ServiceDependencies/WebAPI-Tienda - Web Deploy/profile.arm.json similarity index 99% rename from src/WebAPI/Properties/ServiceDependencies/TiendaAPI - Web Deploy/profile.arm.json rename to src/WebAPI/Properties/ServiceDependencies/WebAPI-Tienda - Web Deploy/profile.arm.json index 9988c67..41d91a7 100644 --- a/src/WebAPI/Properties/ServiceDependencies/TiendaAPI - Web Deploy/profile.arm.json +++ b/src/WebAPI/Properties/ServiceDependencies/WebAPI-Tienda - Web Deploy/profile.arm.json @@ -21,7 +21,7 @@ }, "resourceName": { "type": "string", - "defaultValue": "TiendaAPI", + "defaultValue": "WebAPI-Tienda", "metadata": { "description": "Name of the main resource to be created by this template." } diff --git a/src/WebAPI/Properties/serviceDependencies.TiendaAPI - Web Deploy.json b/src/WebAPI/Properties/serviceDependencies.TiendaAPI - Web Deploy.json deleted file mode 100644 index 8ab6ab4..0000000 --- a/src/WebAPI/Properties/serviceDependencies.TiendaAPI - Web Deploy.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "dependencies": { - "mssql1": { - "serviceConnectorResourceId": "", - "secretStore": "AzureAppSettings", - "type": "mssql.onprem", - "connectionId": "ConnectionStrings:localSQL", - "dynamicId": null - } - } -} \ No newline at end of file diff --git a/src/WebAPI/Properties/serviceDependencies.WebAPI-Tienda - Web Deploy.json b/src/WebAPI/Properties/serviceDependencies.WebAPI-Tienda - Web Deploy.json new file mode 100644 index 0000000..e5ae8d7 --- /dev/null +++ b/src/WebAPI/Properties/serviceDependencies.WebAPI-Tienda - Web Deploy.json @@ -0,0 +1,12 @@ +{ + "dependencies": { + "mssql2": { + "serviceConnectorResourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Web/sites/WebAPI-Tienda/providers/Microsoft.ServiceLinker/linkers/ConnectionStringsAzureSQL_68995FFC7D", + "secretStore": "AzureAppSettings", + "resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Sql/servers/tiendaserver/databases/TIENDADB", + "type": "mssql.azure", + "connectionId": "ConnectionStrings:AzureSQL", + "dynamicId": null + } + } +} \ No newline at end of file diff --git a/src/WebAPI/Properties/serviceDependencies.json b/src/WebAPI/Properties/serviceDependencies.json index d1e4d5d..2f0f995 100644 --- a/src/WebAPI/Properties/serviceDependencies.json +++ b/src/WebAPI/Properties/serviceDependencies.json @@ -4,6 +4,16 @@ "type": "mssql", "connectionId": "ConnectionStrings:localSQL", "dynamicId": null + }, + "secrets1": { + "type": "secrets", + "connectionId": "VaultUri", + "dynamicId": null + }, + "mssql2": { + "type": "mssql", + "connectionId": "ConnectionStrings:AzureSQL", + "dynamicId": null } } } \ No newline at end of file diff --git a/src/WebAPI/WebAPI.csproj b/src/WebAPI/WebAPI.csproj index 7452678..8da1edf 100644 --- a/src/WebAPI/WebAPI.csproj +++ b/src/WebAPI/WebAPI.csproj @@ -6,7 +6,7 @@ enable 558b52cc-0347-4758-9da5-b8f4d979b767 Linux - ..\..\Dockerfile + ..\..