Init Commit

This commit is contained in:
2025-12-12 15:40:34 -03:00
commit 5ddef72f06
78 changed files with 11451 additions and 0 deletions

View File

@@ -0,0 +1,172 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251210145015_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,88 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GestorFacturas.API.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Configuraciones",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Periodicidad = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
ValorPeriodicidad = table.Column<int>(type: "int", nullable: false),
HoraEjecucion = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
UltimaEjecucion = table.Column<DateTime>(type: "datetime2", nullable: true),
Estado = table.Column<bool>(type: "bit", nullable: false),
EnEjecucion = table.Column<bool>(type: "bit", nullable: false),
DBServidor = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
DBNombre = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
DBUsuario = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
DBClave = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
DBTrusted = table.Column<bool>(type: "bit", nullable: false),
RutaFacturas = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
RutaDestino = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
SMTPServidor = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
SMTPPuerto = table.Column<int>(type: "int", nullable: false),
SMTPUsuario = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
SMTPClave = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
SMTPSSL = table.Column<bool>(type: "bit", nullable: false),
SMTPDestinatario = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
AvisoMail = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Configuraciones", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Eventos",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Fecha = table.Column<DateTime>(type: "datetime2", nullable: false),
Mensaje = table.Column<string>(type: "nvarchar(max)", nullable: false),
Tipo = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
Enviado = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Eventos", x => x.Id);
});
migrationBuilder.InsertData(
table: "Configuraciones",
columns: new[] { "Id", "AvisoMail", "DBClave", "DBNombre", "DBServidor", "DBTrusted", "DBUsuario", "EnEjecucion", "Estado", "HoraEjecucion", "Periodicidad", "RutaDestino", "RutaFacturas", "SMTPClave", "SMTPDestinatario", "SMTPPuerto", "SMTPSSL", "SMTPServidor", "SMTPUsuario", "UltimaEjecucion", "ValorPeriodicidad" },
values: new object[] { 1, false, null, "", "TECNICA3", true, null, false, true, "00:00:00", "Dias", "", "", null, null, 587, true, null, null, null, 1 });
migrationBuilder.CreateIndex(
name: "IX_Eventos_Fecha",
table: "Eventos",
column: "Fecha");
migrationBuilder.CreateIndex(
name: "IX_Eventos_Tipo",
table: "Eventos",
column: "Tipo");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Configuraciones");
migrationBuilder.DropTable(
name: "Eventos");
}
}
}

View File

@@ -0,0 +1,207 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251210155728_AgregaAutenticacion")]
partial class AgregaAutenticacion
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
modelBuilder.Entity("Usuario", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Nombre")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Usuarios");
b.HasData(
new
{
Id = 1,
Nombre = "Administrador",
PasswordHash = "$2a$11$Z5.Cg.y.u.e.t.c.h.a.n.g.e.m.e",
Username = "admin"
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GestorFacturas.API.Migrations
{
/// <inheritdoc />
public partial class AgregaAutenticacion : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Usuarios",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Username = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: false),
Nombre = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Usuarios", x => x.Id);
});
migrationBuilder.InsertData(
table: "Usuarios",
columns: new[] { "Id", "Nombre", "PasswordHash", "Username" },
values: new object[] { 1, "Administrador", "$2a$11$Z5.Cg.y.u.e.t.c.h.a.n.g.e.m.e", "admin" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Usuarios");
}
}
}

View File

@@ -0,0 +1,207 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251210164013_UpdateAdminPassword")]
partial class UpdateAdminPassword
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
modelBuilder.Entity("GestorFacturas.API.Models.Usuario", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Nombre")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Usuarios");
b.HasData(
new
{
Id = 1,
Nombre = "Administrador",
PasswordHash = "$2a$11$l5UnZIE8bVWSUhYorVqlW.f0qgvK2zsD8aYDyTRXKjtFwwdiAfAvW",
Username = "admin"
});
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GestorFacturas.API.Migrations
{
/// <inheritdoc />
public partial class UpdateAdminPassword : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "Usuarios",
keyColumn: "Id",
keyValue: 1,
column: "PasswordHash",
value: "$2a$11$l5UnZIE8bVWSUhYorVqlW.f0qgvK2zsD8aYDyTRXKjtFwwdiAfAvW");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "Usuarios",
keyColumn: "Id",
keyValue: 1,
column: "PasswordHash",
value: "$2a$11$Z5.Cg.y.u.e.t.c.h.a.n.g.e.m.e");
}
}
}

