Ajuste Revision 2 Usuarios
This commit is contained in:
parent
39db90fc07
commit
f97a42f296
@ -23,6 +23,7 @@ namespace MSAdminUsuarios.Context
|
|||||||
public virtual DbSet<PERFILPORUSUARIO> PERFILESPORUSUARIOs { get; set; } = null!;
|
public virtual DbSet<PERFILPORUSUARIO> PERFILESPORUSUARIOs { get; set; } = null!;
|
||||||
public virtual DbSet<USUARIO> USUARIOSMs { get; set; } = null!;
|
public virtual DbSet<USUARIO> USUARIOSMs { get; set; } = null!;
|
||||||
public virtual DbSet<CORREOSAREAMS> CORREOSAREAMS { get; set; } = null!;
|
public virtual DbSet<CORREOSAREAMS> CORREOSAREAMS { get; set; } = null!;
|
||||||
|
public virtual DbSet<USUARIOSTEMP> USUARIOSTEMP { get; set; } = null!;
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
@ -109,6 +110,40 @@ namespace MSAdminUsuarios.Context
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<USUARIOSTEMP>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => e.NU_PK_USUTMP)
|
||||||
|
.HasName("USUARIOSTEMP_PK");
|
||||||
|
|
||||||
|
entity.ToTable("USUARIOSTEMP");
|
||||||
|
|
||||||
|
entity.Property(e => e.NU_PK_USUTMP).HasPrecision(10);
|
||||||
|
|
||||||
|
entity.Property(e => e.FE_INICIOACTIVACION_USUTMP).HasColumnType("DATE");
|
||||||
|
|
||||||
|
entity.Property(e => e.FE_FINACTIVACION_USUTMP).HasColumnType("DATE");
|
||||||
|
|
||||||
|
entity.Property(e => e.NU_ESTADO_USUTMP).HasPrecision(10);
|
||||||
|
|
||||||
|
entity.Property(e => e.NU_TIPODOC_USUTMP).HasPrecision(10);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_CORREO_USUTMP).HasMaxLength(200);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_IDENTIFICACION_USUTMP).HasMaxLength(100);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_NOMBREPVD_USUTMP).HasMaxLength(1999);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_PRIMERAPELL_USUTMP).HasMaxLength(200);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_PRIMERNOM_USUTMP).HasMaxLength(200);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_SEGUNDOAPELL_USUTMP).HasMaxLength(200);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_SEGUNDONOM_USUTMP).HasMaxLength(200);
|
||||||
|
|
||||||
|
entity.Property(e => e.TX_TELEFONO_USUTMP).HasMaxLength(100);
|
||||||
|
});
|
||||||
|
|
||||||
OnModelCreatingPartial(modelBuilder);
|
OnModelCreatingPartial(modelBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
Microservicios/MsUsuarios/Context/USUARIOSTEMP.cs
Normal file
22
Microservicios/MsUsuarios/Context/USUARIOSTEMP.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace MSAdminUsuarios.Context
|
||||||
|
{
|
||||||
|
public partial class USUARIOSTEMP
|
||||||
|
{
|
||||||
|
public int NU_PK_USUTMP { get; set; }
|
||||||
|
public int? NU_TIPODOC_USUTMP { get; set; }
|
||||||
|
public string? TX_IDENTIFICACION_USUTMP { get; set; }
|
||||||
|
public string? TX_PRIMERNOM_USUTMP { get; set; }
|
||||||
|
public string? TX_SEGUNDONOM_USUTMP { get; set; }
|
||||||
|
public string? TX_PRIMERAPELL_USUTMP { get; set; }
|
||||||
|
public string? TX_SEGUNDOAPELL_USUTMP { get; set; }
|
||||||
|
public string? TX_NOMBREPVD_USUTMP { get; set; }
|
||||||
|
public string? TX_CORREO_USUTMP { get; set; }
|
||||||
|
public string? TX_TELEFONO_USUTMP { get; set; }
|
||||||
|
public int? NU_ESTADO_USUTMP { get; set; }
|
||||||
|
public DateTime? FE_INICIOACTIVACION_USUTMP { get; set; }
|
||||||
|
public DateTime? FE_FINACTIVACION_USUTMP { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -32,6 +32,7 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
if (login.TX_PASSWORD_USUMS == null) return BadRequest("Es necesario ingresar una contrase<73>a");
|
if (login.TX_PASSWORD_USUMS == null) return BadRequest("Es necesario ingresar una contrase<73>a");
|
||||||
|
|
||||||
USUARIO? userldap = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS);
|
USUARIO? userldap = _context.USUARIOSMs.FirstOrDefault(u => u.TX_LOGINNAME_USUMS == login.TX_LOGINNAME_USUMS);
|
||||||
|
if (userldap == null) return BadRequest("usuario");
|
||||||
if(userldap.BL_VIENELDAP_USUMS == 1)
|
if(userldap.BL_VIENELDAP_USUMS == 1)
|
||||||
{
|
{
|
||||||
bool boolldap = LoginLib.Login(login.TX_LOGINNAME_USUMS, login.TX_PASSWORD_USUMS);
|
bool boolldap = LoginLib.Login(login.TX_LOGINNAME_USUMS, login.TX_PASSWORD_USUMS);
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using MSAdminUsuarios.Context;
|
||||||
|
using MSAdminUsuarios.Models;
|
||||||
|
|
||||||
|
namespace MSAdminUsuarios.Controllers
|
||||||
|
{
|
||||||
|
[Route("[controller]")]
|
||||||
|
[ApiController]
|
||||||
|
public class UsuariosTempController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ModelContext _context;
|
||||||
|
private readonly ILogger<UsuariosTempController> _logger;
|
||||||
|
private ErrorModel _errorModel;
|
||||||
|
|
||||||
|
public UsuariosTempController(ModelContext context, ILogger<UsuariosTempController> logger)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_logger = logger;
|
||||||
|
_errorModel = new ErrorModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Get()
|
||||||
|
{
|
||||||
|
_errorModel = new ErrorModel();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<USUARIOSTEMP> externos = await _context.USUARIOSTEMP.OrderBy(q => q.NU_PK_USUTMP).ToListAsync();
|
||||||
|
|
||||||
|
return Ok(externos);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("Error con la base de datos.");
|
||||||
|
return BadRequest(_errorModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Post(USUARIOSTEMP nuevo)
|
||||||
|
{
|
||||||
|
_errorModel = new ErrorModel();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (nuevo == null)
|
||||||
|
{
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("No se envió solicitud.");
|
||||||
|
return Conflict(_errorModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
_context.USUARIOSTEMP.Add(nuevo);
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
_errorModel.error = false;
|
||||||
|
_errorModel.cuerpo.Add("Solicitud de usuario temporal guardado correctamente.");
|
||||||
|
return Ok(_errorModel);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
_errorModel.error = true;
|
||||||
|
_errorModel.cuerpo.Add("Error con la base de datos.");
|
||||||
|
return BadRequest(_errorModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -66,6 +66,12 @@ namespace MSAdminUsuarios.Utils
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channel.QueueBind(
|
||||||
|
queue: $"{exchangeName}.Usuarios",
|
||||||
|
exchange: exchangeName,
|
||||||
|
routingKey: $"{exchangeName}.Usuarios.*.*"
|
||||||
|
);
|
||||||
|
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +80,8 @@ namespace MSAdminUsuarios.Utils
|
|||||||
RabbitMQConfig mqConfig = builder.Configuration.GetSection("RabbitMQConfig").Get<RabbitMQConfig>();
|
RabbitMQConfig mqConfig = builder.Configuration.GetSection("RabbitMQConfig").Get<RabbitMQConfig>();
|
||||||
|
|
||||||
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog());
|
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog());
|
||||||
|
try
|
||||||
|
{
|
||||||
//var logger = loggerFactory.CreateLogger("Rabbit2");
|
//var logger = loggerFactory.CreateLogger("Rabbit2");
|
||||||
//logger.LogInformation("Inicia Rabbitmq con");
|
//logger.LogInformation("Inicia Rabbitmq con");
|
||||||
|
|
||||||
@ -106,6 +114,13 @@ namespace MSAdminUsuarios.Utils
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static async void ConsumeRabbitMQEvent(object? sender, BasicDeliverEventArgs ea)
|
public static async void ConsumeRabbitMQEvent(object? sender, BasicDeliverEventArgs ea)
|
||||||
|
Loading…
Reference in New Issue
Block a user