dev #48
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# CS8602: Dereference of a possibly null reference.
|
||||
dotnet_diagnostic.CS8602.severity = suggestion
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,3 +7,5 @@
|
||||
/Entidades/obj/
|
||||
/Aspnet/obj/
|
||||
/Modelo/bin/
|
||||
Aspnet/bin/
|
||||
node_modules/
|
||||
@@ -9,6 +9,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
|
||||
<PackageReference Include="minio" Version="6.0.3" />
|
||||
<PackageReference Include="QuestPDF" Version="2024.12.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
9
Aspnet/Builder/Builder.cs
Normal file
9
Aspnet/Builder/Builder.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Minio.Helper;
|
||||
|
||||
public abstract class Builder<T> where T:new() {
|
||||
protected T data = new T();
|
||||
public T Build() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
35
Aspnet/Builder/DtoBuilder/CanonDtoBuilder.cs
Normal file
35
Aspnet/Builder/DtoBuilder/CanonDtoBuilder.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Entidades.Dto;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
|
||||
public class CanonDtoBuilder : Builder<CanonDto>{
|
||||
public CanonDtoBuilder SetId(long id) {
|
||||
data.Id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CanonDtoBuilder SetMesNum(int mesNum) {
|
||||
data.MesNum = mesNum;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CanonDtoBuilder SetMes(DateTime d){
|
||||
data.Mes = d;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CanonDtoBuilder SetMonto(Decimal monto) {
|
||||
data.Monto = monto;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CanonDtoBuilder SetDivisa(string divisa) {
|
||||
data.Divisa = divisa;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CanonDtoBuilder SetPago(bool p) {
|
||||
data.Pago = p;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
50
Aspnet/Builder/DtoBuilder/ContratoDtoBuilder.cs
Normal file
50
Aspnet/Builder/DtoBuilder/ContratoDtoBuilder.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Entidades.Dto;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
public class ContratoDtoBuilder: Builder<ContratoDto> {
|
||||
public ContratoDtoBuilder SetId(long id ){
|
||||
data.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoDtoBuilder SetUbicacion(string ub){
|
||||
data.Ubicacion = ub;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoDtoBuilder SetTipo(string tipo){
|
||||
data.TipoPropiedad = tipo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoDtoBuilder SetFechaInicio(DateTime fec) {
|
||||
data.Fechainicio = fec;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoDtoBuilder SetInquilino(string inquilino){
|
||||
data.Inquilino = inquilino;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoDtoBuilder SetPropietario(string propietario){
|
||||
data.Propietario = propietario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoDtoBuilder SetEstado(ulong habilitado, ulong cancelado) {
|
||||
bool Habilitado = habilitado == 0?false:true;
|
||||
bool Cancelado = cancelado == 0?false:true;
|
||||
|
||||
if (Habilitado == true && Cancelado == false){
|
||||
data.Estado = "Alquiler Iniciado";
|
||||
} else if (Cancelado == true && Habilitado == false) {
|
||||
data.Estado = "Nunca Empezo Esta Cancelado";
|
||||
} else if (Habilitado == false && Cancelado ==false){
|
||||
data.Estado = "Esta en Proceso";
|
||||
} else if (Habilitado == true && Cancelado == true){
|
||||
data.Estado = "Terminado";
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
75
Aspnet/Builder/DtoBuilder/ContratoPropiedadDtoBuilder.cs
Normal file
75
Aspnet/Builder/DtoBuilder/ContratoPropiedadDtoBuilder.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Entidades.Dto;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
public class ContratoPropiedadDtoBuilder : Builder<ContratoPropiedadDto>{
|
||||
public ContratoPropiedadDtoBuilder SetId(long id ){
|
||||
data.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetUbicacion(string ub){
|
||||
data.Ubicacion = ub;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetTipo(string tipo){
|
||||
data.TipoPropiedad = tipo;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetFechaInicio(DateTime fec) {
|
||||
data.Fechainicio = fec;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetInquilino(string inquilino){
|
||||
data.Inquilino = inquilino;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetPropietario(string propietario){
|
||||
data.Propietario = propietario;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetEstado(ulong habilitado, ulong cancelado) {
|
||||
bool Habilitado = habilitado == 0?false:true;
|
||||
bool Cancelado = cancelado == 0?false:true;
|
||||
|
||||
if (Habilitado == true && Cancelado == false){
|
||||
data.Estado = "Alquiler Iniciado";
|
||||
} else if (Cancelado == true && Habilitado == false) {
|
||||
data.Estado = "Nunca Empezo Esta Cancelado";
|
||||
} else if (Habilitado == false && Cancelado ==false){
|
||||
data.Estado = "Esta en Proceso";
|
||||
} else if (Habilitado == true && Cancelado == true){
|
||||
data.Estado = "Terminado";
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetHabitaciones(int habitaciones){
|
||||
data.Habitaciones = habitaciones;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetPiso(int piso){
|
||||
data.Piso = piso;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetLetra(string letra){
|
||||
data.Letra = letra;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetMesesAumento(int mesesAumento){
|
||||
data.MesesAumento = mesesAumento;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContratoPropiedadDtoBuilder SetMesesDuracion(int mesesDurationContrato) {
|
||||
data.MesesDuracion = mesesDurationContrato;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
34
Aspnet/Builder/DtoBuilder/DefectoDtoBuilder.cs
Normal file
34
Aspnet/Builder/DtoBuilder/DefectoDtoBuilder.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Entidades.Dto;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
public class DefectoDtoBuilder: Builder<DefectoDto> {
|
||||
public DefectoDtoBuilder SetId(long id) {
|
||||
data.Id = id;
|
||||
return this;
|
||||
}
|
||||
public DefectoDtoBuilder SetDesc(string Descripcion){
|
||||
data.Descripcion = Descripcion;
|
||||
return this;
|
||||
}
|
||||
public DefectoDtoBuilder SetCosto(Decimal Costo){
|
||||
data.Costo = Costo;
|
||||
return this;
|
||||
}
|
||||
public DefectoDtoBuilder SetEstado(string estado){
|
||||
data.Estado = estado;
|
||||
return this;
|
||||
}
|
||||
public DefectoDtoBuilder SetIdContrato(long id){
|
||||
data.Idcontrato = id;
|
||||
return this;
|
||||
|
||||
}
|
||||
public DefectoDtoBuilder SetPagaInquilino(ulong pag){
|
||||
data.Pagainquilino=pag==1?"Si":"No";
|
||||
return this;
|
||||
}
|
||||
public DefectoDtoBuilder SetDivisa(string divisa){
|
||||
data.Divisa = divisa;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
36
Aspnet/Builder/DtoBuilder/GaranteDtoBuilder.cs
Normal file
36
Aspnet/Builder/DtoBuilder/GaranteDtoBuilder.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Entidades.Dto;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
public class GaranteDtoBuilder : Builder<GaranteDto> {
|
||||
|
||||
public GaranteDtoBuilder SetDni (long Dni) {
|
||||
data.Dni = Dni;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteDtoBuilder SetNombre (string Nombre) {
|
||||
data.Nombre = Nombre;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteDtoBuilder SetApellido (string Apellido) {
|
||||
data.Apellido = Apellido;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteDtoBuilder SetDomicilio (string Domicilio) {
|
||||
data.Domicilio = Domicilio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteDtoBuilder SetCelular (string Celular) {
|
||||
data.Celular = Celular;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteDtoBuilder SetDomicilioLaboral (string Domiciliolaboral) {
|
||||
data.Domiciliolaboral = Domiciliolaboral;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
17
Aspnet/Builder/DtoBuilder/InformeAlquilerBuilder.cs
Normal file
17
Aspnet/Builder/DtoBuilder/InformeAlquilerBuilder.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Entidades.Informes;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
public class InformesAlquilerBuilder: Builder<InformesAlquiler>{
|
||||
public InformesAlquilerBuilder SetId(long id){
|
||||
data.Id = id;
|
||||
return this;
|
||||
}
|
||||
public InformesAlquilerBuilder SetUbicacion(string Ubicacion){
|
||||
data.Ubicacion = Ubicacion;
|
||||
return this;
|
||||
}
|
||||
public InformesAlquilerBuilder SetDivisa(string Divisa){
|
||||
data.Divisa = Divisa;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
34
Aspnet/Builder/DtoBuilder/NotificacionDtoBuilder.cs
Normal file
34
Aspnet/Builder/DtoBuilder/NotificacionDtoBuilder.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace AlquilaFacil.Builder;
|
||||
using Entidades.Dto;
|
||||
public class NotificacionDtoBuilder: Builder<NotificacionDto> {
|
||||
|
||||
public NotificacionDtoBuilder SetRemitente(string remitente) {
|
||||
data.Remitente = remitente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacionDtoBuilder SetAccion(string accion) {
|
||||
data.Accion = accion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacionDtoBuilder SetMensaje(string mensaje) {
|
||||
data.Mensaje = mensaje;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacionDtoBuilder SetFecha(DateTime? fecha) {
|
||||
data.Fecha = fecha;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacionDtoBuilder SetPropiedad(string propiedad) {
|
||||
data.Propiedad = propiedad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacionDtoBuilder SetReceptor(string receptor) {
|
||||
data.Receptor = receptor;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
35
Aspnet/Builder/GaranteBuilder.cs
Normal file
35
Aspnet/Builder/GaranteBuilder.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Entidades;
|
||||
|
||||
namespace AlquilaFacil.Builder;
|
||||
|
||||
public class GaranteBuilder : Builder<Garante> {
|
||||
public GaranteBuilder SetNombre(string Nombre) {
|
||||
data.Nombre = Nombre;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteBuilder SetApellido(string Apellido) {
|
||||
data.Apellido = Apellido;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteBuilder SetDni(long Dni) {
|
||||
data.Dni = Dni;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteBuilder SetDomicilio(string Domicilio) {
|
||||
data.Domicilio = Domicilio;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteBuilder SetCelular(string Celular) {
|
||||
data.Celular = Celular;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GaranteBuilder SetDomicilioLaboral(string Domiciliolaboral) {
|
||||
data.Domiciliolaboral = Domiciliolaboral;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
40
Aspnet/Builder/NotificacionBuilder.cs
Normal file
40
Aspnet/Builder/NotificacionBuilder.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using Entidades;
|
||||
|
||||
public class NotificacioneBuilder : Builder<Notificacione>
|
||||
{
|
||||
public NotificacioneBuilder SetDnicliente(long dnicliente) {
|
||||
data.Dnicliente = dnicliente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacioneBuilder SetDniremitente(long dniremitente) {
|
||||
data.Dniremitente = dniremitente;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacioneBuilder SetFecha(DateTime fecha) {
|
||||
data.Fecha = fecha;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacioneBuilder SetMensaje(string mensaje) {
|
||||
data.Mensaje = mensaje;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacioneBuilder SetAccion(string accion) {
|
||||
data.Accion = accion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacioneBuilder SetIdpropiedad(int idpropiedad) {
|
||||
data.Idpropiedad = idpropiedad;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotificacioneBuilder SetLeido(bool leido) {
|
||||
data.Leido = leido;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
50
Aspnet/Builder/PrecontratoBuilder.cs
Normal file
50
Aspnet/Builder/PrecontratoBuilder.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
namespace AlquilaFacil.Builder;
|
||||
|
||||
using System;
|
||||
using Entidades;
|
||||
public class PrecontratoBuilder : Builder<Contrato> {
|
||||
public PrecontratoBuilder SetHabilitado(){
|
||||
data.Habilitado = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetInquilino(long dniInq) {
|
||||
data.Dniinquilino = dniInq;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetPropietario(long dniProp) {
|
||||
data.Dnipropietario = dniProp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetPropiedad(int idprop) {
|
||||
data.Idpropiedad = idprop;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetCantidadGarantes(int cantgarante) {
|
||||
data.Cantgarantemin = cantgarante;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetIndiceActializacionInicial() {
|
||||
data.Indiceactualizacion = 0.000M;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetMesesHastaAumento(int meses) {
|
||||
data.MesesHastaAumento = meses;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetFecha(DateTime fechaprimernotificacion){
|
||||
data.Fechainicio = fechaprimernotificacion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PrecontratoBuilder SetMesesDuracion(int mesesDuracionContrato){
|
||||
data.MesesDurationContrato = mesesDuracionContrato;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
5
Aspnet/Config/MinioConfig.cs
Normal file
5
Aspnet/Config/MinioConfig.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace AlquilaFacil.Config;
|
||||
public class MinioConfigcus {
|
||||
public string usr { get; set; } ="";
|
||||
public string scrt { get; set; } = "";
|
||||
}
|
||||
@@ -1,24 +1,40 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
using System.Text.Json;
|
||||
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class AccionesController: ControllerBase {
|
||||
|
||||
[HttpPost("api/acciones")]
|
||||
public IActionResult ListarAccionesPorUsuario([FromBody] LoginDto email, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (email.Email == "" || email.Email == null) return BadRequest();
|
||||
|
||||
[HttpGet("api/acciones")]
|
||||
public IActionResult ListarAccionesPorUsuario([FromHeader(Name ="Email")] string Email, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (Email == "" || Email == null) return BadRequest();
|
||||
|
||||
if (Auth == "") return Unauthorized(new { esValido = false});
|
||||
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(email.Email, Auth);
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(Email, Auth);
|
||||
if (!esValido) return Unauthorized();
|
||||
|
||||
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(email.Email);
|
||||
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(Email);
|
||||
Response.Headers["Content-Type"] = "application/json";
|
||||
return Ok(Permisos);
|
||||
}
|
||||
|
||||
[HttpPost("api/acciones/grupo")]
|
||||
public IActionResult ListarAccionesPorGrupo([FromHeader(Name = "Auth")] string Auth,
|
||||
[FromBody] AccionesPorGrupoDto req) {
|
||||
if (string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(req.Email, Auth);
|
||||
if (esValido == false) return BadRequest(esValido);
|
||||
|
||||
bool tieneGrupo = RepositorioUsuarios.Singleton.CheckGrupo(req.Email, req.Grupo);
|
||||
if (tieneGrupo == false) return Unauthorized();
|
||||
|
||||
var permisos = RepositorioGrupos.Singleton.ListarPermisosDeGrupo(req.Grupo);
|
||||
return Ok(permisos);
|
||||
}
|
||||
}
|
||||
152
Aspnet/Controllers/AdminController.cs
Normal file
152
Aspnet/Controllers/AdminController.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
using Entidades.Admin;
|
||||
using Entidades.Dto;
|
||||
using Entidades;
|
||||
using System.Linq.Expressions;
|
||||
using AlquilaFacil.StrategyBusquedaAdmin;
|
||||
using System.Diagnostics;
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class AdminController: ControllerBase
|
||||
{
|
||||
[HttpGet("api/admin/clientes")]
|
||||
public IActionResult GetClientes([FromHeader(Name ="Auth")]string Auth){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
IEnumerable<UsuarioAdmin>list = RepositorioUsuarios.Singleton.GetClientes();
|
||||
return Ok(list);
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/clientes/grupo")]
|
||||
public IActionResult GetGruposByCliente([FromHeader(Name ="Auth")]string Auth, [FromQuery]long Dni){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (Dni <= 0) return BadRequest(new {message = "No puede tener un dni con numero negativo o cero"});
|
||||
|
||||
IEnumerable<GrupoAdmin> list = RepositorioGrupos.Singleton.ObtenerGruposPorDni(Dni);
|
||||
return Ok(list);
|
||||
}
|
||||
[HttpPatch("api/admin/cliente/addGrupo")]
|
||||
public IActionResult AddGrupoACliente([FromHeader(Name = "Auth")]string Auth, [FromBody]EmailGrupo data){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (data.email == "" || data.grupo == "") return BadRequest(new { message = "Faltan datos en la request" });
|
||||
|
||||
var ret = RepositorioUsuarios.Singleton.CheckGrupo(data.email, data.grupo);
|
||||
if (ret) return BadRequest(new { message = $"El usuario ya pertenece al grupo {data.grupo}"});
|
||||
|
||||
var ret2 = RepositorioUsuarios.Singleton.AñadirClienteAGrupo(data.email, data.grupo);
|
||||
|
||||
return ret2 ? Ok(new {message = "Se Añadio al Grupo"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
||||
}
|
||||
|
||||
[HttpPatch("api/admin/cliente/rmGrupo")]
|
||||
public IActionResult RmGrupoACliente([FromHeader(Name = "Auth")]string Auth, [FromBody]EmailGrupo data){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (data.email == "" || data.grupo == "") return BadRequest(new { message = "Faltan datos en la request" });
|
||||
|
||||
//una ward para que no me bloquee a mi mismo de tener acceso a admin
|
||||
if (data.email == "celu@fedesrv.ddns.net" && data.grupo == "Admin") return BadRequest(new { message = "Si hago esto me estaria bloqueando la cuenta a mi mismo" });
|
||||
|
||||
var ret = RepositorioUsuarios.Singleton.CheckGrupo(data.email, data.grupo);
|
||||
if (!ret) return BadRequest(new { message = $"El usuario no pertenece al grupo {data.grupo}"});
|
||||
|
||||
if (data.grupo == "Propietario") {
|
||||
IQueryable<PropiedadesDto> ret3 = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(data.email);
|
||||
if (ret3.Count() > 0){
|
||||
bool ret4 = RepositorioPropiedades.Singleton.BajaPropiedades(data.email);
|
||||
if (ret4 == false) return BadRequest(new { message = "No se pudo dar de baja las propiedades"});
|
||||
}
|
||||
}
|
||||
if (data.grupo == "Inquilino") {
|
||||
var ret5 = RepositorioContratos.Singleton.ObtenerContratosPorEmailInquilino(data.email);
|
||||
if ( ret5 == null || ret5.Where(x=>x.Habilitado == 0).Count() > 0) return BadRequest(new { message = "Aun tenes alquileres pendientes o fallo al intentar obtener la lista de alquileres, no se puede dar de baja"});
|
||||
}
|
||||
|
||||
var ret2 = RepositorioUsuarios.Singleton.EliminarClienteAGrupo(data.email, data.grupo);
|
||||
return ret2 ? Ok(new {message = $"Se elimino del Grupo: {data.grupo}"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
||||
}
|
||||
|
||||
[HttpDelete("api/admin/cliente")]
|
||||
public IActionResult BajaCliente([FromHeader(Name ="Auth")]string Auth, long Dni){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if ( Dni <=0) return BadRequest(new {message = "No puede tener un Dni menor o igual a 0"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorDni(Dni);
|
||||
|
||||
if (cli == null) return BadRequest(new {message = "No existe un cliente con ese numero de dni"});
|
||||
|
||||
bool esPropietario = RepositorioUsuarios.Singleton.CheckGrupo(cli.Email, "Propietario");
|
||||
bool esInquilino = RepositorioUsuarios.Singleton.CheckGrupo(cli.Email, "Inquilino");
|
||||
|
||||
if (esPropietario) {
|
||||
IQueryable<PropiedadesDto> ret3 = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(cli.Email);
|
||||
if (ret3.Count() > 0){
|
||||
bool ret4 = RepositorioPropiedades.Singleton.BajaPropiedades(cli.Email);
|
||||
if (ret4 == false) return BadRequest(new { message = "No se pudo dar de baja las propiedades"});
|
||||
}
|
||||
}
|
||||
|
||||
if (esInquilino) {
|
||||
var ret5 = RepositorioContratos.Singleton.ObtenerContratosPorEmailInquilino(cli.Email);
|
||||
if ( ret5 == null || ret5.Where(x=>x.Habilitado == 0).Count() > 0) return BadRequest(new { message = "Aun tenes alquileres pendientes o fallo al intentar obtener la lista de alquileres, no se puede dar de baja"});
|
||||
}
|
||||
// lo da de baja si no tiene el grupo propietario y no tiene alquileres pendientes
|
||||
var ret = RepositorioUsuarios.Singleton.BajaCliente(Dni);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpDelete("api/admin/propiedad")]
|
||||
public IActionResult BajaPropiedad([FromHeader(Name = "Auth")] string Auth, int id = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (id <= 0) return BadRequest(new { message = "Falto indicar id Propiedad"});
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id);
|
||||
return ret ?
|
||||
Ok(new {message = "Se cambio el estado de la propiedad"}): BadRequest(new { message = "No se pudo dar de baja"});
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/busqueda/paginada")]
|
||||
public IActionResult FiltroPropiedadesPaginado([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "", int pag = 1) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
IQueryable<PropiedadesAdmin>? props = null;
|
||||
pag -= 1;
|
||||
|
||||
var clave = $"{(cantidadHabitaciones != 0 ? "1" : "0")}{(tipoPropiedad != 0 ? "1" : "0")}{(!string.IsNullOrEmpty(servicios) ? "1" : "0")}";
|
||||
var gen = AdminBusquedaContext.Singleton;
|
||||
var estrategia = gen.ObtenerEstrategia(clave);
|
||||
props = estrategia.Filtrar(servicios, cantidadHabitaciones, tipoPropiedad, pag);
|
||||
|
||||
return Ok(props);
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/busqueda/cantPag")]
|
||||
public IActionResult CantidadPaginas([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "") {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
int ret = RepositorioPropiedades.Singleton.CuantasPaginasBusqueda(cantidadHabitaciones, servicios, tipoPropiedad, 0);
|
||||
return Ok(new { message = ret});
|
||||
}
|
||||
}
|
||||
38
Aspnet/Controllers/BusquedaControler.cs
Normal file
38
Aspnet/Controllers/BusquedaControler.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Entidades.Dto;
|
||||
using Modelo;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Entidades.Admin;
|
||||
using AlquilaFacil.StrategyBusqueda;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class BusquedaController: ControllerBase {
|
||||
[HttpGet("api/busqueda")]
|
||||
public IActionResult FiltroPropiedades([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "") {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 3);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
IQueryable<PropiedadesDto>? props = null;
|
||||
|
||||
var clave = $"{(cantidadHabitaciones != 0 ? "1" : "0")}{(tipoPropiedad != 0 ? "1" : "0")}{(!string.IsNullOrEmpty(servicios) ? "1" : "0")}";
|
||||
|
||||
var gen = BusquedaContext.Singleton;
|
||||
var estrategia = gen.ObtenerEstrategia(clave);
|
||||
props = estrategia.Filtrar(servicios, cantidadHabitaciones, tipoPropiedad);
|
||||
|
||||
return Ok(props);
|
||||
}
|
||||
|
||||
[HttpGet("api/busqueda/cantPag")]
|
||||
public IActionResult GetCantPag([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "") {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 3);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
int ret = RepositorioPropiedades.Singleton.CuantasPaginasBusqueda(cantidadHabitaciones, servicios, tipoPropiedad, 1);
|
||||
return Ok(new { message = ret});
|
||||
|
||||
}
|
||||
}
|
||||
822
Aspnet/Controllers/ContratoController.cs
Normal file
822
Aspnet/Controllers/ContratoController.cs
Normal file
@@ -0,0 +1,822 @@
|
||||
using System.Net;
|
||||
using System.Text.Json;
|
||||
using AlquilaFacil.Builder;
|
||||
using AlquilaFacil.Config;
|
||||
using AlquilaFacil.Facade;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minio;
|
||||
using Minio.DataModel;
|
||||
using Minio.DataModel.Args;
|
||||
using Minio.Exceptions;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class ContratoController: ControllerBase {
|
||||
|
||||
[HttpPost("api/contrato/GenerarRecibo")]
|
||||
public ActionResult GenerarRecibo([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto, bool html= true) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false){
|
||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) {
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
|
||||
if (dto.Idcontrato <= 0) return BadRequest(new { message = "No puede tener un contrato con id 0 o menor"});
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(dto.Idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "No hay un contrato por ese id"});
|
||||
|
||||
if (cont.DniinquilinoNavigation == null || cont.DnipropietarioNavigation == null || cont.IdpropiedadNavigation == null ||
|
||||
cont.IdpropiedadNavigation.IdtipropiedadNavigation == null) return BadRequest(new { message = "comunicate con el admin esta mal cargado el contratod de alguina forma"});
|
||||
|
||||
Canon? can = RepositorioCanons.Singleton.ObtenerCanonContrato(dto.fecha, dto.Idcontrato);
|
||||
if (can == null) return BadRequest(new { message = "no hay un canon para ese contrato con esa fecha"});
|
||||
if (can.IdreciboNavigation == null) return BadRequest(new { message = "No hay un recibo para ese canon"});
|
||||
|
||||
var cdb = new ContratoDtoBuilder()
|
||||
.SetInquilino($"{cont.DniinquilinoNavigation.Nombre} {cont.DniinquilinoNavigation.Apellido}")
|
||||
.SetUbicacion(cont.IdpropiedadNavigation.Ubicacion)
|
||||
.SetPropietario($"{cont.DnipropietarioNavigation.Nombre} {cont.DnipropietarioNavigation.Apellido}")
|
||||
.SetId(cont.Id)
|
||||
.SetTipo(cont.IdpropiedadNavigation.IdtipropiedadNavigation.Descripcion)
|
||||
.SetFechaInicio(cont.Fechainicio)
|
||||
.SetEstado(cont.Habilitado, cont.Cancelado)
|
||||
.Build();
|
||||
|
||||
var dof = new DocumentoFacade();
|
||||
MemoryStream? memstr = new();
|
||||
if (html){
|
||||
dof.GenerarHtml(cdb, can.IdreciboNavigation, memstr);
|
||||
return File(memstr, "text/html", "Recibo.html");
|
||||
} else {
|
||||
dof.GenerarPdf (cdb, can.IdreciboNavigation, memstr);
|
||||
return File(memstr, "application/pdf", "Recibo.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/marcarPago")]
|
||||
public IActionResult marcarPago([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false)return Unauthorized();
|
||||
if (dto.Idcontrato<=0) return BadRequest(new { message = "No puede existir un contrato con id 0 o menor"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null)return Unauthorized();
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(dto.Idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "No hay un contrato por esa id"});
|
||||
|
||||
if (cli.Dni != cont.Dnipropietario) return BadRequest(new {message = "No sos propietario o intenta volviendote a logear"});
|
||||
|
||||
Canon? c = RepositorioCanons.Singleton.ObtenerCanonContrato(dto.fecha, dto.Idcontrato);
|
||||
if (c == null) return BadRequest(new { message = "no hay un canon por esa id"});
|
||||
|
||||
Recibo re = new Recibo{
|
||||
Monto = c.Monto,
|
||||
Fecha = c.Fecha,
|
||||
};
|
||||
|
||||
bool ret = RepositorioCanons.Singleton.SetRecibo(c, re);
|
||||
return ret ?
|
||||
Ok(new { message = "Se guardo correctamente"}):BadRequest(new { message = "No se pudo guardar"});
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/realizarPago")]
|
||||
public IActionResult realizarPago([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
if (dto.Idcontrato<=0) return BadRequest(new { message = "No puede existir un contrato con id 0 o menor"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null)return Unauthorized();
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(dto.Idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "No hay un contrato por esa id"});
|
||||
|
||||
if (cli.Dni != cont.Dniinquilino) return BadRequest(new {message = "No sos inquilino o intenta volviendote a logear"});
|
||||
|
||||
Canon? c = RepositorioCanons.Singleton.ObtenerCanonContrato(dto.fecha, dto.Idcontrato);
|
||||
if (c == null) return BadRequest(new { message = "no hay un canon por esa id"});
|
||||
|
||||
Recibo re = new Recibo{
|
||||
Monto = c.Monto,
|
||||
Fecha = c.Fecha,
|
||||
};
|
||||
|
||||
bool ret = RepositorioCanons.Singleton.SetRecibo(c, re);
|
||||
return ret ?
|
||||
Ok(new { message = "Se guardo correctamente"}):BadRequest(new { message = "No se pudo guardar"});
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/crearcanons")]
|
||||
public IActionResult crearCanons([FromHeader(Name="Auth")]string Auth, CrearCanonsDto dto){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false)return Unauthorized();
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return Unauthorized();
|
||||
|
||||
if (dto.idcontrato <=0) return BadRequest(new { message ="estan mal cargados los datos"});
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(dto.idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "no hay un contrato por esa id"});
|
||||
if (cli.Dni != cont.Dnipropietario) return BadRequest(new {message = "No sos el propietario o intenta volviendote a logear"});
|
||||
|
||||
var ret = RepositorioCanons.Singleton.CrearCanons(dto.aumento, dto.idcontrato);
|
||||
return ret ?
|
||||
Ok(new { message = "Se crearon los canons correctamente"}):BadRequest(new { message = "No se pudo guardar"});
|
||||
}
|
||||
|
||||
[HttpGet("api/contratos/canon")]
|
||||
public ActionResult getCanons([FromHeader(Name="Auth")]string Auth, int id = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false){
|
||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) {
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if(cli == null) return Unauthorized();
|
||||
|
||||
var cont = RepositorioContratos.Singleton.ObtenerContratoPorId(id);
|
||||
if (cont == null) return BadRequest(new { message = "No existe el contrato"});
|
||||
if ( cont.Dnipropietario != cli.Dni && cont.Dniinquilino != cli.Dni) return Unauthorized();
|
||||
|
||||
var list = RepositorioCanons.Singleton.ObtenerCanonsPorContrato(id);
|
||||
if (list == null) return BadRequest(new { message = "No hay contrato por esa id"});
|
||||
|
||||
string divisa ="";
|
||||
if (cont.Iddivisa == 0) divisa = "AR$"; else if (cont.Iddivisa == 1) divisa = "US$";
|
||||
|
||||
List<CanonDto> d = new();
|
||||
|
||||
foreach (var i in list) {
|
||||
var c = new CanonDtoBuilder()
|
||||
.SetId(i.Id)
|
||||
.SetPago(i.Idrecibo==null?false:true)
|
||||
.SetDivisa(divisa==""?"Ugh esta mal cargado la divisa en el contrato":divisa)
|
||||
.SetMes(i.Fecha)
|
||||
.SetMesNum(int.Parse((i.Fecha.Month - cont.Fechainicio.Month).ToString()) + 1)
|
||||
.SetMonto(i.Monto)
|
||||
.Build();
|
||||
d.Add(c);
|
||||
}
|
||||
|
||||
return Ok(d);
|
||||
}
|
||||
|
||||
[HttpGet("api/contratos/propietario")]
|
||||
public IActionResult ObtenerContratosPorPropietario([FromHeader(Name="Auth")]string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli==null) return Unauthorized();
|
||||
|
||||
var list = RepositorioContratos.Singleton.ObtenerContratosDePropietario(cli.Dni);
|
||||
|
||||
List<ContratoDto> dtos = new();
|
||||
foreach (var i in list) {
|
||||
if (i.DniinquilinoNavigation == null || i.IdpropiedadNavigation == null
|
||||
|| i.DnipropietarioNavigation == null) continue;
|
||||
|
||||
var cont = new ContratoDtoBuilder()
|
||||
.SetInquilino($"{i.DniinquilinoNavigation.Nombre} {i.DniinquilinoNavigation.Apellido}")
|
||||
.SetUbicacion(i.IdpropiedadNavigation.Ubicacion)
|
||||
.SetId(i.Id)
|
||||
.SetPropietario($"{i.DnipropietarioNavigation.Nombre} {i.DnipropietarioNavigation.Apellido}")
|
||||
.SetTipo(i.IdpropiedadNavigation.IdtipropiedadNavigation.Descripcion)
|
||||
.SetFechaInicio(i.Fechainicio)
|
||||
.SetEstado(i.Habilitado, i.Cancelado)
|
||||
.Build();
|
||||
dtos.Add(cont);
|
||||
}
|
||||
return Ok(dtos);
|
||||
}
|
||||
|
||||
[HttpGet("api/contrato/propietario")]
|
||||
public IActionResult ObtenerContratoPorPropietarioPorId([FromHeader(Name="Auth")]string Auth, int id=0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli==null) return Unauthorized();
|
||||
|
||||
if (id <= 0) return BadRequest(new { message = "No hay propiedades con id igual o menor a 0"});
|
||||
var i = RepositorioContratos.Singleton.ObtenerContratoPorId(id);
|
||||
if (i == null || i.DniinquilinoNavigation == null ||
|
||||
i.IdpropiedadNavigation == null || i.DnipropietarioNavigation == null)return BadRequest(new { message = "Fallo la query"});
|
||||
if (cli.Dni != i.Dnipropietario) return BadRequest(new { message = "No sos el propietario"});
|
||||
|
||||
var cont = new ContratoPropiedadDtoBuilder()
|
||||
.SetInquilino($"{i.DniinquilinoNavigation.Nombre} {i.DniinquilinoNavigation.Apellido}")
|
||||
.SetUbicacion(i.IdpropiedadNavigation.Ubicacion)
|
||||
.SetId(i.Id)
|
||||
.SetPropietario($"{i.DnipropietarioNavigation.Nombre} {i.DnipropietarioNavigation.Apellido}")
|
||||
.SetTipo(i.IdpropiedadNavigation.IdtipropiedadNavigation.Descripcion)
|
||||
.SetFechaInicio(i.Fechainicio)
|
||||
.SetEstado(i.Habilitado, i.Cancelado)
|
||||
.SetHabitaciones(i.IdpropiedadNavigation.Canthabitaciones)
|
||||
.SetPiso(i.IdpropiedadNavigation.Piso??0)
|
||||
.SetLetra(i.IdpropiedadNavigation.Letra??"")
|
||||
.SetMesesAumento(i.MesesHastaAumento)
|
||||
.SetMesesDuracion(i.MesesDurationContrato)
|
||||
.Build();
|
||||
|
||||
return Ok(cont);
|
||||
}
|
||||
|
||||
[HttpGet("api/contratos/inquilino")]
|
||||
public IActionResult ObtenerContratosPorInquilino([FromHeader(Name="Auth")]string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli==null) return Unauthorized();
|
||||
|
||||
var list = RepositorioContratos.Singleton.ObtenerContratosDeInquilino(cli.Dni);
|
||||
|
||||
List<ContratoDto> dtos = new();
|
||||
foreach (var i in list) {
|
||||
if (i.DniinquilinoNavigation == null || i.IdpropiedadNavigation == null
|
||||
|| i.DnipropietarioNavigation == null) continue;
|
||||
|
||||
var cont = new ContratoDtoBuilder()
|
||||
.SetInquilino($"{i.DniinquilinoNavigation.Nombre} {i.DniinquilinoNavigation.Apellido}")
|
||||
.SetUbicacion(i.IdpropiedadNavigation.Ubicacion)
|
||||
.SetPropietario($"{i.DnipropietarioNavigation.Nombre} {i.DnipropietarioNavigation.Apellido}")
|
||||
.SetId(i.Id)
|
||||
.SetTipo(i.IdpropiedadNavigation.IdtipropiedadNavigation.Descripcion)
|
||||
.SetFechaInicio(i.Fechainicio)
|
||||
.SetEstado(i.Habilitado, i.Cancelado)
|
||||
.Build();
|
||||
dtos.Add(cont);
|
||||
}
|
||||
return Ok(dtos);
|
||||
}
|
||||
|
||||
[HttpGet("api/contrato/inquilino")]
|
||||
public IActionResult ObtenerContratoPorInquilinoPorId([FromHeader(Name="Auth")]string Auth, int id=0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli==null) return Unauthorized();
|
||||
|
||||
if (id <= 0) return BadRequest(new { message = "No hay propiedades con id igual o menor a 0"});
|
||||
var i = RepositorioContratos.Singleton.ObtenerContratoPorId(id);
|
||||
if (i == null || i.DniinquilinoNavigation == null ||
|
||||
i.IdpropiedadNavigation == null || i.DnipropietarioNavigation == null)return BadRequest(new { message = "Fallo la query"});
|
||||
if (cli.Dni != i.Dniinquilino) return BadRequest(new { message = "No sos el inquilino"});
|
||||
|
||||
var cont = new ContratoPropiedadDtoBuilder()
|
||||
.SetInquilino($"{i.DniinquilinoNavigation.Nombre} {i.DniinquilinoNavigation.Apellido}")
|
||||
.SetUbicacion(i.IdpropiedadNavigation.Ubicacion)
|
||||
.SetId(i.Id)
|
||||
.SetPropietario($"{i.DnipropietarioNavigation.Nombre} {i.DnipropietarioNavigation.Apellido}")
|
||||
.SetTipo(i.IdpropiedadNavigation.IdtipropiedadNavigation.Descripcion)
|
||||
.SetFechaInicio(i.Fechainicio)
|
||||
.SetEstado(i.Habilitado, i.Cancelado)
|
||||
.SetHabitaciones(i.IdpropiedadNavigation.Canthabitaciones)
|
||||
.SetPiso(i.IdpropiedadNavigation.Piso??0)
|
||||
.SetLetra(i.IdpropiedadNavigation.Letra??"")
|
||||
.SetMesesAumento(i.MesesHastaAumento)
|
||||
.SetMesesDuracion(i.MesesDurationContrato)
|
||||
.Build();
|
||||
|
||||
return Ok(cont);
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/precontrato")]
|
||||
public IActionResult IniciarPrecontrato([FromHeader(Name = "Auth")]string Auth, [FromBody] PrecontratoDto dto) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string validacion2 = ValidarDtoPrecontrato(dto);
|
||||
if (validacion2 != "") return BadRequest(new {message = validacion2});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new {message = "Tu token no corresponde a ningun cliente (volvete a logear)"});
|
||||
if (cli.Email != dto.EmailPropietario) return BadRequest(new {message = "No Corresponde el email de propietario con el del token"});
|
||||
|
||||
Cliente? propi = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(dto.EmailPropietario);
|
||||
if (propi == null || propi.Dni == 0) return BadRequest(new {message = "No hay propietario por ese email"});
|
||||
|
||||
Cliente? inq = RepositorioInquilinos.Singleton.ObtenerInquilinoPorEmail(dto.EmailInquilino);
|
||||
if (inq == null || inq.Dni == 0) return BadRequest(new {message = "No hay inquilinos por ese email"});
|
||||
|
||||
Propiedade? p = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(dto.IdPropiedad);
|
||||
if (p == null || p.Id == 0) return BadRequest(new {message = "La id de propiedad no corresponde a una propiedad"});
|
||||
|
||||
var precontrato = new PrecontratoBuilder()
|
||||
.SetHabilitado()
|
||||
.SetPropietario(propi.Dni)
|
||||
.SetInquilino(inq.Dni)
|
||||
.SetCantidadGarantes(dto.CantidadGarantes)
|
||||
.SetIndiceActializacionInicial()
|
||||
.SetMesesHastaAumento(dto.MesesHastaAumento)
|
||||
.SetPropiedad(p.Id)
|
||||
.SetFecha(DateTime.Parse(dto.fechaprimernotificacion))
|
||||
.SetMesesDuracion(dto.MesesDuracionContrato)
|
||||
.Build();
|
||||
|
||||
|
||||
var notificacion = new NotificacioneBuilder()
|
||||
.SetAccion("Carge Garantes")
|
||||
.SetDniremitente(propi.Dni)
|
||||
.SetDnicliente(inq.Dni)
|
||||
.SetLeido(false)
|
||||
.SetFecha(DateTime.Now)
|
||||
.SetIdpropiedad(p.Id)
|
||||
.SetMensaje($"El propietario {propi.Nombre} {propi.Apellido} te requiere que carges informacion de {dto.CantidadGarantes} Garantes")
|
||||
.Build();
|
||||
|
||||
var ret = RepositorioContratos.Singleton.CargaPrecontrato(precontrato, notificacion);
|
||||
if (ret) {
|
||||
ret = RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, DateTime.Parse(dto.fechaprimernotificacion));
|
||||
}
|
||||
return (ret)?
|
||||
Ok(new {message = "Se Cargo el precontrato y envio una notificacion al inquilino"}):
|
||||
BadRequest(new {message = "No se pudo cargar el precontrato"});
|
||||
}
|
||||
|
||||
[HttpPut("api/contratos/addGarantes")]
|
||||
public IActionResult AddGarantes([FromHeader(Name = "Auth")]string Auth, AltaGarantesDto dto) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var validacion2 = ValidarDtoAltaGarantes(dto);
|
||||
if (validacion2 != "") return BadRequest(new {message = validacion2});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new {message = "Tu token no corresponde a ningun cliente (volvete a logear)"});
|
||||
if (cli.Email != dto.EmailInquilino) return BadRequest(new {message = "No Corresponde el email de inquilino con el del token"});
|
||||
|
||||
var validacion4 = RepositorioContratos.Singleton.CantidadGarantesEncontrato(dto.EmailInquilino, dto.Idpropiedad);
|
||||
if (validacion4 <= 0 || dto.garantes.Count()!=validacion4) return BadRequest(new{message="Cantidad de garantes incorrecta"});
|
||||
|
||||
Cliente? propi = RepositorioPropietario.Singleton.ObtenerPropietarioPorIdPropiedad(dto.Idpropiedad);
|
||||
if(propi == null) return BadRequest(new{message = "No se encuentra el propietario de la propiedad"});
|
||||
|
||||
foreach (var i in dto.garantes) {
|
||||
string validacion3 = ValidarDtoGarante(i);
|
||||
if (validacion3 != "") return BadRequest( new { message = validacion3 });
|
||||
}
|
||||
|
||||
List<Garante> gar = new();
|
||||
|
||||
foreach (var i in dto.garantes) {
|
||||
Garante g = new GaranteBuilder()
|
||||
.SetNombre(i.Nombre)
|
||||
.SetApellido(i.Apellido)
|
||||
.SetCelular(i.Celular)
|
||||
.SetDomicilio(i.Domicilio)
|
||||
.SetDni(i.Dni)
|
||||
.SetDomicilioLaboral(i.Domiciliolaboral)
|
||||
.Build();
|
||||
gar.Add(g);
|
||||
}
|
||||
|
||||
var contr = RepositorioContratos.Singleton.ObtenerContrato(dto.EmailInquilino, dto.Idpropiedad);
|
||||
if (contr == null) return BadRequest(new { message = "No existe el contrato o ya fue activado"});
|
||||
|
||||
var ret = RepositorioContratos.Singleton.CargaGarantes(gar, dto.EmailInquilino, dto.Idpropiedad);
|
||||
if (ret) {
|
||||
Console.WriteLine(dto.fecha);
|
||||
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.fecha);
|
||||
|
||||
var noti = new NotificacioneBuilder()
|
||||
.SetIdpropiedad(dto.Idpropiedad)
|
||||
.SetAccion("Check y Contrato")
|
||||
.SetMensaje($"El inquilino cargó los datos de garantes comprobá y carga el contrato: {contr.Id}")
|
||||
.SetLeido(false)
|
||||
.SetDniremitente(cli.Dni)
|
||||
.SetDnicliente(propi.Dni)
|
||||
.SetFecha(DateTime.Now)
|
||||
.Build();
|
||||
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||
}
|
||||
return ret ?
|
||||
Ok(new {message = "Se Añadieron los Garantes"}):BadRequest(new { message = "Fallo la carga"});
|
||||
}
|
||||
|
||||
[HttpPut("api/contratos/cancelar")]
|
||||
public IActionResult CancelarPrecontrato([FromHeader(Name = "Auth")]string Auth, CancelarPrecontratoDto dto) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var validacion2 = ValidarCancelarDto(dto);
|
||||
if (validacion2 != "") return BadRequest(new {message = validacion2});
|
||||
|
||||
Cliente? pro = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(dto.EmailPropietario);
|
||||
if (pro == null) return BadRequest(new {message = "No Existe Usuario con ese email"});
|
||||
if (pro.Token != Auth) return BadRequest(new {message = "El token de auth no corresponde al token el usuario propietario"});
|
||||
|
||||
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(dto.idpropiedad);
|
||||
if (prop == null) return BadRequest(new {message = "No existe la propiedad por esa id"});
|
||||
if (prop.Dnipropietario != pro.Dni) return BadRequest(new {message = "Este propietario no es el dueño de la propiedad"});
|
||||
|
||||
var inq = RepositorioInquilinos.Singleton.ObtenerInquilinoPorEmail(dto.EmailInquilino);
|
||||
if (inq == null) return BadRequest(new {message = "No hay un inquilino por ese email"});
|
||||
|
||||
var ret = RepositorioContratos.Singleton.CancelarPrecontrato(dto.EmailInquilino, dto.idpropiedad);
|
||||
if (ret) {
|
||||
prop.Idestado = 1;
|
||||
ret = RepositorioPropiedades.Singleton.PatchPropiedad(prop);
|
||||
if (ret){
|
||||
RepositorioNotificaciones.Singleton.MarcarComoLeido(pro.Dni, dto.fecha);
|
||||
var noti = new NotificacioneBuilder()
|
||||
.SetAccion("ContratoCancelado")
|
||||
.SetIdpropiedad(dto.idpropiedad)
|
||||
.SetDniremitente(pro.Dni)
|
||||
.SetDnicliente(inq.Dni)
|
||||
.SetMensaje($"Se cancelo el intento de alquilar la propiedad: {dto.idpropiedad}")
|
||||
.SetIdpropiedad(dto.idpropiedad)
|
||||
.SetLeido(false)
|
||||
.Build();
|
||||
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||
if (ret){
|
||||
return Ok(new {message = "Se cancelo el precontrato"});
|
||||
}else{
|
||||
return Ok(new {message = "Se cancelo el precontrato, pero no se pudo notificar al inquilino"});
|
||||
}
|
||||
}else{
|
||||
return BadRequest(new {message = "No se pudo setear la propiedad como Disponible en busqueda"});
|
||||
}
|
||||
}else{
|
||||
return BadRequest(new {message = "Se fallo al intentar cancelar el precontrato"});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("api/contratos/precontrato/listaGarantes")]
|
||||
public IActionResult ObtenerListaGarantes([FromHeader(Name = "Auth")]string Auth, long idcontrato = 0, [FromQuery] string EmailPropietario = "" ) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (idcontrato == 0 || EmailPropietario == "") return BadRequest(new { message = "Estan mal cargados los datos"});
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new {message = "No hay un propietario por ese token"});
|
||||
if (cli.Email != EmailPropietario) return BadRequest(new {message = "El Email del usuario no coinside con el del token"});
|
||||
|
||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(idcontrato);
|
||||
if (contr == null) return BadRequest(new {message = "No hay un precontrato por esa id"});
|
||||
|
||||
LinkedList<GaranteDto> list = new();
|
||||
foreach (var i in contr.Idgarantes) {
|
||||
list.AddFirst(new GaranteDtoBuilder()
|
||||
.SetCelular(i.Celular)
|
||||
.SetDni(i.Dni)
|
||||
.SetDomicilio(i.Domicilio)
|
||||
.SetDomicilioLaboral(i.Domiciliolaboral)
|
||||
.SetNombre(i.Nombre)
|
||||
.SetApellido(i.Apellido)
|
||||
.Build());
|
||||
}
|
||||
return Ok(list);
|
||||
}
|
||||
|
||||
private readonly IMinioClient mc;
|
||||
public ContratoController(IMinioClient minioClient) {
|
||||
mc = minioClient;
|
||||
if (mc == null){
|
||||
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(System.IO.File.ReadAllText("./settings.json"))?? null;
|
||||
if (mcon == null) throw new Exception();
|
||||
|
||||
mc = new MinioClient().WithCredentials(mcon.usr, mcon.scrt)
|
||||
.WithEndpoint("192.168.1.11:9000")
|
||||
.WithSSL(false)
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/subirContrato")]
|
||||
public async Task<IActionResult> subirContrato([FromHeader(Name = "Auth")]string Auth, [FromForm]long idcontrato, [FromForm]DateTime ubicarnotificacion, IFormFile contrato) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (idcontrato<=0) return BadRequest(new {message = "No puede tener un id contrato menor o igual a 0"});
|
||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(idcontrato);
|
||||
if (contr == null) return BadRequest(new { message = "No hay precontrato por esa id"});
|
||||
if (contr.Dniinquilino == 0 || contr.Dnipropietario == 0 || contr.Idpropiedad == 0 ||
|
||||
contr.Dniinquilino == null || contr.Dnipropietario == null || contr.Idpropiedad == null) {
|
||||
return BadRequest(new { message = "Estan mal cargados los datos del precontrato comunicate con un administrador"});
|
||||
}
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null || contr.DnipropietarioNavigation == null) return BadRequest(new { message ="No se pudo checkear que el token corresponda al propietario"});
|
||||
if (cli.Dni != contr.DnipropietarioNavigation.Dni) return BadRequest(new { message = "el token de usuario no coinside con el usuario propietario"});
|
||||
|
||||
if (contrato == null) return BadRequest(new { message = "Debe subir un archivo." });
|
||||
if (contrato.ContentType != "application/pdf") return BadRequest(new { message = "El archivo debe ser un documento PDF." });
|
||||
if (!Path.GetExtension(contrato.FileName).Equals(".pdf", StringComparison.OrdinalIgnoreCase)) return BadRequest(new { message = "El archivo debe tener la extensión .pdf." });
|
||||
|
||||
string nuevoNombreArchivo = $"id:{contr.Id}-inq:{contr.Dniinquilino}-propi:{contr.Dnipropietario}-idprop:{contr.Idpropiedad}.pdf";
|
||||
|
||||
bool ret = await subirContrato(contrato, nuevoNombreArchivo);
|
||||
if(ret == false) return BadRequest(new {message = "No se pudo subir el archivo"});
|
||||
|
||||
ret = RepositorioContratos.Singleton.AddUrl(contr.Id, nuevoNombreArchivo);
|
||||
if (ret == false) return BadRequest(new { message = "No se pudo guardar la url del contrato" });
|
||||
|
||||
var noti = new NotificacioneBuilder()
|
||||
.SetDniremitente(contr.Dnipropietario??0)
|
||||
.SetIdpropiedad(contr.Idpropiedad??0)
|
||||
.SetDnicliente(contr.Dniinquilino??0)
|
||||
.SetAccion("Aceptar Contrato")
|
||||
.SetMensaje($"El propietario: {contr.Dnipropietario}, hizo un documento de contrato: {contr.Id}")
|
||||
.SetFecha(DateTime.Now)
|
||||
.SetLeido(false)
|
||||
.Build();
|
||||
|
||||
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, ubicarnotificacion);
|
||||
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||
|
||||
return (ret)?
|
||||
Ok(new { message = "se notifico al futuro inquilino"}): BadRequest(new { message = "No se pudo enviar la notificacion"});
|
||||
|
||||
}
|
||||
[HttpGet("api/contrato/DocumentoFinal")]
|
||||
public IActionResult ObtenerContratoFinal ([FromHeader(Name = "Auth")]string Auth, [FromQuery]long idcontrato) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false){
|
||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
}
|
||||
|
||||
if (idcontrato <= 0) return BadRequest(new {message = "La id no puede ser igual o menor a 0"});
|
||||
|
||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerContratoPorId(idcontrato);
|
||||
if (contr == null || contr.Dniinquilino == 0) return BadRequest(new { message = "No hay un contrato por esa id"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||
if (cli.Dni != contr.Dniinquilino && cli.Dni != contr.Dnipropietario) return BadRequest(new { message = "El token no corresponde con el del inquilino"});
|
||||
|
||||
try{
|
||||
var memstream = new MemoryStream();
|
||||
|
||||
var goa = new GetObjectArgs()
|
||||
.WithBucket("alquilafacil")
|
||||
.WithObject(contr.UrlContrato)
|
||||
.WithCallbackStream(stream => {
|
||||
memstream.Position=0;
|
||||
stream.CopyTo(memstream);
|
||||
});
|
||||
|
||||
mc.GetObjectAsync(goa).Wait();
|
||||
memstream.Position = 0;
|
||||
|
||||
if (memstream.Length == 0) return BadRequest(new { message = "El archivo está vacío" });
|
||||
|
||||
return File(memstream, "application/pdf", contr.UrlContrato);
|
||||
|
||||
} catch (Exception e){
|
||||
Console.Error.WriteLine(e);
|
||||
return BadRequest(new { message = "Fallo al intentar obtener el archivo del almacenamiento o este no existe"});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("api/contrato/getdocumento")]
|
||||
public IActionResult ObtenerContrato([FromHeader(Name = "Auth")]string Auth, [FromQuery]long idcontrato) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false){
|
||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
}
|
||||
|
||||
if (idcontrato <= 0) return BadRequest(new {message = "La id no puede ser igual o menor a 0"});
|
||||
|
||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(idcontrato);
|
||||
if (contr == null || contr.Dniinquilino == 0) return BadRequest(new { message = "No hay un precontrato por esa id"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||
if (cli.Dni != contr.Dniinquilino) return BadRequest(new { message = "El token no corresponde con el del inquilino"});
|
||||
|
||||
string nuevoNombreArchivo = $"id:{contr.Id}-inq:{contr.Dniinquilino}-propi:{contr.Dnipropietario}-idprop:{contr.Idpropiedad}.pdf";
|
||||
try{
|
||||
var memstream = new MemoryStream();
|
||||
|
||||
var goa = new GetObjectArgs()
|
||||
.WithBucket("alquilafacil")
|
||||
.WithObject(nuevoNombreArchivo)
|
||||
.WithCallbackStream(stream => {
|
||||
memstream.Position=0;
|
||||
stream.CopyTo(memstream);
|
||||
});
|
||||
|
||||
mc.GetObjectAsync(goa).Wait();
|
||||
memstream.Position = 0;
|
||||
|
||||
if (memstream.Length == 0) return BadRequest(new { message = "El archivo está vacío" });
|
||||
|
||||
return File(memstream, "application/pdf", nuevoNombreArchivo);
|
||||
|
||||
} catch (Exception e){
|
||||
Console.Error.WriteLine(e);
|
||||
return BadRequest(new { message = "Fallo al intentar obtener el archivo del almacenamiento o este no existe"});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/aceptarContrato")]
|
||||
public IActionResult AceptarContrato([FromHeader(Name = "Auth")]string Auth, [FromBody] AceptarContratoDto dto){
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (dto.Idcontrato <= 0) return BadRequest(new {message = "La id no puede ser igual o menor a 0"});
|
||||
|
||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(dto.Idcontrato);
|
||||
if (contr == null || contr.Dniinquilino == 0) return BadRequest(new { message = "No hay un precontrato por esa id"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||
if (cli.Dni != contr.Dniinquilino) return BadRequest(new { message = "El token no corresponde con el del inquilino"});
|
||||
|
||||
bool ret = RepositorioContratos.Singleton.AceptarContrato(dto.Idcontrato);
|
||||
if (ret == false) return BadRequest(new { message ="fallo al aceptar el contrato"});
|
||||
|
||||
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.Fecha);
|
||||
|
||||
var noti = new NotificacioneBuilder()
|
||||
.SetDniremitente(cli.Dni)
|
||||
.SetIdpropiedad(contr.Idpropiedad??0)
|
||||
.SetDnicliente(contr.Dnipropietario??0)
|
||||
.SetAccion("Aceptado Contrato")
|
||||
.SetMensaje($"Se inicio el alquiler")
|
||||
.SetFecha(DateTime.Now)
|
||||
.SetLeido(false)
|
||||
.Build();
|
||||
|
||||
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||
return ret ?
|
||||
Ok(new { message = "Se acepto el contrato y se crearon los Canons a ser pagados"}) :
|
||||
BadRequest(new { message = "No se pudo aceptar el contrato"});
|
||||
|
||||
}
|
||||
|
||||
[HttpPut("api/contratos/rechazarPreContrato")]
|
||||
public IActionResult CancelarContrato([FromHeader(Name = "Auth")]string Auth, [FromBody] RechazarPreContrato dto ) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (dto.Idcontrato <= 0) return BadRequest(new {message = "La id no puede ser igual o menor a 0"});
|
||||
|
||||
Contrato? contr = RepositorioContratos.Singleton.ObtenerPreContratoPorId(dto.Idcontrato);
|
||||
if (contr == null || contr.Dniinquilino == 0) return BadRequest(new { message = "No hay un precontrato por esa id"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||
if (cli.Dni != contr.Dniinquilino) return BadRequest(new { message = "El token no corresponde con el del inquilino"});
|
||||
|
||||
var ret = RepositorioContratos.Singleton.CancelarPrecontrato(dto.Idcontrato);
|
||||
if (ret == false) return BadRequest(new {message = "Fallo al intentar cancelar el precontrato"});
|
||||
|
||||
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.Fecha);
|
||||
var noti = new NotificacioneBuilder()
|
||||
.SetDniremitente(cli.Dni)
|
||||
.SetIdpropiedad(contr.Idpropiedad??0)
|
||||
.SetDnicliente(contr.Dnipropietario??0)
|
||||
.SetAccion("Rechazo Contrato")
|
||||
.SetMensaje($"Se cancelo el proceso para alquilar de: {cli.Nombre}")
|
||||
.SetFecha(DateTime.Now)
|
||||
.SetLeido(false)
|
||||
.Build();
|
||||
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||
|
||||
return ret?
|
||||
Ok(new { message = "Se cancelo el proceso para iniciar el alquiler"}):
|
||||
BadRequest(new { message = "No se pudo cancelar"});
|
||||
}
|
||||
|
||||
private async Task<bool> subirContrato(IFormFile f, string flname) {
|
||||
try {
|
||||
var buck = new BucketExistsArgs().WithBucket("alquilafacil");
|
||||
bool encontrado = await mc.BucketExistsAsync(buck).ConfigureAwait(false);
|
||||
|
||||
if(!encontrado){
|
||||
var mb = new MakeBucketArgs().WithBucket("alquilafacil");
|
||||
await mc.MakeBucketAsync(mb).ConfigureAwait(false);
|
||||
}
|
||||
using (var stream = new MemoryStream()){
|
||||
await f.CopyToAsync(stream);
|
||||
stream.Position=0;
|
||||
PutObjectArgs putbj = new PutObjectArgs()
|
||||
.WithBucket("alquilafacil")
|
||||
.WithObject(flname)
|
||||
.WithStreamData(stream)
|
||||
.WithContentType("application/pdf")
|
||||
.WithObjectSize(stream.Length);
|
||||
await mc.PutObjectAsync(putbj);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e ) {
|
||||
Console.Error.WriteLine(e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("api/contratos/garantes")]
|
||||
public IActionResult ObtenerGarantes([FromHeader(Name ="Auth")] string Auth, int idcontrato) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest();
|
||||
if(idcontrato <= 0) return BadRequest();
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return BadRequest();
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(idcontrato);
|
||||
if (cont == null) return BadRequest();
|
||||
|
||||
if (cont.Dniinquilino != cli.Dni && cont.Dnipropietario != cli.Dni) return BadRequest();
|
||||
|
||||
var list = cont.Idgarantes;
|
||||
List<GaranteDto> l = new();
|
||||
foreach (var i in list) {
|
||||
l.Add(new GaranteDtoBuilder()
|
||||
.SetCelular(i.Celular)
|
||||
.SetDni(i.Dni)
|
||||
.SetDomicilio(i.Domicilio)
|
||||
.SetDomicilioLaboral(i.Domiciliolaboral)
|
||||
.SetNombre(i.Nombre)
|
||||
.SetApellido(i.Apellido)
|
||||
.Build());
|
||||
}
|
||||
return Ok(l);
|
||||
}
|
||||
|
||||
private string ValidarCancelarDto(CancelarPrecontratoDto dto) {
|
||||
if (dto == null) return "dto nulo";
|
||||
string ret = "";
|
||||
|
||||
if (dto.EmailInquilino =="") ret += "No puede tener un EmailInquilino Vacio\n";
|
||||
if (dto.EmailPropietario =="") ret += "No puede tener un EmailPropietario Vacio\n";
|
||||
if (dto.idpropiedad <= 0 ) ret += "No puede tener id propiedad igual o menor a 0\n";
|
||||
if (dto.fecha == DateTime.MinValue) ret += "Falta fecha\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
private string ValidarDtoGarante(GaranteDto g) {
|
||||
string ret = "";
|
||||
if (g == null) return "dto nulo";
|
||||
|
||||
if (g.Celular == "") ret += "No puede tener un numero de telefono vacio\n";
|
||||
if (g.Nombre == "") ret += "No puede tener un nombre vacio\n";
|
||||
if (g.Apellido == "") ret += "No puede tener un apellido vacio\n";
|
||||
if (g.Domiciliolaboral == "") ret += "Tiene que especificar su domicilio laboral\n";
|
||||
if (g.Domicilio == "") ret += "Tiene que especificar su domilio\n";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
private string ValidarDtoAltaGarantes(AltaGarantesDto dto){
|
||||
string ret = "";
|
||||
if (dto == null) return "dto nulo";
|
||||
|
||||
if (dto.garantes.Count()<=0) ret += "No se puede tener 0 o menos garantes\n";
|
||||
if (dto.Idpropiedad<=0) ret += "la id de propiedad no puede ser igual o menor a 0\n";
|
||||
if (dto.EmailInquilino == "") ret += "El email de inquilino no puede estar vacio\n";
|
||||
|
||||
return ret;
|
||||
}
|
||||
private string ValidarDtoPrecontrato( PrecontratoDto dto) {
|
||||
string ret = "";
|
||||
if (dto == null) return "dto nulo";
|
||||
|
||||
if (dto.CantidadGarantes<0) ret += "la cantidad de garantes necesarios no pueden ser menor a 0\n";
|
||||
if (dto.CantidadGarantes>10) ret += "Hay un maximo de 10 garantes\n";
|
||||
if (dto.EmailInquilino == "") ret += "el email del inquilino no puede ser nulo\n";
|
||||
if (dto.EmailPropietario == "") ret += "el email del propietario no puede estar vacio\n";
|
||||
if (dto.IdPropiedad <= 0) ret += "la id de propiedad no puede ser igual o menor a 0\n";
|
||||
if (dto.MesesHastaAumento <= 0) ret += "No puede tener 0 o menos meses hasta el aumento\n";
|
||||
if (dto.MesesDuracionContrato <= 0) ret += "No puede tener 0 o menos meses de duracion\n";
|
||||
if (dto.MesesDuracionContrato < dto.MesesHastaAumento) ret += "el tiempo hasta aumento no puede ser mayor de \n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
95
Aspnet/Controllers/DefectoController.cs
Normal file
95
Aspnet/Controllers/DefectoController.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using AlquilaFacil.Builder;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class DefectoController: ControllerBase {
|
||||
|
||||
[HttpGet("api/defectos")]
|
||||
public IActionResult ObtenerDefectosEnContrato([FromHeader(Name = "Auth")] string Auth, long Idcontrato = 0) {
|
||||
if (Idcontrato <= 0) return BadRequest( new { message = "La id de contrato no puede ser menor o igual a 0"});
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false){
|
||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) {
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return Unauthorized();
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(Idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "No hay contrato por esa id"});
|
||||
|
||||
if (cont.Dniinquilino != cli.Dni && cont.Dnipropietario != cli.Dni) return BadRequest(new { message = "no deberias tener acceso a esto"});
|
||||
|
||||
var l = RepositorioDefectos.Singleton.ObtenerDefectosPorIdContrato(Idcontrato);
|
||||
List<DefectoDto> ll = new();
|
||||
foreach (var i in l){
|
||||
var n = new DefectoDtoBuilder()
|
||||
.SetId(i.Id)
|
||||
.SetDesc(i.Descripcion)
|
||||
.SetCosto(i.Costo)
|
||||
.SetEstado(i.IdestadoNavigation.Descipcion)
|
||||
.SetIdContrato(i.Idcontrato??0)
|
||||
.SetPagaInquilino(i.Pagainquilino)
|
||||
.SetDivisa(i.IddivisaNavigation.Signo)
|
||||
.Build();
|
||||
ll.Add(n);
|
||||
}
|
||||
return Ok(ll);
|
||||
}
|
||||
|
||||
[HttpPost("api/defecto")]
|
||||
public IActionResult AltaDefecto([FromHeader(Name = "Auth")] string Auth, AltaDefectoDto data) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string r = ValidarDto(data);
|
||||
if (r != "") return BadRequest(new { message = r });
|
||||
|
||||
Defecto defecto = new Defecto{
|
||||
Costo = data.Costo,
|
||||
Descripcion = data.Descripcion,
|
||||
Idcontrato = data.Idcontrato,
|
||||
Iddivisa = data.Iddivisa,
|
||||
Pagainquilino = data.Pagainquilino==0?0Lu:1Lu,
|
||||
Idestado = 1,
|
||||
|
||||
};
|
||||
var b = RepositorioDefectos.Singleton.AltaDefecto(defecto);
|
||||
return b ?Ok(new { message = "Se cargo el Defecto en el sistema"}):BadRequest(new { message ="No se pudo cargar el defecto en el sistema"});
|
||||
}
|
||||
|
||||
private string ValidarDto(AltaDefectoDto d){
|
||||
string ret ="";
|
||||
|
||||
if (d == null) return "Dto nulo";
|
||||
if (d.Iddivisa <0 || d.Iddivisa>1) ret +="No son divisas validas\n";
|
||||
if (d.Descripcion == "") ret+="La descripcion no puede estar vacia\n";
|
||||
if (d.Idcontrato<=0)ret += "No puede haber un id de contrato igual o menor a 0\n";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
[HttpPut("api/defecto/marcarpago")]
|
||||
public IActionResult MarcarPago([FromHeader(Name = "Auth")] string Auth, long iddefecto = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (iddefecto<=0) return BadRequest(new { message = "No hay canones con id 0 o menor"});
|
||||
bool ret = RepositorioDefectos.Singleton.MarcarPago(iddefecto);
|
||||
|
||||
return ret ?
|
||||
Ok(new { message = "Se marco como pagado" }):BadRequest(new { message = "Fallo el acceso a la base de datos o no se encontro el defecto" });
|
||||
}
|
||||
}
|
||||
60
Aspnet/Controllers/EstadisticaController.cs
Normal file
60
Aspnet/Controllers/EstadisticaController.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using AlquilaFacil.Builder;
|
||||
using Entidades.Informes;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
[ApiController]
|
||||
public class EstadisticaController: ControllerBase {
|
||||
[HttpGet("api/stats/alquileresIniciados")]
|
||||
public IActionResult alquileresIniciadosEsteAño([FromHeader(Name ="Auth")]string Auth, int year) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var validacion2 = RepositorioContratos.Singleton.HayContratosEnAño(year);
|
||||
if (validacion2 == false) return BadRequest(new { message = "No hay contratos en ese año"});
|
||||
var a = RepositorioEstadisticas.Singleton.ObtenerDataIniciadosPorAño(year);
|
||||
return Ok(a);
|
||||
}
|
||||
[HttpGet("api/tabla/alquileresIniciados")]
|
||||
public IActionResult tablaalquileresIniciadosEsteAño([FromHeader(Name ="Auth")]string Auth, int year) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var validacion2 = RepositorioContratos.Singleton.HayContratosEnAño(year);
|
||||
if (validacion2 == false) return BadRequest(new { message = "No hay contratos en ese año"});
|
||||
var a = RepositorioEstadisticas.Singleton.TablaObtenerContratosIniciadosPorAño(year);
|
||||
if (a == null) return BadRequest(new { message = "Fallo al obtener el contrato"});
|
||||
|
||||
List<InformesAlquiler> informe =new();
|
||||
foreach (var i in a) {
|
||||
var d = new InformesAlquilerBuilder()
|
||||
.SetId(i.Id).SetUbicacion(i.IdpropiedadNavigation.Ubicacion)
|
||||
.SetDivisa(i.IddivisaNavigation.Signo)
|
||||
.Build();
|
||||
informe.Add(d);
|
||||
}
|
||||
return Ok(informe);
|
||||
}
|
||||
[HttpGet("api/stats/duracionContrato")]
|
||||
public IActionResult DuracionContrato([FromHeader(Name ="Auth")]string Auth) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var a = RepositorioEstadisticas.Singleton.ObtenerDataDuracionContratos();
|
||||
return Ok(a);
|
||||
}
|
||||
|
||||
[HttpGet("api/tabla/duracionContrato")]
|
||||
public IActionResult TablaDuracionContrato([FromHeader(Name ="Auth")]string Auth) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var a = RepositorioEstadisticas.Singleton.TablaObtenerDataDuracionContratos();
|
||||
return Ok(a);
|
||||
}
|
||||
}
|
||||
@@ -6,17 +6,16 @@ namespace AlquilaFacil.Controllers;
|
||||
[ApiController]
|
||||
public class GruposController: ControllerBase {
|
||||
[HttpPost("api/admin/grupos")]
|
||||
public IActionResult CrearGrupo([FromBody] AdminGrupo grupo) {
|
||||
public IActionResult CrearGrupo([FromBody] AdminGrupo grupo, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (!string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||
var ret2 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (ret2 == false) return BadRequest(ret2);
|
||||
|
||||
if (String.IsNullOrEmpty(grupo.descripcion)) return BadRequest();
|
||||
|
||||
bool ret = RepositorioGrupos.Singleton.CrearGrupo(grupo.descripcion);
|
||||
return (ret) ? Ok(ret) : BadRequest();
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/grupos")]
|
||||
public IActionResult ListarGrupo(){
|
||||
return Ok(RepositorioGrupos.Singleton.Listar());
|
||||
}
|
||||
}
|
||||
|
||||
public record AdminGrupo(string descripcion);
|
||||
|
||||
@@ -15,9 +15,8 @@ public class InquilinoController: ControllerBase
|
||||
[HttpGet("api/inquilino")]
|
||||
public IActionResult Get([FromHeader(Name = "Auth")] string Auth) {
|
||||
if (!string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||
string path = Request.Path;
|
||||
var ret = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
|
||||
var ret = RepositorioPermisos.Singleton.CheckPermisos(Auth, path);
|
||||
if (ret == false) return BadRequest(ret);
|
||||
|
||||
var list = RepositorioInquilinos.Singleton.GetInquilinos();
|
||||
@@ -26,10 +25,14 @@ public class InquilinoController: ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost("api/inquilino")]
|
||||
public IActionResult Post([FromBody] CrearClienteDto cid) {
|
||||
public IActionResult Post([FromBody] CrearClienteDto cid, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (string.IsNullOrEmpty(Auth)) return BadRequest(new {message = "El String Auth Esta Vacio"});
|
||||
var ret3 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 4);
|
||||
if (ret3 == false) return BadRequest(new {message = "Falló el permiso"});
|
||||
|
||||
|
||||
var ret = verificarCrearUsuario(cid);
|
||||
if (ret != "") return BadRequest(ret);
|
||||
if (ret != "") return BadRequest(new {message = ret});
|
||||
|
||||
var cli = new Cliente {
|
||||
Dni = cid.dni,
|
||||
@@ -42,7 +45,7 @@ public class InquilinoController: ControllerBase
|
||||
};
|
||||
|
||||
bool ret2 = RepositorioUsuarios.Singleton.AltaInquilino(cli);
|
||||
return (ret2) ? Ok() : BadRequest(ret);
|
||||
return (ret2) ? Ok(new {message = "Se dio de alta la cuenta"}) : BadRequest(new {message = "Fallo Dar de Alta El inquilino"});
|
||||
}
|
||||
|
||||
private string verificarCrearUsuario(CrearClienteDto cid) {
|
||||
|
||||
@@ -53,7 +53,6 @@ public class LoginController: ControllerBase
|
||||
|
||||
}
|
||||
|
||||
|
||||
private string GenerarToken(LoginDto loginDto){
|
||||
var tokenHandler = new JwtSecurityTokenHandler();
|
||||
var key = Encoding.ASCII.GetBytes("ffb2cdc15d472e41a5b626e294c45020");
|
||||
|
||||
124
Aspnet/Controllers/NotificacionesController.cs
Normal file
124
Aspnet/Controllers/NotificacionesController.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using AlquilaFacil.Builder;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class NotificacionesController: ControllerBase {
|
||||
[HttpGet("api/notificaciones")]
|
||||
public IActionResult GetNotificaciones([FromHeader(Name ="Auth")]string Auth, bool leido = false) {
|
||||
if (string.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
|
||||
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?)"});
|
||||
|
||||
IQueryable<Notificacione> notificaciones = RepositorioNotificaciones.Singleton.ObtenerNotificacionesDeUsuario(cli.Dni)
|
||||
.Where(x=>x.Leido == leido);
|
||||
|
||||
|
||||
List<NotificacionDto> noti = new();
|
||||
foreach (Notificacione i in notificaciones) {
|
||||
if(i.DniclienteNavigation == null || i.DniremitenteNavigation==null) return BadRequest(new { message = "Esta mal cargado el precontrato"});
|
||||
var dto = new NotificacionDtoBuilder()
|
||||
.SetRemitente(i.DniremitenteNavigation.Email??"")
|
||||
.SetAccion(i.Accion??"")
|
||||
.SetMensaje(i.Mensaje??"")
|
||||
.SetFecha(i.Fecha)
|
||||
.SetPropiedad(i.Idpropiedad.ToString()??"")
|
||||
.SetReceptor(i.DniclienteNavigation.Email??"")
|
||||
.Build();
|
||||
|
||||
noti.Add(dto);
|
||||
}
|
||||
|
||||
return Ok(noti);
|
||||
}
|
||||
|
||||
[HttpGet("api/notificaciones/haySinLeer")]
|
||||
public IActionResult GetHayNotis([FromHeader(Name ="Auth")]string Auth) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
||||
|
||||
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?)"});
|
||||
|
||||
bool ret = RepositorioNotificaciones.Singleton.HayNotis(cli.Dni);
|
||||
return Ok(new {message = ret});
|
||||
}
|
||||
|
||||
[HttpPut("api/notificaciones")]
|
||||
public IActionResult MarcarComoLeido([FromHeader(Name = "Auth")]string Auth, NotificacionMarcarLeidoDto nota) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
||||
|
||||
if (nota.Fecha == null || String.IsNullOrWhiteSpace(nota.Email)) return BadRequest(new {message = "Faltan datos"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
|
||||
if (cli == null) return BadRequest(new {message = "El token de autorizacion no pertenese a ningun Usuario"});
|
||||
|
||||
if (cli.Email != nota.Email) return BadRequest(new {message = "El token de autorizacion no corresponde a tu usuario"});
|
||||
|
||||
bool ret = RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, nota.Fecha);
|
||||
return ret ?
|
||||
Ok(new{message = "Se Marco como leido"}):BadRequest(new{message = "Fallo al marcarse como leido"});
|
||||
}
|
||||
|
||||
[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(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"});
|
||||
if (data.Mensaje == "") return BadRequest(new {message = "El campo Mensaje esta vacio"});
|
||||
|
||||
Cliente? inq = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (inq == null) return BadRequest(new { message = "no hay un usuario para el cual el token de autorizacion corresponda (vuelvase a logear)" });
|
||||
|
||||
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(data.Propiedad);
|
||||
if (prop == null || prop.Idestado != 1) return BadRequest(new{message="No hay una propiedad dada de alta para ese id"});
|
||||
if (prop.DnipropietarioNavigation == null) return BadRequest(new{message="la propiedad no tiene propietario dado de alto ????"});
|
||||
|
||||
var noti = new NotificacioneBuilder()
|
||||
.SetAccion(data.Accion)
|
||||
.SetMensaje(data.Mensaje)
|
||||
.SetLeido(false)
|
||||
.SetDnicliente(prop.DnipropietarioNavigation.Dni)
|
||||
.SetDniremitente(inq.Dni)
|
||||
.SetIdpropiedad(prop.Id)
|
||||
.SetFecha(DateTime.Now)
|
||||
.Build();
|
||||
|
||||
var ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||
return ret?
|
||||
Ok(new {message = "Se envio la notificacion"}):BadRequest(new {message = "Fallo al intentar guardar la notificacion"});
|
||||
}
|
||||
|
||||
[HttpPost("api/notificarInquilino")]
|
||||
public IActionResult NotificarInq([FromHeader(Name ="Auth")]string Auth, [FromBody] AvisoInquilinoDto data) {
|
||||
if (String.IsNullOrWhiteSpace(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false)return Unauthorized();
|
||||
|
||||
if (data.Mensaje == "") return BadRequest(new {message = "El campo Mensaje esta vacio"});
|
||||
if (data.Idpropiedad <= 0) return BadRequest(new {message = "La id de propiedad no puede ser 0 o menor"});
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(data.Idpropiedad);
|
||||
if (cont == null || cont.DniinquilinoNavigation == null || cont.DnipropietarioNavigation == null || cont.IdpropiedadNavigation == null) return BadRequest(new { message = "no hay un contrato por esa id"});
|
||||
|
||||
var n = new NotificacioneBuilder()
|
||||
.SetAccion("Notificacion Inquilino")
|
||||
.SetMensaje(data.Mensaje)
|
||||
.SetLeido(false)
|
||||
.SetDnicliente(cont.DniinquilinoNavigation.Dni)
|
||||
.SetDniremitente(cont.DnipropietarioNavigation.Dni)
|
||||
.SetIdpropiedad(cont.IdpropiedadNavigation.Id)
|
||||
.SetFecha(DateTime.Now)
|
||||
.Build();
|
||||
var ret = RepositorioNotificaciones.Singleton.AltaNotificacion(n);
|
||||
return ret?
|
||||
Ok(new { message = "se envio el aviso" }):BadRequest(new { message = "Fallo al intentar enviar el aviso" });
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,11 @@ namespace AlquilaFacil.Controllers;
|
||||
[ApiController]
|
||||
public class PermisosController: ControllerBase {
|
||||
[HttpPost("api/admin/permisos")]
|
||||
public IActionResult CrearPermisos([FromBody] AdminPermiso permiso) {
|
||||
public IActionResult CrearPermisos([FromBody] AdminPermiso permiso, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (!string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||
var ret2 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 11);
|
||||
if (ret2 == false) return BadRequest(ret2);
|
||||
|
||||
if (String.IsNullOrEmpty(permiso.descripcion)) return BadRequest();
|
||||
|
||||
bool ret = RepositorioPermisos.Singleton.CrearPermiso(permiso.descripcion);
|
||||
|
||||
@@ -1,8 +1,258 @@
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class PropiedadesController: ControllerBase {
|
||||
[HttpGet("api/propiedades")]
|
||||
public IActionResult ListarPropiedades([FromHeader(Name = "Auth")] string Auth, int pag = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
}
|
||||
IQueryable<PropiedadesDto> ret;
|
||||
|
||||
if (pag == 0){
|
||||
ret = RepositorioPropiedades.Singleton.ListarPropiedades();
|
||||
} else{
|
||||
ret = RepositorioPropiedades.Singleton.ListarPropiedadesPorPagina(pag);
|
||||
}
|
||||
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedad")]
|
||||
public IActionResult ObtenerPropiedadPorId(int Id, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (Id < 0) return BadRequest(new {message ="la id de propiedad no puede ser negativa"});
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(Id);
|
||||
if (ret == null) return BadRequest(new {message ="No existe la propiedad"});
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedad/cantPagina")]
|
||||
public IActionResult ObtenerCantidadDePaginas([FromHeader(Name = "Auth")] string Auth, int estado = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (estado < 0) return BadRequest(new {message = "No puede tener un numero menor a 0"});
|
||||
int cant;
|
||||
|
||||
if(estado == 0){
|
||||
cant = RepositorioPropiedades.Singleton.CuantasPaginas();
|
||||
}else{
|
||||
cant = RepositorioPropiedades.Singleton.CuantasPaginas(estado);
|
||||
}
|
||||
|
||||
return Ok(new {message = cant});
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedades/Propietario")]
|
||||
public IActionResult ObtenerPropiedadesPorPropietario (
|
||||
[FromHeader(Name = "Email")] string email,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
email = email.Trim();
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new {message ="falta campo email"});
|
||||
|
||||
IQueryable<PropiedadesDto> ret = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(email);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedades/Propietario/Bajas")]
|
||||
public IActionResult ObtenerPropiedadesPorPropietarioBajas (
|
||||
[FromHeader(Name = "Email")] string email,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 8);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
email = email.Trim();
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new {message ="falta campo email"});
|
||||
|
||||
IQueryable<PropiedadesDto> ret = RepositorioPropiedades.Singleton.ObtenerPropiedadesDeBajaPorEmail(email);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpPost("api/propiedad")]
|
||||
public IActionResult AltaPropiedad([FromBody] AltaPropiedadDto propiedad, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 1);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string validacion2 = ValidarPropiedad(propiedad);
|
||||
if (validacion2 != "") return BadRequest(new { message = validacion2 });
|
||||
|
||||
Cliente? cli = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(propiedad.Email);
|
||||
if (cli == null) return BadRequest(new { message = "El email no corresponde a un propietario"});
|
||||
|
||||
Propiedade Prop = new Propiedade{
|
||||
Canthabitaciones = propiedad.Canthabitaciones,
|
||||
Dnipropietario = cli.Dni,
|
||||
Idtipropiedad = propiedad.Idtipropiedad,
|
||||
Ubicacion = propiedad.Ubicacion,
|
||||
Letra = propiedad.Letra ?? null,
|
||||
Piso = propiedad.Piso ?? null,
|
||||
Monto = propiedad.Monto,
|
||||
Iddivisa = propiedad.Iddivisa,
|
||||
};
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.AñadirPropiedad(Prop);
|
||||
return (ret)?
|
||||
Ok(new { message = "Fue Cargado Correctamente"}) :
|
||||
BadRequest(new { message = "Fallo al momento de añadir la propiedad a la base de datos"});
|
||||
}
|
||||
|
||||
[HttpPatch("api/propiedad")]
|
||||
public IActionResult PatchPropiedad([FromBody] PatchPropiedadDto propiedad, [FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string validacion2 = ValidarPropiedad(propiedad);
|
||||
if (validacion2 != "") return BadRequest(new { message = validacion2 });
|
||||
|
||||
Cliente? cli = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(propiedad.Email);
|
||||
if (cli == null) return BadRequest(new { message = "El email no corresponde a un propietario"});
|
||||
|
||||
List<Servicio> servs = RepositorioServicios.Singleton.ObtenerServiciosPorDescripcion(propiedad.Servicios);
|
||||
|
||||
Propiedade Prop = new Propiedade{
|
||||
Id = propiedad.id,
|
||||
Canthabitaciones = propiedad.Canthabitaciones,
|
||||
Dnipropietario = cli.Dni,
|
||||
Idtipropiedad = propiedad.tipo,
|
||||
Ubicacion = propiedad.Ubicacion,
|
||||
Letra = propiedad.Letra ?? null,
|
||||
Piso = propiedad.Piso ?? null,
|
||||
IdServicios = servs,
|
||||
Monto = propiedad.Monto,
|
||||
Iddivisa = propiedad.Iddivisa,
|
||||
};
|
||||
|
||||
bool ret = RepositorioPropiedades.Singleton.PatchPropiedad(Prop);
|
||||
return (ret)?
|
||||
Ok(new {message = "Fue modificado Correctamente"}):
|
||||
BadRequest(new {message = "Fallo al modificar la base de datos"});
|
||||
}
|
||||
|
||||
[HttpDelete("api/propiedad")]
|
||||
public IActionResult BajaPropiedad(int id, [FromHeader(Name = "Auth")] string Auth, [FromHeader(Name = "Email")] string email){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new { message = "Fallo al identificarse el usuario"});
|
||||
if (id <= 0) return BadRequest(new { message = "No es una id valida"});
|
||||
|
||||
Cliente? propie = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(email);
|
||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id, propie);
|
||||
|
||||
return ret ?
|
||||
Ok(new { message = $"Se Cambio el estado de la propiedad con id {id}"}):
|
||||
BadRequest(new {message="Fallo al cambiar el estado de la propiedad"});
|
||||
}
|
||||
|
||||
[HttpPut("api/propiedades/addServicio")]
|
||||
public IActionResult AñadirServicio([FromBody] ServicioAPropiedadDto Servicios, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (Servicios.propiedadid <= 0) return BadRequest(new {message ="No puede tener una id negativa o cero"});
|
||||
if (Servicios.idServicios.Count() < 1) return BadRequest(new {message ="Falta añadir servicios"});
|
||||
if (Servicios.idServicios.Any(x => x<= 0)) return BadRequest(new {message ="No tienen haber ids negativas o cero de servicio"});
|
||||
|
||||
var serv = RepositorioServicios.Singleton.ObtenerServiciosPorPropiedad(Servicios.propiedadid);
|
||||
|
||||
bool validacion2 = Servicios.idServicios.Any(x => serv.Contains(x));
|
||||
|
||||
if (validacion2 == true) return BadRequest(new {message ="Hay elementos repetidos"});
|
||||
|
||||
bool ret = RepositorioPropiedades.
|
||||
Singleton.AñadirServicioAPropiedad(Servicios.propiedadid, Servicios.idServicios);
|
||||
|
||||
return ret ?
|
||||
Ok(new {message ="Los Servicios Se Cargaron correctamente a la propiedad"}) : BadRequest(new {message ="No se pudo Cargar los Servicios a la propiedad"});
|
||||
|
||||
}
|
||||
|
||||
[HttpPut("api/propiedades/RmServicio")]
|
||||
public IActionResult EliminarServicio([FromBody] ServicioAPropiedadDto servicio, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (servicio.propiedadid <= 0) return BadRequest(new {message ="No puede tener una id negativa o cero"});
|
||||
if (servicio.idServicios.Count() < 1) return BadRequest(new {message ="Falta añadir servicios"});
|
||||
if (servicio.idServicios.Any(x => x<= 0)) return BadRequest(new {message ="No tienen haber ids negativas o cero de servicio"});
|
||||
|
||||
var serv = RepositorioServicios.Singleton.ObtenerServiciosPorPropiedad(servicio.propiedadid);
|
||||
|
||||
var repetidos = serv.Intersect(servicio.idServicios);
|
||||
|
||||
bool ret = RepositorioPropiedades.Singleton.BajaServiciosAPropiedad(servicio.propiedadid, servicio.idServicios);
|
||||
|
||||
return ret ?
|
||||
Ok(new {message ="Se Eliminaron los servicios seleccionados de la propiedad"}) : BadRequest(new {message ="Fallo al eliminarse los servicios de la propiedad"});
|
||||
|
||||
}
|
||||
|
||||
private string ValidarPropiedad(AltaPropiedadDto prop) {
|
||||
if (prop == null) return "Esta mal formado el body de la request";
|
||||
|
||||
string ret = "";
|
||||
if (String.IsNullOrEmpty(prop.Email)) ret += "Falta Definir un email de propietario\n";
|
||||
|
||||
if (prop.Canthabitaciones < 0) ret += "No se puede tener una cantidad de habitaciones negativa\n";
|
||||
|
||||
if (prop.Idtipropiedad <= 0) ret += "No tiene un tipo de propiedad asociada\n";
|
||||
|
||||
if (String.IsNullOrEmpty(prop.Ubicacion)) ret += "Tiene que definir la ubicacion de la propiedad\n";
|
||||
|
||||
if (prop.Monto<=1) ret += "El monto tiene que ser como minimo mayor a 0";
|
||||
|
||||
if (prop.Iddivisa<0 || prop.Iddivisa>1) ret += "se tiene que elejir entre AR$ y US$";
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
private string ValidarPropiedad(PatchPropiedadDto prop) {
|
||||
if (prop == null) return "Esta mal formado el body de la request";
|
||||
|
||||
string ret = "";
|
||||
if (prop.id <1) ret += "No Cargo el dato de id";
|
||||
if (String.IsNullOrEmpty(prop.Email)) ret += "Falta Definir un email de propietario\n";
|
||||
|
||||
if (prop.id <1 ) ret += "No puede haber una id menor a 1\n";
|
||||
|
||||
if (prop.Canthabitaciones < 0) ret += "No se puede tener una cantidad de habitaciones negativa\n";
|
||||
|
||||
if (prop.tipo <= 0) ret += "No tiene un tipo de propiedad asociada\n";
|
||||
|
||||
if (String.IsNullOrEmpty(prop.Ubicacion)) ret += "Tiene que definir la ubicacion de la propiedad\n";
|
||||
|
||||
if (prop.Monto<=1) ret += "El monto tiene que ser como minimo mayor a 0";
|
||||
|
||||
if (prop.Iddivisa<0 || prop.Iddivisa>1) ret += "se tiene que elejir entre AR$ y US$";
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
@@ -11,14 +12,20 @@ namespace AlquilaFacil.Controllers;
|
||||
public class PropietarioController: ControllerBase {
|
||||
|
||||
[HttpGet("api/propietario")]
|
||||
public IActionResult ListarPropietarios([FromHeader(Name = "Auth")] string Auth) {
|
||||
return Ok();
|
||||
public IActionResult ObtenerPropietarioPorDni(long Dni, [FromHeader(Name ="Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 14);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
var ret = RepositorioPropietario.Singleton.ObtenerPropietarioPorDni(Dni);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpPost("api/propietarios")]
|
||||
public IActionResult AltaPropietario([FromBody]CrearClienteDto Propietario,[FromHeader(Name = "Auth")] string Auth) {
|
||||
[HttpPost("api/propietario")]
|
||||
public IActionResult AltaPropietario([FromBody]CrearClienteDto Propietario,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, Request.Path);
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 5);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string validacion2 = verificarCrearUsuario(Propietario);
|
||||
@@ -38,6 +45,30 @@ public class PropietarioController: ControllerBase {
|
||||
return ret ?
|
||||
Ok(new {message = "Se añadio el propietario exitosamente"}) : BadRequest();
|
||||
}
|
||||
|
||||
[HttpPatch("api/propietarios")]
|
||||
public IActionResult PatchPropietario([FromBody]CrearClienteDto Propietario, [FromHeader(Name = "Auth")] string Auth){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 5);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string validacion2 = verificarCrearUsuario(Propietario);
|
||||
if (validacion2 != "") return BadRequest(validacion2);
|
||||
|
||||
var cli = new Cliente {
|
||||
Dni = Propietario.dni,
|
||||
Nombre = Propietario.nombre,
|
||||
Domicilio = Propietario.domicilio,
|
||||
Apellido = Propietario.apellido,
|
||||
Celular = Propietario.celular,
|
||||
Email = Propietario.email,
|
||||
Contraseña = Encoding.UTF8.GetBytes(HacerHash(Propietario.contraseña))
|
||||
};
|
||||
var ret = RepositorioUsuarios.Singleton.ActualizarPropietario(cli);
|
||||
return ret ?
|
||||
Ok(new {message = "Se Modifico el propietario exitosamente"}) : BadRequest();
|
||||
}
|
||||
|
||||
private string verificarCrearUsuario(CrearClienteDto cid) {
|
||||
string msg = "";
|
||||
|
||||
|
||||
24
Aspnet/Facade/DocumentoFacade.cs
Normal file
24
Aspnet/Facade/DocumentoFacade.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Runtime;
|
||||
using System.Text;
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
|
||||
namespace AlquilaFacil.Facade;
|
||||
|
||||
public class DocumentoFacade {
|
||||
private readonly DocumentoGeneradorHtml d1 = new();
|
||||
private readonly DocumentoGeneradorPdf d2 = new();
|
||||
|
||||
public void GenerarHtml(ContratoDto cd, Recibo r, MemoryStream memoryStream) {
|
||||
string str = d1.GenerarHTML(cd, r);
|
||||
StreamWriter writer = new StreamWriter(memoryStream, Encoding.UTF8);
|
||||
writer.WriteAsync(str).Wait();
|
||||
writer.FlushAsync().Wait();
|
||||
memoryStream.Position = 0;
|
||||
}
|
||||
public void GenerarPdf(ContratoDto cd, Recibo r, MemoryStream memoryStream) {
|
||||
var mem = d2.GenerarPdf(cd, r);
|
||||
mem.CopyToAsync(memoryStream).Wait();
|
||||
memoryStream.Position = 0;
|
||||
}
|
||||
}
|
||||
45
Aspnet/Facade/DocumentoGeneradorHtml.cs
Normal file
45
Aspnet/Facade/DocumentoGeneradorHtml.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Routing.Template;
|
||||
|
||||
namespace AlquilaFacil.Facade;
|
||||
public class DocumentoGeneradorHtml {
|
||||
public string GenerarHTML(ContratoDto cd, Recibo r) {
|
||||
string tmpl =$"""
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<div class="card">
|
||||
<div class="card-header text-white bg-primary">
|
||||
AlquilaFácil
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Detalles</h5>
|
||||
<p class="card-text">
|
||||
<strong>ID:</strong> {cd.id}<br>
|
||||
<strong>Ubicación:</strong> {cd.Ubicacion}<br>
|
||||
<strong>Tipo de Propiedad:</strong> {cd.TipoPropiedad}<br>
|
||||
<strong>Fecha de Inicio:</strong> {cd.Fechainicio}<br>
|
||||
<strong>Inquilino:</strong> {cd.Inquilino}<br>
|
||||
<strong>Propietario:</strong> {cd.Propietario}<br>
|
||||
</p>
|
||||
<hr>
|
||||
<h5 class="card-title">Detalles del Recibo</h5>
|
||||
<p class="card-text">
|
||||
<strong>ID del Recibo:</strong> {r.Id}<br>
|
||||
<strong>Fecha:</strong> {r.Fecha}<br>
|
||||
<strong>Monto:</strong> {r.Monto}<br>
|
||||
<h2><b>PAGO</b></h2>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""; return tmpl;
|
||||
}
|
||||
}
|
||||
67
Aspnet/Facade/DocumentoGeneradorPdf.cs
Normal file
67
Aspnet/Facade/DocumentoGeneradorPdf.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using QuestPDF.Fluent;
|
||||
using QuestPDF.Helpers;
|
||||
using QuestPDF.Infrastructure;
|
||||
using System.IO;
|
||||
|
||||
namespace AlquilaFacil.Facade;
|
||||
public class DocumentoGeneradorPdf {
|
||||
public MemoryStream GenerarPdf(ContratoDto cd, Recibo r)
|
||||
{
|
||||
var pdfStream = new MemoryStream();
|
||||
QuestPDF.Settings.License = LicenseType.Community;
|
||||
Document.Create(container =>
|
||||
{
|
||||
container.Page(page =>
|
||||
{
|
||||
page.Size(PageSizes.A4);
|
||||
page.Margin(2, Unit.Centimetre);
|
||||
page.Header().Text("AlquilaFácil").FontSize(20).SemiBold().FontColor(Colors.White);
|
||||
page.Content().Column(column =>
|
||||
{
|
||||
column.Spacing(10);
|
||||
|
||||
column.Item().Border(1).Padding(10).Column(card =>
|
||||
{
|
||||
card.Item().Row(row =>
|
||||
{
|
||||
row.RelativeItem().Text("Detalles").FontSize(16).SemiBold();
|
||||
});
|
||||
|
||||
card.Item().Column(body =>
|
||||
{
|
||||
body.Spacing(5);
|
||||
body.Item().Text($"ID: {cd.id}").FontSize(12).Bold();
|
||||
body.Item().Text($"Ubicación: {cd.Ubicacion}").FontSize(12);
|
||||
body.Item().Text($"Tipo de Propiedad: {cd.TipoPropiedad}").FontSize(12);
|
||||
body.Item().Text($"Fecha de Inicio: {cd.Fechainicio}").FontSize(12);
|
||||
body.Item().Text($"Inquilino: {cd.Inquilino}").FontSize(12);
|
||||
body.Item().Text($"Propietario: {cd.Propietario}").FontSize(12);
|
||||
});
|
||||
});
|
||||
|
||||
column.Item().Border(1).Padding(10).Column(card =>
|
||||
{
|
||||
card.Item().Row(row =>
|
||||
{
|
||||
row.RelativeItem().Text("Detalles del Recibo").FontSize(16).SemiBold();
|
||||
});
|
||||
|
||||
card.Item().Column(body =>
|
||||
{
|
||||
body.Spacing(5);
|
||||
body.Item().Text($"ID del Recibo: {r.Id}").FontSize(12).Bold();
|
||||
body.Item().Text($"Fecha: {r.Fecha}").FontSize(12);
|
||||
body.Item().Text($"Monto: {r.Monto}").FontSize(12);
|
||||
body.Item().AlignCenter().Text("PAGO").FontSize(20).Bold();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}).GeneratePdf(pdfStream);
|
||||
|
||||
pdfStream.Position = 0;
|
||||
return pdfStream;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,29 @@
|
||||
|
||||
using System.Text.Json;
|
||||
using Minio;
|
||||
using AlquilaFacil.Config;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(File.ReadAllText("./settings.json"))?? null;
|
||||
if (mcon == null) return;
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddMinio(options => options
|
||||
.WithCredentials(mcon.usr, mcon.scrt)
|
||||
.WithEndpoint("192.168.1.11:9000")
|
||||
.WithSSL(false)
|
||||
.Build());
|
||||
|
||||
builder.Services.Configure<FormOptions>(options =>
|
||||
{
|
||||
options.MultipartBodyLengthLimit = 50 * 1024 * 1024; // 50 MB
|
||||
});
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
|
||||
29
Aspnet/Strategy/Busqueda/BusquedaContext.cs
Normal file
29
Aspnet/Strategy/Busqueda/BusquedaContext.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace AlquilaFacil.StrategyBusqueda;
|
||||
|
||||
public class BusquedaContext
|
||||
{
|
||||
private static readonly BusquedaContext singleton = new();
|
||||
public static BusquedaContext Singleton {get { return singleton; } }
|
||||
|
||||
private readonly Dictionary<string, IBusquedaStrategy> _estrategias;
|
||||
|
||||
public BusquedaContext()
|
||||
{
|
||||
_estrategias = new Dictionary<string, IBusquedaStrategy>
|
||||
{
|
||||
{ "000", new BusquedaSinParametros() },
|
||||
{ "100", new BusquedaPorHabitaciones() },
|
||||
{ "010", new BusquedaPorTipo() },
|
||||
{ "001", new BusquedaPorServicios() },
|
||||
{ "110", new BusquedaPorHabitacionesTipo() },
|
||||
{ "101", new BusquedaPorHabitacionesServicios() },
|
||||
{ "011", new BusquedaTipoServicios() },
|
||||
{ "111", new BusquedaFull() }
|
||||
};
|
||||
}
|
||||
|
||||
public IBusquedaStrategy ObtenerEstrategia(string clave)
|
||||
{
|
||||
return _estrategias.ContainsKey(clave) ? _estrategias[clave] : new BusquedaSinParametros();
|
||||
}
|
||||
}
|
||||
52
Aspnet/Strategy/Busqueda/Filtros.cs
Normal file
52
Aspnet/Strategy/Busqueda/Filtros.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Entidades.Dto;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.StrategyBusqueda;
|
||||
|
||||
public class BusquedaSinParametros : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ListarPropiedades();
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitaciones : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones(cantidadHabitaciones);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorTipo : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo(tipoPropiedad);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorServicios : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorServicios(servicios);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesTipo : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo(cantidadHabitaciones, tipoPropiedad);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesServicios : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Servicios(cantidadHabitaciones, servicios);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaTipoServicios : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo_Servicios(tipoPropiedad, servicios);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaFull : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo_Servicios(cantidadHabitaciones, tipoPropiedad, servicios);
|
||||
}
|
||||
}
|
||||
6
Aspnet/Strategy/Busqueda/IBusquedaStrategy.cs
Normal file
6
Aspnet/Strategy/Busqueda/IBusquedaStrategy.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace AlquilaFacil.StrategyBusqueda;
|
||||
using Entidades.Dto;
|
||||
public interface IBusquedaStrategy {
|
||||
IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad);
|
||||
}
|
||||
|
||||
29
Aspnet/Strategy/BusquedaAdmin/AdminBusquedaContext.cs
Normal file
29
Aspnet/Strategy/BusquedaAdmin/AdminBusquedaContext.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace AlquilaFacil.StrategyBusquedaAdmin;
|
||||
|
||||
public class AdminBusquedaContext
|
||||
{
|
||||
private static readonly AdminBusquedaContext singleton = new();
|
||||
public static AdminBusquedaContext Singleton {get { return singleton; } }
|
||||
|
||||
private readonly Dictionary<string, IAdminBusquedaStrategy> _estrategias;
|
||||
|
||||
public AdminBusquedaContext()
|
||||
{
|
||||
_estrategias = new Dictionary<string, IAdminBusquedaStrategy>
|
||||
{
|
||||
{ "000", new BusquedaSinParametros() },
|
||||
{ "100", new BusquedaPorHabitaciones() },
|
||||
{ "010", new BusquedaPorTipo() },
|
||||
{ "001", new BusquedaPorServicios() },
|
||||
{ "110", new BusquedaPorHabitacionesTipo() },
|
||||
{ "101", new BusquedaPorHabitacionesServicios() },
|
||||
{ "011", new BusquedaTipoServicios() },
|
||||
{ "111", new BusquedaFull() }
|
||||
};
|
||||
}
|
||||
|
||||
public IAdminBusquedaStrategy ObtenerEstrategia(string clave)
|
||||
{
|
||||
return _estrategias.ContainsKey(clave) ? _estrategias[clave] : new BusquedaSinParametros();
|
||||
}
|
||||
}
|
||||
52
Aspnet/Strategy/BusquedaAdmin/Filtros.cs
Normal file
52
Aspnet/Strategy/BusquedaAdmin/Filtros.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Entidades.Admin;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.StrategyBusquedaAdmin;
|
||||
|
||||
public class BusquedaSinParametros : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ListarPropiedadesPorPaginaAdmin(pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitaciones : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitacionesPaginado(cantidadHabitaciones, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorTipo : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipoPaginado(tipoPropiedad, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorServicios : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorServiciosPaginado(servicios, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesTipo : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_TipoPaginado(cantidadHabitaciones, tipoPropiedad, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesServicios : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Servicios_Paginado(cantidadHabitaciones, servicios, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaTipoServicios : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo_Servicios_Paginado(tipoPropiedad, servicios, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaFull : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo_Servicios_Paginado(cantidadHabitaciones, tipoPropiedad, servicios, pag);
|
||||
}
|
||||
}
|
||||
6
Aspnet/Strategy/BusquedaAdmin/IAdminBusquedaStrategy.cs
Normal file
6
Aspnet/Strategy/BusquedaAdmin/IAdminBusquedaStrategy.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace AlquilaFacil.StrategyBusquedaAdmin;
|
||||
using Entidades.Admin;
|
||||
public interface IAdminBusquedaStrategy {
|
||||
IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag);
|
||||
}
|
||||
|
||||
4
Aspnet/bin/Debug/net8.0/settings.json
Normal file
4
Aspnet/bin/Debug/net8.0/settings.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usr":"aVO9C3PqeK1hiPCyqZCj",
|
||||
"scrt":"szj58kceWG3GcRZ8P1QCQiv5tSjMI7iD5zfjneTT"
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
run:
|
||||
dotnet watch run
|
||||
dotnet watch run --project AlquilaFacil.csproj
|
||||
|
||||
4
Aspnet/settings.json
Normal file
4
Aspnet/settings.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usr":"aVO9C3PqeK1hiPCyqZCj",
|
||||
"scrt":"szj58kceWG3GcRZ8P1QCQiv5tSjMI7iD5zfjneTT"
|
||||
}
|
||||
2
Entidades/Admin/EmailGrupo.cs
Normal file
2
Entidades/Admin/EmailGrupo.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
namespace Entidades.Admin;
|
||||
public record EmailGrupo(string email, string grupo);
|
||||
7
Entidades/Admin/GrupoAdmin.cs
Normal file
7
Entidades/Admin/GrupoAdmin.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Entidades.Admin;
|
||||
|
||||
public class GrupoAdmin {
|
||||
public int Id {get; set;} = 0;
|
||||
public String Descripcion {get; set;} = "";
|
||||
public List<Entidades.Admin.PermisoAdmin> Permisos {get; set;} = new();
|
||||
}
|
||||
6
Entidades/Admin/PermisosAdmin.cs
Normal file
6
Entidades/Admin/PermisosAdmin.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Admin;
|
||||
|
||||
public class PermisoAdmin {
|
||||
public int Id {get; set;}
|
||||
public String Descripcion {get; set;} = "";
|
||||
}
|
||||
13
Entidades/Admin/PropiedadesAdmin.cs
Normal file
13
Entidades/Admin/PropiedadesAdmin.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Entidades.Admin;
|
||||
public class PropiedadesAdmin {
|
||||
public int id { get; set; }
|
||||
public string Ubicacion { get; set; } = "";
|
||||
public int canthabitaciones { get; set; }
|
||||
public int piso { get; set; }
|
||||
public string letra { get; set; } = "";
|
||||
public string Tipo { get; set; } = "";
|
||||
public string? Servicios {get;set;} = "";
|
||||
public int Monto { get; set; }
|
||||
public string Estado { get; set; } = "";
|
||||
public int Iddivisa { get; set; }
|
||||
}
|
||||
8
Entidades/Admin/UsuarioAdmin.cs
Normal file
8
Entidades/Admin/UsuarioAdmin.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Admin;
|
||||
|
||||
public record UsuarioAdmin {
|
||||
public long Dni { get; set; } = 0;
|
||||
public string Nombre { get; set; } = "";
|
||||
public string Email { get; set; } = "";
|
||||
public ulong Habilitado { get; set; }
|
||||
}
|
||||
@@ -23,6 +23,10 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
public virtual DbSet<Defecto> Defectos { get; set; }
|
||||
|
||||
public virtual DbSet<Divisa> Divisas { get; set; }
|
||||
|
||||
public virtual DbSet<EstadoPropiedad> EstadoPropiedads { get; set; }
|
||||
|
||||
public virtual DbSet<Estadodefecto> Estadodefectos { get; set; }
|
||||
|
||||
public virtual DbSet<Estadoventa> Estadoventas { get; set; }
|
||||
@@ -31,12 +35,16 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
public virtual DbSet<Grupo> Grupos { get; set; }
|
||||
|
||||
public virtual DbSet<Notificacione> Notificaciones { get; set; }
|
||||
|
||||
public virtual DbSet<Permiso> Permisos { get; set; }
|
||||
|
||||
public virtual DbSet<Propiedade> Propiedades { get; set; }
|
||||
|
||||
public virtual DbSet<Recibo> Recibos { get; set; }
|
||||
|
||||
public virtual DbSet<Servicio> Servicios { get; set; }
|
||||
|
||||
public virtual DbSet<TipoPropiedad> TipoPropiedads { get; set; }
|
||||
|
||||
public virtual DbSet<Venta> Ventas { get; set; }
|
||||
@@ -99,6 +107,10 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("email");
|
||||
entity.Property(e => e.Habilitado)
|
||||
.HasDefaultValueSql("b'1'")
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("habilitado");
|
||||
entity.Property(e => e.Nombre)
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("nombre");
|
||||
@@ -143,9 +155,14 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idventa, "FK_CON_VEN");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_contdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Cancelado)
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("cancelado");
|
||||
entity.Property(e => e.Cantgarantemin)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("cantgarantemin");
|
||||
@@ -158,6 +175,12 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Fechainicio)
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("fechainicio");
|
||||
entity.Property(e => e.Habilitado)
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("habilitado");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idpropiedad)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idpropiedad");
|
||||
@@ -167,12 +190,17 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Indiceactualizacion)
|
||||
.HasPrecision(8)
|
||||
.HasColumnName("indiceactualizacion");
|
||||
entity.Property(e => e.MesesDurationContrato).HasColumnType("int(11)");
|
||||
entity.Property(e => e.MesesHastaAumento).HasColumnType("int(11)");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasPrecision(12)
|
||||
.HasColumnName("monto");
|
||||
entity.Property(e => e.Tieneopcionventa)
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("tieneopcionventa");
|
||||
entity.Property(e => e.UrlContrato)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("urlContrato");
|
||||
|
||||
entity.HasOne(d => d.DniinquilinoNavigation).WithMany(p => p.ContratoDniinquilinoNavigations)
|
||||
.HasForeignKey(d => d.Dniinquilino)
|
||||
@@ -184,6 +212,11 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_CON_PROPI");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_contdiv");
|
||||
|
||||
entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Idpropiedad)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
@@ -229,6 +262,8 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idestado, "FK_DEF_EST");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_defdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("id");
|
||||
@@ -236,11 +271,14 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasPrecision(12)
|
||||
.HasColumnName("costo");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(40)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("descripcion");
|
||||
entity.Property(e => e.Idcontrato)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("idcontrato");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idestado)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idestado");
|
||||
@@ -253,12 +291,43 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_DEF_CON");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Defectos)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_defdiv");
|
||||
|
||||
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Defectos)
|
||||
.HasForeignKey(d => d.Idestado)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_DEF_EST");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Divisa>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Signo)
|
||||
.HasMaxLength(3)
|
||||
.HasColumnName("signo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EstadoPropiedad>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("EstadoPropiedad");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(11)
|
||||
.HasColumnName("descripcion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Estadodefecto>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
@@ -287,17 +356,20 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
modelBuilder.Entity<Garante>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Dni).HasName("PRIMARY");
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.Property(e => e.Dni)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dni");
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Apellido)
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("apellido");
|
||||
entity.Property(e => e.Celular)
|
||||
.HasMaxLength(40)
|
||||
.HasColumnName("celular");
|
||||
entity.Property(e => e.Dni)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dni");
|
||||
entity.Property(e => e.Domicilio)
|
||||
.HasMaxLength(40)
|
||||
.HasColumnName("domicilio");
|
||||
@@ -308,7 +380,7 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("nombre");
|
||||
|
||||
entity.HasMany(d => d.Idcontratos).WithMany(p => p.Dnigarantes)
|
||||
entity.HasMany(d => d.Idcontratos).WithMany(p => p.Idgarantes)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"ContratoGarante",
|
||||
r => r.HasOne<Contrato>().WithMany()
|
||||
@@ -316,17 +388,17 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_CONGAR_CON"),
|
||||
l => l.HasOne<Garante>().WithMany()
|
||||
.HasForeignKey("Dnigarante")
|
||||
.HasForeignKey("Idgarante")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_CONGAR_GAR"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Dnigarante", "Idcontrato").HasName("PRIMARY");
|
||||
j.HasKey("Idgarante", "Idcontrato").HasName("PRIMARY");
|
||||
j.ToTable("contrato_garantes");
|
||||
j.HasIndex(new[] { "Idcontrato" }, "FK_CONGAR_CON");
|
||||
j.IndexerProperty<long>("Dnigarante")
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dnigarante");
|
||||
j.IndexerProperty<int>("Idgarante")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idgarante");
|
||||
j.IndexerProperty<long>("Idcontrato")
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("idcontrato");
|
||||
@@ -345,6 +417,50 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasColumnName("nombre");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Notificacione>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.Dnicliente, e.Fecha }).HasName("PRIMARY");
|
||||
|
||||
entity.HasIndex(e => e.Idpropiedad, "FK_NOTPROP");
|
||||
|
||||
entity.HasIndex(e => e.Dniremitente, "FK_NOTREM");
|
||||
|
||||
entity.Property(e => e.Dnicliente)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dnicliente");
|
||||
entity.Property(e => e.Fecha)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("fecha");
|
||||
entity.Property(e => e.Accion)
|
||||
.HasMaxLength(30)
|
||||
.HasColumnName("accion");
|
||||
entity.Property(e => e.Dniremitente)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dniremitente");
|
||||
entity.Property(e => e.Idpropiedad)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idpropiedad");
|
||||
entity.Property(e => e.Leido).HasColumnName("leido");
|
||||
entity.Property(e => e.Mensaje)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("mensaje");
|
||||
|
||||
entity.HasOne(d => d.DniclienteNavigation).WithMany(p => p.NotificacioneDniclienteNavigations)
|
||||
.HasForeignKey(d => d.Dnicliente)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_NOTCLI");
|
||||
|
||||
entity.HasOne(d => d.DniremitenteNavigation).WithMany(p => p.NotificacioneDniremitenteNavigations)
|
||||
.HasForeignKey(d => d.Dniremitente)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_NOTREM");
|
||||
|
||||
entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Notificaciones)
|
||||
.HasForeignKey(d => d.Idpropiedad)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_NOTPROP");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Permiso>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
@@ -353,7 +469,7 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(15)
|
||||
.HasMaxLength(25)
|
||||
.HasColumnName("descripcion");
|
||||
|
||||
entity.HasMany(d => d.Idgrupos).WithMany(p => p.Idpermisos)
|
||||
@@ -385,10 +501,14 @@ public partial class AlquilaFacilContext : DbContext
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.HasIndex(e => e.Idestado, "FK_PROP_EST");
|
||||
|
||||
entity.HasIndex(e => e.Dnipropietario, "FK_PROP_PROPI");
|
||||
|
||||
entity.HasIndex(e => e.Idtipropiedad, "FK_PROP_TIPO");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_propdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
@@ -398,6 +518,12 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Dnipropietario)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dnipropietario");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idestado)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idestado");
|
||||
entity.Property(e => e.Idtipropiedad)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idtipropiedad");
|
||||
@@ -405,6 +531,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasMaxLength(1)
|
||||
.IsFixedLength()
|
||||
.HasColumnName("letra");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasPrecision(10)
|
||||
.HasColumnName("monto");
|
||||
entity.Property(e => e.Piso)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("piso");
|
||||
@@ -417,6 +546,16 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_PROP_PROPI");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Propiedades)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_propdiv");
|
||||
|
||||
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Propiedades)
|
||||
.HasForeignKey(d => d.Idestado)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_PROP_EST");
|
||||
|
||||
entity.HasOne(d => d.IdtipropiedadNavigation).WithMany(p => p.Propiedades)
|
||||
.HasForeignKey(d => d.Idtipropiedad)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
@@ -440,6 +579,42 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasColumnName("monto");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Servicio>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("descripcion");
|
||||
|
||||
entity.HasMany(d => d.IdPropiedads).WithMany(p => p.IdServicios)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"ServicioPropiedad",
|
||||
r => r.HasOne<Propiedade>().WithMany()
|
||||
.HasForeignKey("IdPropiedad")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("Servicio_Propiedad_ibfk_2"),
|
||||
l => l.HasOne<Servicio>().WithMany()
|
||||
.HasForeignKey("IdServicio")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("Servicio_Propiedad_ibfk_1"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("IdServicio", "IdPropiedad").HasName("PRIMARY");
|
||||
j.ToTable("Servicio_Propiedad");
|
||||
j.HasIndex(new[] { "IdPropiedad" }, "idPropiedad");
|
||||
j.IndexerProperty<int>("IdServicio")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idServicio");
|
||||
j.IndexerProperty<int>("IdPropiedad")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idPropiedad");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TipoPropiedad>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
@@ -466,6 +641,8 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idpropiedad, "FK_VEN_PROP");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_ventdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("id");
|
||||
@@ -481,6 +658,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.IdVendedor)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("idVendedor");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idestado)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idestado");
|
||||
@@ -501,6 +681,11 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_VEN_PROL");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Venta)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_ventdiv");
|
||||
|
||||
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Venta)
|
||||
.HasForeignKey(d => d.Idestado)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
|
||||
@@ -21,10 +21,16 @@ public partial class Cliente
|
||||
|
||||
public string? Token { get; set; }
|
||||
|
||||
public ulong Habilitado { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> ContratoDniinquilinoNavigations { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Contrato> ContratoDnipropietarioNavigations { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Notificacione> NotificacioneDniclienteNavigations { get; set; } = new List<Notificacione>();
|
||||
|
||||
public virtual ICollection<Notificacione> NotificacioneDniremitenteNavigations { get; set; } = new List<Notificacione>();
|
||||
|
||||
public virtual ICollection<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
||||
|
||||
public virtual ICollection<Venta> VentaIdCompradorNavigations { get; set; } = new List<Venta>();
|
||||
|
||||
@@ -25,17 +25,31 @@ public partial class Contrato
|
||||
|
||||
public long? Idventa { get; set; }
|
||||
|
||||
public ulong Habilitado { get; set; }
|
||||
|
||||
public int MesesHastaAumento { get; set; }
|
||||
|
||||
public string? UrlContrato { get; set; }
|
||||
|
||||
public ulong Cancelado { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public int MesesDurationContrato { get; set; }
|
||||
|
||||
public virtual ICollection<Defecto> Defectos { get; set; } = new List<Defecto>();
|
||||
|
||||
public virtual Cliente? DniinquilinoNavigation { get; set; }
|
||||
|
||||
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
||||
|
||||
public virtual Venta? IdventaNavigation { get; set; }
|
||||
|
||||
public virtual ICollection<Garante> Dnigarantes { get; set; } = new List<Garante>();
|
||||
|
||||
public virtual ICollection<Canon> Idcanons { get; set; } = new List<Canon>();
|
||||
|
||||
public virtual ICollection<Garante> Idgarantes { get; set; } = new List<Garante>();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ public partial class Defecto
|
||||
|
||||
public ulong Pagainquilino { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public virtual Contrato? IdcontratoNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Estadodefecto? IdestadoNavigation { get; set; }
|
||||
}
|
||||
|
||||
19
Entidades/Divisa.cs
Normal file
19
Entidades/Divisa.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Divisa
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Signo { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Defecto> Defectos { get; set; } = new List<Defecto>();
|
||||
|
||||
public virtual ICollection<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
||||
|
||||
public virtual ICollection<Venta> Venta { get; set; } = new List<Venta>();
|
||||
}
|
||||
2
Entidades/Dto/AccionesDeGrupo.cs
Normal file
2
Entidades/Dto/AccionesDeGrupo.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
namespace Entidades.Dto;
|
||||
public record AccionesPorGrupoDto(string Email, string Grupo);
|
||||
5
Entidades/Dto/AceptarContratoDto.cs
Normal file
5
Entidades/Dto/AceptarContratoDto.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AceptarContratoDto {
|
||||
public long Idcontrato { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
}
|
||||
8
Entidades/Dto/AltaDefectoDto.cs
Normal file
8
Entidades/Dto/AltaDefectoDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AltaDefectoDto {
|
||||
public string Descripcion { get; set; } ="";
|
||||
public Decimal Costo { get; set; }
|
||||
public ulong Pagainquilino { get; set; }
|
||||
public int Iddivisa { get; set; }
|
||||
public long Idcontrato { get; set; }
|
||||
}
|
||||
9
Entidades/Dto/AltaGarantesDto.cs
Normal file
9
Entidades/Dto/AltaGarantesDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public class AltaGarantesDto {
|
||||
public string EmailInquilino { get; set; } = "";
|
||||
public int Idpropiedad {get; set;}
|
||||
public DateTime fecha { get; set;}
|
||||
public List<GaranteDto> garantes{ get; set; } = new();
|
||||
|
||||
}
|
||||
7
Entidades/Dto/AltaNotificacionDto.cs
Normal file
7
Entidades/Dto/AltaNotificacionDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AltaNotificacionDto {
|
||||
public string Remitente { get; set; } ="";
|
||||
public string Accion { get; set; } ="";
|
||||
public string Mensaje { get; set; } ="";
|
||||
public int Propiedad { get; set;}
|
||||
}
|
||||
11
Entidades/Dto/AltaPropiedadDto.cs
Normal file
11
Entidades/Dto/AltaPropiedadDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AltaPropiedadDto {
|
||||
public string Ubicacion { get; set; } = null!;
|
||||
public int Canthabitaciones { get; set; }
|
||||
public int? Piso { get; set; } = null;
|
||||
public string? Letra { get; set; } = null;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public int Idtipropiedad { get; set; }
|
||||
public int Monto { get; set; }
|
||||
public int Iddivisa { get; set; }
|
||||
}
|
||||
5
Entidades/Dto/AvisoInquilinoDto.cs
Normal file
5
Entidades/Dto/AvisoInquilinoDto.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AvisoInquilinoDto {
|
||||
public string Mensaje { get; set; } ="";
|
||||
public long Idpropiedad { get; set; }
|
||||
}
|
||||
3
Entidades/Dto/BusquedaDto.cs
Normal file
3
Entidades/Dto/BusquedaDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public record BusquedaDto(int Id, string Ubicacion, string? Servicios = "");
|
||||
8
Entidades/Dto/CancelarPrecontratoDto.cs
Normal file
8
Entidades/Dto/CancelarPrecontratoDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Dto;
|
||||
public class CancelarPrecontratoDto {
|
||||
public string EmailPropietario { get; set; } ="";
|
||||
public string EmailInquilino { get; set; } ="";
|
||||
public DateTime fecha { get; set; }
|
||||
|
||||
public int idpropiedad { get; set; } = 0;
|
||||
}
|
||||
10
Entidades/Dto/CanonDto.cs
Normal file
10
Entidades/Dto/CanonDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Entidades.Dto;
|
||||
public class CanonDto{
|
||||
public long Id { get; set;}
|
||||
public int MesNum { get; set;}
|
||||
public DateTime Mes { get; set;}
|
||||
public Decimal Monto { get; set;}
|
||||
public string Divisa { get; set;} = "";
|
||||
public bool Pago { get; set;}
|
||||
|
||||
}
|
||||
23
Entidades/Dto/Chart/Chartjs.cs
Normal file
23
Entidades/Dto/Chart/Chartjs.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class ChartData
|
||||
{
|
||||
[JsonPropertyName("labels")]
|
||||
public List<string> Labels { get; set; }=new();
|
||||
|
||||
[JsonPropertyName("datasets")]
|
||||
public List<Dataset> Datasets { get; set; }=new();
|
||||
}
|
||||
|
||||
public class Dataset
|
||||
{
|
||||
[JsonPropertyName("label")]
|
||||
public string Label { get; set; } ="";
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public List<string> Data { get; set; }= new();
|
||||
|
||||
[JsonPropertyName("borderWidth")]
|
||||
public int BorderWidth { get; set; }=1;
|
||||
}
|
||||
11
Entidades/Dto/ContratoDto.cs
Normal file
11
Entidades/Dto/ContratoDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Entidades.Dto;
|
||||
public class ContratoDto {
|
||||
public long id { get; set; }
|
||||
public string Ubicacion { get; set; }="";
|
||||
public string TipoPropiedad { get; set; }="";
|
||||
public DateTime Fechainicio { get; set; }
|
||||
public string Inquilino { get; set; }="";
|
||||
public string Propietario { get; set; }="";
|
||||
public string Estado {get; set;}="";
|
||||
|
||||
}
|
||||
8
Entidades/Dto/ContratoPropiedadDto.cs
Normal file
8
Entidades/Dto/ContratoPropiedadDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Dto;
|
||||
public class ContratoPropiedadDto : ContratoDto {
|
||||
public int Habitaciones { get; set; }
|
||||
public int Piso { get; set;}
|
||||
public string Letra { get; set; } = "";
|
||||
public int MesesAumento { get; set; }
|
||||
public int MesesDuracion { get; set; }
|
||||
}
|
||||
6
Entidades/Dto/CrearCanonsDto.cs
Normal file
6
Entidades/Dto/CrearCanonsDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public class CrearCanonsDto {
|
||||
public long idcontrato{ get; set; }
|
||||
public decimal aumento{ get; set; }
|
||||
}
|
||||
10
Entidades/Dto/DefectoDto.cs
Normal file
10
Entidades/Dto/DefectoDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Entidades.Dto;
|
||||
public class DefectoDto {
|
||||
public long Id { get; set;}
|
||||
public string Descripcion { get; set;} ="";
|
||||
public Decimal Costo { get; set;}
|
||||
public string Estado { get; set;} ="";
|
||||
public long Idcontrato { get; set;}
|
||||
public string Pagainquilino { get; set;} ="";
|
||||
public string Divisa { get; set;} ="";
|
||||
}
|
||||
16
Entidades/Dto/GaranteDto.cs
Normal file
16
Entidades/Dto/GaranteDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public class GaranteDto {
|
||||
public long Dni { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
public string Apellido { get; set; } = null!;
|
||||
|
||||
public string Domicilio { get; set; } = null!;
|
||||
|
||||
public string Celular { get; set; } = null!;
|
||||
|
||||
public string Domiciliolaboral { get; set; } = null!;
|
||||
|
||||
}
|
||||
6
Entidades/Dto/MarcarPagoDto.cs
Normal file
6
Entidades/Dto/MarcarPagoDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Dto;
|
||||
public class MarcarPagoDto {
|
||||
public long Idcontrato { get; set; }
|
||||
public DateTime fecha { get; set; }
|
||||
|
||||
}
|
||||
9
Entidades/Dto/NotificacionDto.cs
Normal file
9
Entidades/Dto/NotificacionDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Entidades.Dto;
|
||||
public class NotificacionDto {
|
||||
public string Remitente { get; set; } ="";
|
||||
public string Accion { get; set; } ="";
|
||||
public string Receptor { get; set; } ="";
|
||||
public string Mensaje { get; set; } ="";
|
||||
public DateTime? Fecha{get; set;} =null;
|
||||
public string Propiedad { get; set;} ="";
|
||||
}
|
||||
1
Entidades/Dto/NotificacionMarcarLeidoDto.cs
Normal file
1
Entidades/Dto/NotificacionMarcarLeidoDto.cs
Normal file
@@ -0,0 +1 @@
|
||||
public record NotificacionMarcarLeidoDto(DateTime? Fecha, string Email);
|
||||
3
Entidades/Dto/PatchPropiedadDto.cs
Normal file
3
Entidades/Dto/PatchPropiedadDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public record PatchPropiedadDto(int id, string Ubicacion, int Canthabitaciones, int? Piso, string? Letra, string Email, int tipo, List<string> Servicios, int Monto, int Iddivisa);
|
||||
11
Entidades/Dto/PrecontratoDto.cs
Normal file
11
Entidades/Dto/PrecontratoDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Entidades.Dto;
|
||||
public class PrecontratoDto {
|
||||
public string EmailInquilino { get; set; } = "";
|
||||
public string EmailPropietario { get; set; } = "";
|
||||
public int IdPropiedad { get; set; }
|
||||
public int CantidadGarantes { get; set; }
|
||||
public int MesesHastaAumento { get; set; }
|
||||
public bool TieneOpcionVenta { get; set; }
|
||||
public string fechaprimernotificacion { get; set; } = "";
|
||||
public int MesesDuracionContrato { get; set; }
|
||||
}
|
||||
12
Entidades/Dto/PropiedadesDto.cs
Normal file
12
Entidades/Dto/PropiedadesDto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Entidades.Dto;
|
||||
public class PropiedadesDto {
|
||||
public int id { get; set; }
|
||||
public string Ubicacion { get; set; } = "";
|
||||
public int canthabitaciones { get; set; }
|
||||
public int piso { get; set; }
|
||||
public string letra { get; set; } = "";
|
||||
public string Tipo { get; set; } = "";
|
||||
public string? Servicios {get;set;} = "";
|
||||
public int Monto { get; set; }
|
||||
public int Iddivisa { get; set; }
|
||||
}
|
||||
5
Entidades/Dto/RechazarContratoDto.cs
Normal file
5
Entidades/Dto/RechazarContratoDto.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Entidades.Dto;
|
||||
public class RechazarPreContrato {
|
||||
public long Idcontrato { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
}
|
||||
2
Entidades/Dto/ServicioAPropiedadDto.cs
Normal file
2
Entidades/Dto/ServicioAPropiedadDto.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
namespace Entidades.Dto;
|
||||
public record ServicioAPropiedadDto(int propiedadid, List<int> idServicios);
|
||||
6
Entidades/Dto/SubirContratoDto.cs
Normal file
6
Entidades/Dto/SubirContratoDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using System.Configuration;
|
||||
|
||||
namespace Entidades.Dto;
|
||||
public class SubirContratoDto{
|
||||
public int IdContrato { get; set; }
|
||||
}
|
||||
13
Entidades/Estadopropiedad.cs
Normal file
13
Entidades/Estadopropiedad.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class EstadoPropiedad
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Descripcion { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace Entidades;
|
||||
|
||||
public partial class Garante
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public long Dni { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
@@ -9,6 +10,7 @@ public partial class Grupo
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Cliente> Idclientes { get; set; } = new List<Cliente>();
|
||||
|
||||
public virtual ICollection<Permiso> Idpermisos { get; set; } = new List<Permiso>();
|
||||
|
||||
6
Entidades/Informes/InfomesAlquiler.cs
Normal file
6
Entidades/Informes/InfomesAlquiler.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Informes;
|
||||
public class InformesAlquiler {
|
||||
public long Id { get; set; }
|
||||
public string Ubicacion { get; set; }="";
|
||||
public string Divisa { get; set; }="";
|
||||
}
|
||||
17
Entidades/Informes/InformeMeses.cs
Normal file
17
Entidades/Informes/InformeMeses.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Entidades.Informes;
|
||||
public class InformesMeses {
|
||||
public int Meses { get; set; }
|
||||
public int Repes{ get; set; }
|
||||
public string Semaforizacion {get {
|
||||
switch(Repes.CompareTo(2)){
|
||||
case 1:
|
||||
return "🟢";
|
||||
case 0:
|
||||
return "🟡";
|
||||
case -1:
|
||||
return "🔴";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}}
|
||||
}
|
||||
27
Entidades/Notificacione.cs
Normal file
27
Entidades/Notificacione.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Notificacione
|
||||
{
|
||||
public long Dnicliente { get; set; }
|
||||
|
||||
public long Dniremitente { get; set; }
|
||||
|
||||
public DateTime Fecha { get; set; }
|
||||
|
||||
public string Mensaje { get; set; } = null!;
|
||||
|
||||
public string Accion { get; set; } = null!;
|
||||
|
||||
public int Idpropiedad { get; set; }
|
||||
|
||||
public bool Leido { get; set; }
|
||||
|
||||
public virtual Cliente DniclienteNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Cliente DniremitenteNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Propiedade IdpropiedadNavigation { get; set; } = null!;
|
||||
}
|
||||
@@ -8,7 +8,7 @@ public partial class Permiso
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Descripcion { get; set; }
|
||||
public string Descripcion { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||
|
||||
@@ -19,11 +19,25 @@ public partial class Propiedade
|
||||
|
||||
public int Idtipropiedad { get; set; }
|
||||
|
||||
public int? Idestado { get; set; }
|
||||
|
||||
public decimal Monto { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual EstadoPropiedad? IdestadoNavigation { get; set; }
|
||||
|
||||
public virtual TipoPropiedad IdtipropiedadNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Notificacione> Notificaciones { get; set; } = new List<Notificacione>();
|
||||
|
||||
public virtual ICollection<Venta> Venta { get; set; } = new List<Venta>();
|
||||
|
||||
public virtual ICollection<Servicio> IdServicios { get; set; } = new List<Servicio>();
|
||||
}
|
||||
|
||||
15
Entidades/Servicio.cs
Normal file
15
Entidades/Servicio.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Servicio
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Descripcion { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Propiedade> IdPropiedads { get; set; } = new List<Propiedade>();
|
||||
}
|
||||
@@ -21,12 +21,16 @@ public partial class Venta
|
||||
|
||||
public DateTime? Fechafinal { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual Cliente? IdCompradorNavigation { get; set; }
|
||||
|
||||
public virtual Cliente? IdVendedorNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Estadoventa? IdestadoNavigation { get; set; }
|
||||
|
||||
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
||||
|
||||
4
Front/.prettierrc
Normal file
4
Front/.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"tabWidth": 4,
|
||||
"useTabs": false
|
||||
}
|
||||
BIN
Front/bun.lockb
BIN
Front/bun.lockb
Binary file not shown.
@@ -2,10 +2,15 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<link rel="icon" type="image/png" href="/favicon.svg" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.7/dist/chart.umd.min.js"></script>
|
||||
<script>
|
||||
// Configura el tema desde localStorage antes de cargar la aplicación
|
||||
const savedTheme = localStorage.getItem("theme") || "light";
|
||||
document.documentElement.setAttribute("data-bs-theme", savedTheme);
|
||||
</script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>AlquilaFacil</title>
|
||||
</head>
|
||||
|
||||
723
Front/package-lock.json
generated
Normal file
723
Front/package-lock.json
generated
Normal file
@@ -0,0 +1,723 @@
|
||||
{
|
||||
"name": "front",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "front",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@sveltejs/kit": "^2.7.3",
|
||||
"@sveltestrap/sveltestrap": "^6.2.7",
|
||||
"chartjs": "^0.3.24",
|
||||
"svelte-routing": "^2.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||
"@tsconfig/svelte": "^5.0.4",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.3",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^4.0.5",
|
||||
"tslib": "^2.8.0",
|
||||
"typescript": "^5.6.3",
|
||||
"vite": "^5.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
"version": "2.3.0",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.5",
|
||||
"@jridgewell/trace-mapping": "^0.3.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.21.5",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
"version": "0.3.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/set-array": "^1.2.1",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||
"@jridgewell/trace-mapping": "^0.3.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.2",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/set-array": {
|
||||
"version": "1.2.1",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.5.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.25",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||
}
|
||||
},
|
||||
"node_modules/@polka/url": {
|
||||
"version": "1.0.0-next.28",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@popperjs/core": {
|
||||
"version": "2.11.8",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||
"version": "4.24.0",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||
"version": "4.24.0",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@sveltejs/kit": {
|
||||
"version": "2.7.3",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/cookie": "^0.6.0",
|
||||
"cookie": "^0.6.0",
|
||||
"devalue": "^5.1.0",
|
||||
"esm-env": "^1.0.0",
|
||||
"import-meta-resolve": "^4.1.0",
|
||||
"kleur": "^4.1.5",
|
||||
"magic-string": "^0.30.5",
|
||||
"mrmime": "^2.0.0",
|
||||
"sade": "^1.8.1",
|
||||
"set-cookie-parser": "^2.6.0",
|
||||
"sirv": "^3.0.0",
|
||||
"tiny-glob": "^0.2.9"
|
||||
},
|
||||
"bin": {
|
||||
"svelte-kit": "svelte-kit.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.13"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1",
|
||||
"svelte": "^4.0.0 || ^5.0.0-next.0",
|
||||
"vite": "^5.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@sveltejs/vite-plugin-svelte": {
|
||||
"version": "4.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sveltejs/vite-plugin-svelte-inspector": "^3.0.0-next.0||^3.0.0",
|
||||
"debug": "^4.3.7",
|
||||
"deepmerge": "^4.3.1",
|
||||
"kleur": "^4.1.5",
|
||||
"magic-string": "^0.30.12",
|
||||
"vitefu": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || ^20.0.0 || >=22"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"svelte": "^5.0.0-next.96 || ^5.0.0",
|
||||
"vite": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sveltejs/vite-plugin-svelte-inspector": {
|
||||
"version": "3.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || ^20.0.0 || >=22"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0-next.0||^4.0.0",
|
||||
"svelte": "^5.0.0-next.96 || ^5.0.0",
|
||||
"vite": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sveltestrap/sveltestrap": {
|
||||
"version": "6.2.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"svelte": "^4.0.0 || ^5.0.0 || ^5.0.0-next.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/svelte": {
|
||||
"version": "5.0.4",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/cookie": {
|
||||
"version": "0.6.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/estree": {
|
||||
"version": "1.0.6",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.12.1",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-typescript": {
|
||||
"version": "1.4.13",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"acorn": ">=8.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/aria-query": {
|
||||
"version": "5.3.2",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/axobject-query": {
|
||||
"version": "4.1.0",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/chartjs": {
|
||||
"version": "0.3.24",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/chokidar": {
|
||||
"version": "4.0.1",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readdirp": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.16.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.6.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.7",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/deepmerge": {
|
||||
"version": "4.3.1",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/devalue": {
|
||||
"version": "5.1.1",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.21.5",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.21.5",
|
||||
"@esbuild/android-arm": "0.21.5",
|
||||
"@esbuild/android-arm64": "0.21.5",
|
||||
"@esbuild/android-x64": "0.21.5",
|
||||
"@esbuild/darwin-arm64": "0.21.5",
|
||||
"@esbuild/darwin-x64": "0.21.5",
|
||||
"@esbuild/freebsd-arm64": "0.21.5",
|
||||
"@esbuild/freebsd-x64": "0.21.5",
|
||||
"@esbuild/linux-arm": "0.21.5",
|
||||
"@esbuild/linux-arm64": "0.21.5",
|
||||
"@esbuild/linux-ia32": "0.21.5",
|
||||
"@esbuild/linux-loong64": "0.21.5",
|
||||
"@esbuild/linux-mips64el": "0.21.5",
|
||||
"@esbuild/linux-ppc64": "0.21.5",
|
||||
"@esbuild/linux-riscv64": "0.21.5",
|
||||
"@esbuild/linux-s390x": "0.21.5",
|
||||
"@esbuild/linux-x64": "0.21.5",
|
||||
"@esbuild/netbsd-x64": "0.21.5",
|
||||
"@esbuild/openbsd-x64": "0.21.5",
|
||||
"@esbuild/sunos-x64": "0.21.5",
|
||||
"@esbuild/win32-arm64": "0.21.5",
|
||||
"@esbuild/win32-ia32": "0.21.5",
|
||||
"@esbuild/win32-x64": "0.21.5"
|
||||
}
|
||||
},
|
||||
"node_modules/esm-env": {
|
||||
"version": "1.0.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/esrap": {
|
||||
"version": "1.2.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.4.15",
|
||||
"@types/estree": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/fdir": {
|
||||
"version": "6.4.0",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"picomatch": "^3 || ^4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"picomatch": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/globalyzer": {
|
||||
"version": "0.1.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/globrex": {
|
||||
"version": "0.1.2",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/import-meta-resolve": {
|
||||
"version": "4.1.0",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/wooorm"
|
||||
}
|
||||
},
|
||||
"node_modules/is-reference": {
|
||||
"version": "3.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/kleur": {
|
||||
"version": "4.1.5",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-character": {
|
||||
"version": "3.0.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/magic-string": {
|
||||
"version": "0.30.12",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mri": {
|
||||
"version": "1.2.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/mrmime": {
|
||||
"version": "2.0.0",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.7",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.0",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.47",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.7",
|
||||
"picocolors": "^1.1.0",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.4.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
|
||||
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier-plugin-svelte": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.3.3.tgz",
|
||||
"integrity": "sha512-yViK9zqQ+H2qZD1w/bH7W8i+bVfKrD8GIFjkFe4Thl6kCT9SlAsXVNmt3jCvQOCsnOhcvYgsoVlRV/Eu6x5nNw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"prettier": "^3.0.0",
|
||||
"svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0"
|
||||
}
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.0.2",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14.16.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.24.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.6"
|
||||
},
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.24.0",
|
||||
"@rollup/rollup-android-arm64": "4.24.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.24.0",
|
||||
"@rollup/rollup-darwin-x64": "4.24.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.24.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.24.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.24.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.24.0",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.24.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.24.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.24.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.24.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.24.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.24.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.24.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.24.0",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/sade": {
|
||||
"version": "1.8.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mri": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/set-cookie-parser": {
|
||||
"version": "2.7.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sirv": {
|
||||
"version": "3.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@polka/url": "^1.0.0-next.24",
|
||||
"mrmime": "^2.0.0",
|
||||
"totalist": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte": {
|
||||
"version": "5.1.9",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": "^2.3.0",
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||
"@types/estree": "^1.0.5",
|
||||
"acorn": "^8.12.1",
|
||||
"acorn-typescript": "^1.4.13",
|
||||
"aria-query": "^5.3.1",
|
||||
"axobject-query": "^4.1.0",
|
||||
"esm-env": "^1.0.0",
|
||||
"esrap": "^1.2.2",
|
||||
"is-reference": "^3.0.2",
|
||||
"locate-character": "^3.0.0",
|
||||
"magic-string": "^0.30.11",
|
||||
"zimmerframe": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-check": {
|
||||
"version": "4.0.5",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"chokidar": "^4.0.1",
|
||||
"fdir": "^6.2.0",
|
||||
"picocolors": "^1.0.0",
|
||||
"sade": "^1.7.4"
|
||||
},
|
||||
"bin": {
|
||||
"svelte-check": "bin/svelte-check"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"svelte": "^4.0.0 || ^5.0.0-next.0",
|
||||
"typescript": ">=5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-routing": {
|
||||
"version": "2.13.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/tiny-glob": {
|
||||
"version": "0.2.9",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"globalyzer": "0.1.0",
|
||||
"globrex": "^0.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/totalist": {
|
||||
"version": "3.0.1",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.0",
|
||||
"dev": true,
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.6.3",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.4.10",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.21.3",
|
||||
"postcss": "^8.4.43",
|
||||
"rollup": "^4.20.0"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.0.0 || >=20.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^18.0.0 || >=20.0.0",
|
||||
"less": "*",
|
||||
"lightningcss": "^1.21.0",
|
||||
"sass": "*",
|
||||
"sass-embedded": "*",
|
||||
"stylus": "*",
|
||||
"sugarss": "*",
|
||||
"terser": "^5.4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"lightningcss": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/vitefu": {
|
||||
"version": "1.0.3",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"tests/deps/*",
|
||||
"tests/projects/*"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0-beta.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"vite": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/zimmerframe": {
|
||||
"version": "1.1.2",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
||||
"@tsconfig/svelte": "^5.0.4",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-svelte": "^3.3.3",
|
||||
"svelte": "^5.0.0",
|
||||
"svelte-check": "^4.0.5",
|
||||
"tslib": "^2.8.0",
|
||||
@@ -21,6 +23,8 @@
|
||||
"dependencies": {
|
||||
"@sveltejs/kit": "^2.7.3",
|
||||
"@sveltestrap/sveltestrap": "^6.2.7",
|
||||
"chartjs": "^0.3.24",
|
||||
"svelte-chartjs": "^3.1.5",
|
||||
"svelte-routing": "^2.13.0"
|
||||
}
|
||||
}
|
||||
|
||||
1
Front/public/bell.svg
Normal file
1
Front/public/bell.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-bell"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6" /><path d="M9 17v1a3 3 0 0 0 6 0v-1" /></svg>
|
||||
|
After Width: | Height: | Size: 447 B |
Binary file not shown.
|
Before Width: | Height: | Size: 41 KiB |
4
Front/public/favicon.svg
Normal file
4
Front/public/favicon.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" class="size-6">
|
||||
<path fill-rule="evenodd" d="M4.125 3C3.089 3 2.25 3.84 2.25 4.875V18a3 3 0 0 0 3 3h15a3 3 0 0 1-3-3V4.875C17.25 3.839 16.41 3 15.375 3H4.125ZM12 9.75a.75.75 0 0 0 0 1.5h1.5a.75.75 0 0 0 0-1.5H12Zm-.75-2.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 0 1.5H12a.75.75 0 0 1-.75-.75ZM6 12.75a.75.75 0 0 0 0 1.5h7.5a.75.75 0 0 0 0-1.5H6Zm-.75 3.75a.75.75 0 0 1 .75-.75h7.5a.75.75 0 0 1 0 1.5H6a.75.75 0 0 1-.75-.75ZM6 6.75a.75.75 0 0 0-.75.75v3c0 .414.336.75.75.75h3a.75.75 0 0 0 .75-.75v-3A.75.75 0 0 0 9 6.75H6Z" clip-rule="evenodd" />
|
||||
<path d="M18.75 6.75h1.875c.621 0 1.125.504 1.125 1.125V18a1.5 1.5 0 0 1-3 0V6.75Z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 715 B |
14
Front/public/toggle-left.svg
Normal file
14
Front/public/toggle-left.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
unicode: "fec0"
|
||||
version: "3.2"
|
||||
-->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M8 9a3 3 0 1 1 -3 3l.005 -.176a3 3 0 0 1 2.995 -2.824" />
|
||||
<path d="M16 5a7 7 0 0 1 0 14h-8a7 7 0 0 1 0 -14zm0 2h-8a5 5 0 1 0 0 10h8a5 5 0 0 0 0 -10" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 327 B |
14
Front/public/toggle-right.svg
Normal file
14
Front/public/toggle-right.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<!--
|
||||
unicode: "febf"
|
||||
version: "3.2"
|
||||
-->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M16 9a3 3 0 1 1 -3 3l.005 -.176a3 3 0 0 1 2.995 -2.824" />
|
||||
<path d="M16 5a7 7 0 0 1 0 14h-8a7 7 0 0 1 0 -14zm0 2h-8a5 5 0 1 0 0 10h8a5 5 0 0 0 0 -10" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 328 B |
19
Front/public/zoom.svg
Normal file
19
Front/public/zoom.svg
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--
|
||||
tags: [find, magnifier, magnifying glass]
|
||||
version: "1.0"
|
||||
unicode: "fdaa"
|
||||
-->
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="white"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" />
|
||||
<path d="M21 21l-6 -6" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 369 B |
@@ -1,33 +1,128 @@
|
||||
<script lang="ts">
|
||||
import Login from "./login/loginPage.svelte";
|
||||
import Login from "./paginas/login.svelte";
|
||||
import { Router, Route, link } from 'svelte-routing';
|
||||
import MenuPage from './Menu/page.svelte';
|
||||
import ProteRoute from './lib/RutaProtegida.svelte';
|
||||
import InfoPage from './Info/page.svelte';
|
||||
import InqPage from "./Inquilino/page.svelte";
|
||||
import PropPage from "./Propietario/page.svelte";
|
||||
import MenuPage from './paginas/menu.svelte';
|
||||
import ProteRoute from './Componentes/RutaProtegida.svelte';
|
||||
import InfoPage from './paginas/info.svelte';
|
||||
import InqPage from "./paginas/inquilino.svelte";
|
||||
import PropPage from "./paginas/propietario.svelte";
|
||||
import MisPropiedades from "./paginas/MisPropiedades.svelte";
|
||||
import MisPropiedadesDeBaja from "./paginas/MisPropiedadesDeBaja.svelte";
|
||||
import FrontAdmin from "./paginas/grupos/AdminG.svelte";
|
||||
import FrontInformes from "./paginas/grupos/InformesG.svelte";
|
||||
import FrontInquilino from "./paginas/grupos/InquilinoG.svelte";
|
||||
import FrontPropietario from "./paginas/grupos/PropietarioG.svelte";
|
||||
import PublicarPropiedad from "./paginas/PublicarPropiedad.svelte";
|
||||
import BusquedaPropiedades from "./paginas/BusquedaPropiedades.svelte";
|
||||
import AdminUsuarios from "./paginas/AdminUsuarios.svelte";
|
||||
import AdminPropiedades from "./paginas/AdminPropiedades.svelte";
|
||||
import Notificaciones from "./paginas/Notificaciones.svelte";
|
||||
import ControlAlquileresInquilino from "./paginas/ControlAlquileresInquilino.svelte";
|
||||
import ControlAlquileresPropietario from "./paginas/ControlAlquileresPropietario.svelte";
|
||||
import ContratosPropietario from "./paginas/ContratosPropietario.svelte";
|
||||
import ContratoInquilino from "./paginas/ContratoInquilino.svelte";
|
||||
import Informes from "./paginas/Informes.svelte";
|
||||
</script>
|
||||
|
||||
<Router>
|
||||
|
||||
<!-- Plantilla path
|
||||
<Route path="">
|
||||
<ProteRoute componente={}/>
|
||||
</Route>
|
||||
-->
|
||||
|
||||
<Route path="/" component={Login} />
|
||||
<Route path="/Info" component={InfoPage} />
|
||||
|
||||
<Route path="/inqtest" component={InqPage} />
|
||||
|
||||
|
||||
<Route path="/Menu">
|
||||
<ProteRoute componente={MenuPage} />
|
||||
</Route>
|
||||
|
||||
<!--Publicar Prop
|
||||
iedad-->
|
||||
<Route path="/accion/1">
|
||||
<ProteRoute componente={PublicarPropiedad}/>
|
||||
</Route>
|
||||
|
||||
<!--Mis Propiedades-->
|
||||
<Route path="/accion/2">
|
||||
<ProteRoute componente={MisPropiedades}/>
|
||||
</Route>
|
||||
|
||||
<!--Buscar Propiedades-->
|
||||
<Route path="/accion/3">
|
||||
<ProteRoute componente={BusquedaPropiedades}/>
|
||||
</Route>
|
||||
|
||||
<!--Crear Cuenta Inquilino-->
|
||||
<Route path="/accion/4">
|
||||
<ProteRoute componente={InqPage}/>
|
||||
</Route>
|
||||
|
||||
|
||||
<!--Crear Cuenta Propietario-->
|
||||
<Route path="/accion/5">
|
||||
<ProteRoute componente={PropPage}/>
|
||||
</Route>
|
||||
|
||||
<!--Crear Cuenta Propietario-->
|
||||
<Route path="/accion/6">
|
||||
<ProteRoute componente={Informes}/>
|
||||
</Route>
|
||||
|
||||
<!--Administrar Propiedades Dadas de Baja-->
|
||||
<Route path="/accion/8">
|
||||
<ProteRoute componente={MisPropiedadesDeBaja}/>
|
||||
</Route>
|
||||
|
||||
<!-- Pantalla Control Usuarios -->
|
||||
<Route path="/accion/9">
|
||||
<ProteRoute componente={AdminUsuarios}/>
|
||||
</Route>
|
||||
|
||||
<!-- Pantalla Control Propiedades -->
|
||||
<Route path="/accion/10">
|
||||
<ProteRoute componente={AdminPropiedades}/>
|
||||
</Route>
|
||||
|
||||
<!-- Pantalla Control Alquileres Inquilino -->
|
||||
<Route path="/accion/11">
|
||||
<ProteRoute componente={ControlAlquileresInquilino}/>
|
||||
</Route>
|
||||
|
||||
<!-- Pantalla Control Alquileres Propietario -->
|
||||
<Route path="/accion/12">
|
||||
<ProteRoute componente={ControlAlquileresPropietario}/>
|
||||
</Route>
|
||||
|
||||
<!--Paginas info Grupo-->
|
||||
<Route path="/grupo/Inquilino">
|
||||
<ProteRoute componente={FrontInquilino}/>
|
||||
</Route>
|
||||
<Route path="/grupo/Propietario">
|
||||
<ProteRoute componente={FrontPropietario}/>
|
||||
</Route>
|
||||
<Route path="/grupo/Admin">
|
||||
<ProteRoute componente={FrontAdmin}/>
|
||||
</Route>
|
||||
<Route path="/grupo/Informes">
|
||||
<ProteRoute componente={FrontInformes}/>
|
||||
</Route>
|
||||
|
||||
<!--Notificaciones-->
|
||||
<Route path="/notificaciones">
|
||||
<ProteRoute componente={Notificaciones}/>
|
||||
</Route>
|
||||
|
||||
<!--Contratos Propietarios-->
|
||||
<Route path="/propietario/contratos">
|
||||
<ProteRoute componente={ContratosPropietario}/>
|
||||
</Route>
|
||||
|
||||
<!--Contratos Inquilino-->
|
||||
<Route path="/inquilino/contratos">
|
||||
<ProteRoute componente={ContratoInquilino}/>
|
||||
</Route>
|
||||
|
||||
</Router>
|
||||
|
||||
|
||||
86
Front/src/Componentes/AdminPanelBusqueda.svelte
Normal file
86
Front/src/Componentes/AdminPanelBusqueda.svelte
Normal file
@@ -0,0 +1,86 @@
|
||||
<script lang="ts">
|
||||
import "./css/dotted-line.css";
|
||||
import {urlG} from "../stores/urlStore";
|
||||
import type { AdminParametrosBusqueda, PropiedadAdmin } from "../types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
let canthabitaciones:number = $state(0);
|
||||
let servicios = ["Gas", "Internet", "Telefono", "Luz"];
|
||||
let serviciosSel:string[] = $state([]);
|
||||
let tipo: number = $state(0);
|
||||
|
||||
|
||||
|
||||
let { Params }: { Params: (a: AdminParametrosBusqueda) => void} = $props();
|
||||
|
||||
let token = sessionStorage.getItem("token");
|
||||
|
||||
async function formsubmit(e: Event){
|
||||
e.preventDefault();
|
||||
let params: AdminParametrosBusqueda = {
|
||||
cantidadhabitaciones: canthabitaciones||0,
|
||||
pag: 1,
|
||||
servicios: serviciosSel.join(","),
|
||||
tipopropiedad: tipo,
|
||||
};
|
||||
Params(params);
|
||||
}
|
||||
</script>
|
||||
|
||||
<form class="card p-3 border border-succes">
|
||||
|
||||
<div>Busqueda Filtrada
|
||||
<div class="dotted-line"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input
|
||||
type="number"
|
||||
id="canthabitaciones"
|
||||
class="form-control"
|
||||
bind:value={canthabitaciones}
|
||||
min="0"
|
||||
placeholder="Cantidad de Habitaciones"
|
||||
required
|
||||
/>
|
||||
<label for="canthabitaciones">Cantidad de Habitaciones</label>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<h6 class="form-floating form-label">Servicios</h6>
|
||||
{#each servicios as servicio}
|
||||
<div class="form-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="form-check-input"
|
||||
bind:group={serviciosSel}
|
||||
value={servicio}
|
||||
id={`servicio-${servicio}`}
|
||||
|
||||
/>
|
||||
<label class="form-check-label" for={`servicio-${servicio}`}>
|
||||
{servicio}
|
||||
</label>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<select id="idtipo" class="form-select" bind:value={tipo} required>
|
||||
<option value="0">No Define</option>
|
||||
<option value="1">Casa</option>
|
||||
<option value="2">Piso</option>
|
||||
<option value="3">Departamento</option>
|
||||
<option value="4">Galpon</option>
|
||||
<option value="5">LocalComercial</option>
|
||||
<option value="6">Oficina</option>
|
||||
</select>
|
||||
<label for="idtipopropiedad">Tipo de propiedad</label>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 d-flex align-items-center justify-content-center" onclick={formsubmit}>
|
||||
Buscar
|
||||
<img src="/zoom.svg" alt="" class="ms-2" style="height: 1.2em;" />
|
||||
</button>
|
||||
</form>
|
||||
|
||||
65
Front/src/Componentes/AdminPropiedad.svelte
Normal file
65
Front/src/Componentes/AdminPropiedad.svelte
Normal file
@@ -0,0 +1,65 @@
|
||||
<script lang="ts">
|
||||
import type { PropiedadAdmin } from "../types";
|
||||
import {urlG} from "../stores/urlStore";
|
||||
|
||||
let { prop, modal }: { prop: PropiedadAdmin, modal: (a:string) => void } = $props();
|
||||
|
||||
const token = sessionStorage.getItem("token");
|
||||
|
||||
async function cambioEstado() {
|
||||
try {
|
||||
const response = await fetch($urlG+"/api/admin/propiedad?id="+prop.id, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
}
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
prop.estado = prop.estado=="Baja" ? "Disponible": "Baja";
|
||||
}
|
||||
|
||||
let data = await response.json();
|
||||
modal(String(data.message));
|
||||
|
||||
|
||||
} catch {
|
||||
modal("Fallo al intentar enviar la peticion para dar de baja");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="card text-center border shadow-sm">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h5 class="mb-0">{prop.tipo}</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="card-img-top mb-3">
|
||||
<i class="bi bi-building" style="font-size: 3rem;"></i>
|
||||
</div>
|
||||
<h6 class="card-title">{prop.ubicacion}</h6>
|
||||
<p class="card-text">
|
||||
<strong>Habitaciones:</strong> {prop.canthabitaciones}<br>
|
||||
<strong>Piso:</strong> {prop.piso || "N/A"}<br>
|
||||
<strong>Letra:</strong> {prop.letra || "N/A"}<br>
|
||||
<strong>Servicios:</strong> {prop.servicios || "Sin servicios especificados"}<br>
|
||||
<strong>Monto:</strong>
|
||||
{#if prop.iddivisa == 0}
|
||||
AR$
|
||||
{:else}
|
||||
US$
|
||||
{/if}
|
||||
{prop.monto}<br>
|
||||
<strong>Estado:</strong> {prop.estado}<br>
|
||||
</p>
|
||||
{#if prop.estado == "Disponible"}
|
||||
<button class="btn btn-success" onclick={cambioEstado}>Baja</button>
|
||||
{:else}
|
||||
<button class="btn btn-danger" onclick={cambioEstado}>Alta</button>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="card-footer text-muted">
|
||||
ID Propiedad: {prop.id}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user