View File

@@ -0,0 +1,249 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251210171018_AddRefreshTokens")]
partial class AddRefreshTokens
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<DateTime>("Expires")
.HasColumnType("datetime2");
b.Property<DateTime?>("Revoked")
.HasColumnType("datetime2");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("UsuarioId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UsuarioId");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("GestorFacturas.API.Models.Usuario", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Nombre")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Usuarios");
b.HasData(
new
{
Id = 1,
Nombre = "Administrador",
PasswordHash = "$2a$11$l5UnZIE8bVWSUhYorVqlW.f0qgvK2zsD8aYDyTRXKjtFwwdiAfAvW",
Username = "admin"
});
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.HasOne("GestorFacturas.API.Models.Usuario", "Usuario")
.WithMany()
.HasForeignKey("UsuarioId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Usuario");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GestorFacturas.API.Migrations
{
/// <inheritdoc />
public partial class AddRefreshTokens : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RefreshTokens",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Token = table.Column<string>(type: "nvarchar(max)", nullable: false),
Expires = table.Column<DateTime>(type: "datetime2", nullable: false),
Created = table.Column<DateTime>(type: "datetime2", nullable: false),
Revoked = table.Column<DateTime>(type: "datetime2", nullable: true),
UsuarioId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RefreshTokens", x => x.Id);
table.ForeignKey(
name: "FK_RefreshTokens_Usuarios_UsuarioId",
column: x => x.UsuarioId,
principalTable: "Usuarios",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_RefreshTokens_UsuarioId",
table: "RefreshTokens",
column: "UsuarioId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RefreshTokens");
}
}
}

View File

@@ -0,0 +1,252 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251210174020_AddIsPersistentToRefreshToken")]
partial class AddIsPersistentToRefreshToken
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<DateTime>("Expires")
.HasColumnType("datetime2");
b.Property<bool>("IsPersistent")
.HasColumnType("bit");
b.Property<DateTime?>("Revoked")
.HasColumnType("datetime2");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("UsuarioId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UsuarioId");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("GestorFacturas.API.Models.Usuario", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Nombre")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Usuarios");
b.HasData(
new
{
Id = 1,
Nombre = "Administrador",
PasswordHash = "$2a$11$l5UnZIE8bVWSUhYorVqlW.f0qgvK2zsD8aYDyTRXKjtFwwdiAfAvW",
Username = "admin"
});
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.HasOne("GestorFacturas.API.Models.Usuario", "Usuario")
.WithMany()
.HasForeignKey("UsuarioId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Usuario");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GestorFacturas.API.Migrations
{
/// <inheritdoc />
public partial class AddIsPersistentToRefreshToken : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsPersistent",
table: "RefreshTokens",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsPersistent",
table: "RefreshTokens");
}
}
}

View File

