implementado hasta el ultimo paso antes de hacer la tercera notificacion
This commit is contained in:
@@ -15,19 +15,20 @@ public class NotificacionesController: ControllerBase {
|
||||
var cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new {message = "Fallo al intentar encontrar tu usuario (puede que te hayas logeado desde otro dispositivo?)"});
|
||||
|
||||
LinkedList<NotificacionDto> noti = new();
|
||||
var notificaciones = cli.NotificacioneDniclienteNavigations.Where(x=>x.Leido == leido).ToList();
|
||||
|
||||
|
||||
IQueryable<Notificacione> notificaciones = RepositorioNotificaciones.Singleton.ObtenerNotificacionesDeUsuario(cli.Dni)
|
||||
.Where(x=>x.Leido == leido);
|
||||
List<NotificacionDto> noti = new();
|
||||
Parallel.ForEach(notificaciones, i => {
|
||||
var dto = new NotificacionDtoBuilder()
|
||||
.SetRemitente(i.DniremitenteNavigation.Nombre)
|
||||
.SetRemitente(i.DniremitenteNavigation.Email)
|
||||
.SetAccion(i.Accion)
|
||||
.SetMensaje(i.Mensaje)
|
||||
.SetFecha(i.Fecha)
|
||||
.SetPropiedad(i.IdpropiedadNavigation.Ubicacion)
|
||||
.Build();
|
||||
.SetPropiedad(i.IdpropiedadNavigation.Id.ToString())
|
||||
.Build();
|
||||
|
||||
noti.AddFirst(dto);
|
||||
noti.Add(dto);
|
||||
});
|
||||
return Ok(noti);
|
||||
}
|
||||
@@ -53,7 +54,7 @@ public class NotificacionesController: ControllerBase {
|
||||
[HttpPost("api/notificaciones/consultaAlquiler")]
|
||||
public IActionResult ConsultaAlquiler([FromHeader(Name ="Auth")]string Auth, [FromBody] AltaNotificacionDto data) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
||||
bool validacion1 = RepositorioUsuarios.Singleton.CheckToken(Auth, data.Remitente);
|
||||
bool validacion1 = RepositorioUsuarios.Singleton.CheckToken(data.Remitente, Auth);
|
||||
if (validacion1 == false) return BadRequest(new {message = "el token no corresponde a su usuario"});
|
||||
|
||||
if (data.Accion == "") return BadRequest(new{message = "El campo Accion esta vacio"});
|
||||
|
||||
Reference in New Issue
Block a user