@@ -0,0 +1,252 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251211135755_IncreaseConfigColumnsSize")]
partial class IncreaseConfigColumnsSize
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<DateTime>("Expires")
.HasColumnType("datetime2");
b.Property<bool>("IsPersistent")
.HasColumnType("bit");
b.Property<DateTime?>("Revoked")
.HasColumnType("datetime2");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("UsuarioId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UsuarioId");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("GestorFacturas.API.Models.Usuario", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Nombre")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Usuarios");
b.HasData(
new
{
Id = 1,
Nombre = "Administrador",
PasswordHash = "$2a$11$l5UnZIE8bVWSUhYorVqlW.f0qgvK2zsD8aYDyTRXKjtFwwdiAfAvW",
Username = "admin"
});
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.HasOne("GestorFacturas.API.Models.Usuario", "Usuario")
.WithMany()
.HasForeignKey("UsuarioId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Usuario");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,106 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GestorFacturas.API.Migrations
{
/// <inheritdoc />
public partial class IncreaseConfigColumnsSize : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SMTPUsuario",
table: "Configuraciones",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(200)",
oldMaxLength: 200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "SMTPClave",
table: "Configuraciones",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(200)",
oldMaxLength: 200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DBUsuario",
table: "Configuraciones",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(100)",
oldMaxLength: 100,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DBClave",
table: "Configuraciones",
type: "nvarchar(500)",
maxLength: 500,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(200)",
oldMaxLength: 200,
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SMTPUsuario",
table: "Configuraciones",
type: "nvarchar(200)",
maxLength: 200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "SMTPClave",
table: "Configuraciones",
type: "nvarchar(200)",
maxLength: 200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DBUsuario",
table: "Configuraciones",
type: "nvarchar(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "DBClave",
table: "Configuraciones",
type: "nvarchar(200)",
maxLength: 200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(500)",
oldMaxLength: 500,
oldNullable: true);
}
}
}

View File

@@ -0,0 +1,249 @@
// <auto-generated />
using System;
using GestorFacturas.API.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace GestorFacturas.API.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("GestorFacturas.API.Models.Configuracion", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("AvisoMail")
.HasColumnType("bit");
b.Property<string>("DBClave")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("DBNombre")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("DBServidor")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("DBTrusted")
.HasColumnType("bit");
b.Property<string>("DBUsuario")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<bool>("EnEjecucion")
.HasColumnType("bit");
b.Property<bool>("Estado")
.HasColumnType("bit");
b.Property<string>("HoraEjecucion")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Periodicidad")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.Property<string>("RutaDestino")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("RutaFacturas")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPClave")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("SMTPDestinatario")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("SMTPPuerto")
.HasColumnType("int");
b.Property<bool>("SMTPSSL")
.HasColumnType("bit");
b.Property<string>("SMTPServidor")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SMTPUsuario")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime?>("UltimaEjecucion")
.HasColumnType("datetime2");
b.Property<int>("ValorPeriodicidad")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Configuraciones", (string)null);
b.HasData(
new
{
Id = 1,
AvisoMail = false,
DBNombre = "",
DBServidor = "TECNICA3",
DBTrusted = true,
EnEjecucion = false,
Estado = true,
HoraEjecucion = "00:00:00",
Periodicidad = "Dias",
RutaDestino = "",
RutaFacturas = "",
SMTPPuerto = 587,
SMTPSSL = true,
ValorPeriodicidad = 1
});
});
modelBuilder.Entity("GestorFacturas.API.Models.Evento", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<bool>("Enviado")
.HasColumnType("bit");
b.Property<DateTime>("Fecha")
.HasColumnType("datetime2");
b.Property<string>("Mensaje")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Tipo")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");
b.HasKey("Id");
b.HasIndex("Fecha");
b.HasIndex("Tipo");
b.ToTable("Eventos", (string)null);
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Created")
.HasColumnType("datetime2");
b.Property<DateTime>("Expires")
.HasColumnType("datetime2");
b.Property<bool>("IsPersistent")
.HasColumnType("bit");
b.Property<DateTime?>("Revoked")
.HasColumnType("datetime2");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("UsuarioId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UsuarioId");
b.ToTable("RefreshTokens");
});
modelBuilder.Entity("GestorFacturas.API.Models.Usuario", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Nombre")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("PasswordHash")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Usuarios");
b.HasData(
new
{
Id = 1,
Nombre = "Administrador",
PasswordHash = "$2a$11$l5UnZIE8bVWSUhYorVqlW.f0qgvK2zsD8aYDyTRXKjtFwwdiAfAvW",
Username = "admin"
});
});
modelBuilder.Entity("GestorFacturas.API.Models.RefreshToken", b =>
{
b.HasOne("GestorFacturas.API.Models.Usuario", "Usuario")
.WithMany()
.HasForeignKey("UsuarioId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Usuario");
});
#pragma warning restore 612, 618
}
}
}