Compare commits
85 Commits
logicamerg
...
v1.0config
| Author | SHA1 | Date | |
|---|---|---|---|
| cc36565334 | |||
| 3240a526bf | |||
| ed3e9f6b1c | |||
| 0cde92ce19 | |||
| b4090f74e0 | |||
| d0ea1171f8 | |||
| 5e0e92d72b | |||
| e3889d89e1 | |||
| 5ec16897c7 | |||
| d5f5b7de56 | |||
| cdfa52bb19 | |||
| e7747455ec | |||
| 2a8ba5a9f4 | |||
| af231344b6 | |||
| c0bc97fb64 | |||
| 68745cab5e | |||
| b98cf77807 | |||
| 3b96248208 | |||
| 029f8e5fce | |||
| ac2de71179 | |||
| 333ee5d326 | |||
| ccf909e825 | |||
| 72f277ab6c | |||
| c7880b03b3 | |||
| 17fae0e777 | |||
| 7b1e70999f | |||
| 00d4ec8a0e | |||
| 27f20b92e8 | |||
| d0a24ce0b7 | |||
| 1fd0c12793 | |||
| 928c590d1c | |||
| f750ecc77e | |||
| 2b481e2ae2 | |||
| f8692ccdf0 | |||
| 99dc7b28d5 | |||
| ee7c36f373 | |||
| 0cb1ea5266 | |||
| 6592afb3a7 | |||
| 0679fcef40 | |||
| 04a3deeae5 | |||
| 8d4281b715 | |||
| f9470bb005 | |||
| 9c12cfb261 | |||
| f0ba684c8c | |||
| 7137b1bbff | |||
| 1b78956077 | |||
| 6d04fdb48a | |||
| d5cb65403e | |||
| f5e3c4aacd | |||
| 28415f8ba8 | |||
| 9a088a37b2 | |||
| 2b757e527f | |||
| 59981d76d8 | |||
| 13e2566c24 | |||
| 3634736b95 | |||
| a6b4e8394d | |||
| a000b7bd39 | |||
| 013744d129 | |||
| 7565e21df8 | |||
| 280bcd294a | |||
| a85d39cba8 | |||
| d64c46e440 | |||
| a19d2b2a42 | |||
| 062b97515f | |||
| 69b83c8380 | |||
| db7c66e15b | |||
| c362949bdc | |||
| 2ee926eb8a | |||
| 7349454d8f | |||
| 5f56b32afa | |||
| d49e7ec0a1 | |||
| 9a623a8b59 | |||
| cf07c51eb1 | |||
| 9993e427e0 | |||
| c2d29317d5 | |||
| 07cfec619c | |||
| ed0d83dafe | |||
| 5b3e65db2f | |||
| b176ee64b2 | |||
| bd9ac6db0b | |||
| c1c088813a | |||
| 57bfb42f00 | |||
| c776e06183 | |||
| cb4f814320 | |||
| 0a9ac0a787 |
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/
|
/Entidades/obj/
|
||||||
/Aspnet/obj/
|
/Aspnet/obj/
|
||||||
/Modelo/bin/
|
/Modelo/bin/
|
||||||
|
Aspnet/bin/
|
||||||
|
node_modules/
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
|
||||||
<PackageReference Include="minio" Version="6.0.3" />
|
<PackageReference Include="minio" Version="6.0.3" />
|
||||||
|
<PackageReference Include="QuestPDF" Version="2024.12.2" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.2" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.2" />
|
||||||
</ItemGroup>
|
</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;
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Aspnet/Builder/DtoBuilder/OpcionVentaDtoBuilder.cs
Normal file
25
Aspnet/Builder/DtoBuilder/OpcionVentaDtoBuilder.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Entidades.Dto;
|
||||||
|
|
||||||
|
namespace AlquilaFacil.Builder;
|
||||||
|
public class OpcionVentaDtoBuilder: Builder<OpcionVentaDto>{
|
||||||
|
public OpcionVentaDtoBuilder SetId(long id) {
|
||||||
|
data.Id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public OpcionVentaDtoBuilder SetMonto(decimal monto) {
|
||||||
|
data.Monto = monto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public OpcionVentaDtoBuilder SetDivisa(string divisa) {
|
||||||
|
data.Divisa = divisa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public OpcionVentaDtoBuilder SetEnOrden(bool v) {
|
||||||
|
data.EnOrden = v;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public OpcionVentaDtoBuilder SetFueEjercido(int idestado) {
|
||||||
|
data.FueEjercido = idestado==1?false:true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
41
Aspnet/Builder/DtoBuilder/VentasDtoBuilder.cs
Normal file
41
Aspnet/Builder/DtoBuilder/VentasDtoBuilder.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using Entidades.Dto;
|
||||||
|
|
||||||
|
namespace AlquilaFacil.Builder;
|
||||||
|
public class VentasDtoBuilder: Builder<VentasDto> {
|
||||||
|
public VentasDtoBuilder SetId(long id) {
|
||||||
|
data.Id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetMonto(decimal monto) {
|
||||||
|
data.Monto = monto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetDivisa(string divisa) {
|
||||||
|
data.Divisa = divisa;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetUbicacion(string ubicacion) {
|
||||||
|
data.Ubicacion = ubicacion;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetNombreVendedor(string nombre) {
|
||||||
|
data.NombreVendedor = nombre;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetIdVendedor(long idVendedor) {
|
||||||
|
data.IdVendedor = idVendedor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetNombreComprador(string nombre) {
|
||||||
|
data.NombreComprador = nombre;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetIdComprador(long Id) {
|
||||||
|
data.IdComprador = Id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
public VentasDtoBuilder SetEstado(string estado) {
|
||||||
|
data.Estado = estado;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
55
Aspnet/Builder/PrecontratoBuilder.cs
Normal file
55
Aspnet/Builder/PrecontratoBuilder.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrecontratoBuilder SetOpcionVenta(bool tieneOpcionVenta){
|
||||||
|
data.Tieneopcionventa = tieneOpcionVenta == false?0Lu:1Lu;
|
||||||
|
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; } = "";
|
||||||
|
}
|
||||||
@@ -3,11 +3,222 @@ using Modelo;
|
|||||||
using Entidades.Admin;
|
using Entidades.Admin;
|
||||||
using Entidades.Dto;
|
using Entidades.Dto;
|
||||||
using Entidades;
|
using Entidades;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using AlquilaFacil.StrategyBusquedaAdmin;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using AlquilaFacil.Builder;
|
||||||
|
using Minio.DataModel.Args;
|
||||||
|
using Minio;
|
||||||
|
using AlquilaFacil.Config;
|
||||||
|
using System.Text.Json;
|
||||||
namespace AlquilaFacil.Controllers;
|
namespace AlquilaFacil.Controllers;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class AdminController: ControllerBase
|
public class AdminController: ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[HttpGet("api/contratos/controlPagos")]
|
||||||
|
public IActionResult obtenerContratosInpagos([FromHeader(Name = "Auth")] string Auth) {
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 14);
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
var contratos = RepositorioContratos.Singleton.ObtenerContratosInpagos();
|
||||||
|
|
||||||
|
List<ContratoDto> dtos = new();
|
||||||
|
foreach (var i in contratos) {
|
||||||
|
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/contratos/controlPagos/propiedad")]
|
||||||
|
public IActionResult obtenerPropiedad([FromHeader(Name = "Auth")] string Auth, int id = 0) {
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Admin");
|
||||||
|
if (validacion1 == false) 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"});
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly IMinioClient mc;
|
||||||
|
public AdminController(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("0.0.0.0:9000")
|
||||||
|
.WithSSL(false)
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet("/api/admin/contrato/verDocumento")]
|
||||||
|
public IActionResult verDocumento([FromHeader(Name = "Auth")] string Auth, int idcontrato = 0){
|
||||||
|
if (String.IsNullOrWhiteSpace(Auth)) return BadRequest("");
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Admin");
|
||||||
|
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);
|
||||||
|
|
||||||
|
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/admin/contrato/canons")]
|
||||||
|
public IActionResult ObtenerCanones([FromHeader(Name="Auth")]string Auth, int id = 0){
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Admin");
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
var cont = RepositorioContratos.Singleton.ObtenerContratoPorId(id);
|
||||||
|
if (cont == null) return BadRequest(new { message = "No existe el contrato"});
|
||||||
|
|
||||||
|
var list = RepositorioCanons.Singleton.ObtenerCanonsPorContrato(id);
|
||||||
|
if (list == null) return BadRequest(new { message = "No hay contrato por esa id"});
|
||||||
|
|
||||||
|
DateTime date = DateTime.Now;
|
||||||
|
bool ret =list.Any(x=>x.Pagado ==0 && date > x.Fecha);
|
||||||
|
if (ret != true) return BadRequest(new { message = "Este contrato no tiene canones vencidos"});
|
||||||
|
|
||||||
|
string divisa ="";
|
||||||
|
if (cont.Iddivisa == 0) divisa = "AR$"; else if (cont.Iddivisa == 1) divisa = "US$";
|
||||||
|
|
||||||
|
List<CanonDto> d = new();
|
||||||
|
|
||||||
|
foreach (var i in list) {
|
||||||
|
if (i.Fecha > date) continue;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/admin/contrato/marcarPago")]
|
||||||
|
public IActionResult realizarPago([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto) {
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Admin");
|
||||||
|
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"});
|
||||||
|
|
||||||
|
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 = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ret = RepositorioCanons.Singleton.SetRecibo(c, re, cli.Dni, "Admin Marca Recibo Como Pago");
|
||||||
|
return ret ?
|
||||||
|
Ok(new { message = "Se guardo correctamente"}):BadRequest(new { message = "No se pudo guardar"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/admin/notificarInquilino")]
|
||||||
|
public IActionResult NotificarInquilino([FromHeader(Name ="Auth")]string Auth, NotificarAdmin data){
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Admin");
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null)return Unauthorized();
|
||||||
|
|
||||||
|
if (data.Mensaje == "") return BadRequest(new {message = "El campo Mensaje esta vacio"});
|
||||||
|
if (data.Idcontrato <= 0) return BadRequest(new {message = "La id de contrato no puede ser 0 o menor"});
|
||||||
|
if (data.Idcanon <= 0) return BadRequest(new {message = "La id de contrato no puede ser 0 o menor"});
|
||||||
|
|
||||||
|
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(data.Idcontrato);
|
||||||
|
if (cont == null || cont.DniinquilinoNavigation == null || cont.DnipropietarioNavigation == null || cont.IdpropiedadNavigation == null) return BadRequest(new { message = "no hay un contrato por esa id"});
|
||||||
|
|
||||||
|
Canon? can = RepositorioCanons.Singleton.ObtenerCanonPorId(data.Idcanon);
|
||||||
|
if (can == null)return BadRequest(new { message = "No existe un canon 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, cli.Dni);
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "se envio el aviso" }):BadRequest(new { message = "Fallo al intentar enviar el aviso" });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("api/admin/clientes")]
|
[HttpGet("api/admin/clientes")]
|
||||||
public IActionResult GetClientes([FromHeader(Name ="Auth")]string Auth){
|
public IActionResult GetClientes([FromHeader(Name ="Auth")]string Auth){
|
||||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
@@ -18,6 +229,46 @@ public class AdminController: ControllerBase
|
|||||||
return Ok(list);
|
return Ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("api/admin/cliente")]
|
||||||
|
public IActionResult ObtenerCliente([FromHeader(Name ="Auth")]string Auth, long dni = 0){
|
||||||
|
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 haber un dni 0 o menor"});
|
||||||
|
|
||||||
|
Cliente? cambio = RepositorioUsuarios.Singleton.ObtenerClientePorDni(dni);
|
||||||
|
if (cambio == null) BadRequest(new { message = "no hay un cliente por ese dni"});
|
||||||
|
|
||||||
|
UpdateUsuarioAdmin a = new UpdateUsuarioAdmin{
|
||||||
|
Apellido = cambio.Apellido,
|
||||||
|
Celular = cambio.Celular,
|
||||||
|
Domicilio = cambio.Domicilio,
|
||||||
|
Nombre = cambio.Nombre,
|
||||||
|
};
|
||||||
|
|
||||||
|
return Ok(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPatch("api/admin/cliente")]
|
||||||
|
public IActionResult PatchCliente([FromHeader(Name ="Auth")]string Auth, [FromBody]UpdateUsuarioAdmin dto, [FromQuery]long dni=0){
|
||||||
|
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 haber un dni 0 o menor"});
|
||||||
|
|
||||||
|
var validacion2 = checkdto(dto);
|
||||||
|
if (validacion2 != "") return BadRequest(new { message = validacion2});
|
||||||
|
|
||||||
|
Cliente?cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
bool ret = RepositorioUsuarios.Singleton.PatchUsuario(dto, dni, cli.Dni);
|
||||||
|
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "Se actualizaron los datos"}):
|
||||||
|
BadRequest(new { message = "Fallo al guardar los datos"});
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("api/admin/clientes/grupo")]
|
[HttpGet("api/admin/clientes/grupo")]
|
||||||
public IActionResult GetGruposByCliente([FromHeader(Name ="Auth")]string Auth, [FromQuery]long Dni){
|
public IActionResult GetGruposByCliente([FromHeader(Name ="Auth")]string Auth, [FromQuery]long Dni){
|
||||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
@@ -35,12 +286,15 @@ public class AdminController: ControllerBase
|
|||||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||||
|
|
||||||
if (data.email == "" || data.grupo == "") return BadRequest(new { message = "Faltan datos en la request" });
|
if (data.email == "" || data.grupo == "") return BadRequest(new { message = "Faltan datos en la request" });
|
||||||
|
|
||||||
var ret = RepositorioUsuarios.Singleton.CheckGrupo(data.email, data.grupo);
|
var ret = RepositorioUsuarios.Singleton.CheckGrupo(data.email, data.grupo);
|
||||||
if (ret) return BadRequest(new { message = $"El usuario ya pertenece al grupo {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);
|
var ret2 = RepositorioUsuarios.Singleton.AñadirClienteAGrupo(data.email, data.grupo, cli.Dni);
|
||||||
|
|
||||||
return ret2 ? Ok(new {message = "Se Añadio al Grupo"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
return ret2 ? Ok(new {message = "Se Añadio al Grupo"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
||||||
}
|
}
|
||||||
@@ -51,6 +305,10 @@ public class AdminController: ControllerBase
|
|||||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return BadRequest(new { message = "No hay un cliente por ese token"});
|
||||||
|
|
||||||
|
|
||||||
if (data.email == "" || data.grupo == "") return BadRequest(new { message = "Faltan datos en la request" });
|
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
|
//una ward para que no me bloquee a mi mismo de tener acceso a admin
|
||||||
@@ -71,7 +329,7 @@ public class AdminController: ControllerBase
|
|||||||
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"});
|
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);
|
var ret2 = RepositorioUsuarios.Singleton.EliminarClienteAGrupo(data.email, data.grupo, cli.Dni);
|
||||||
return ret2 ? Ok(new {message = $"Se elimino del Grupo: {data.grupo}"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
return ret2 ? Ok(new {message = $"Se elimino del Grupo: {data.grupo}"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,8 +372,11 @@ public class AdminController: ControllerBase
|
|||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
if (id <= 0) return BadRequest(new { message = "Falto indicar id Propiedad"});
|
if (id <= 0) return BadRequest(new { message = "Falto indicar id Propiedad"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id);
|
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id, cli.Dni);
|
||||||
return ret ?
|
return ret ?
|
||||||
Ok(new {message = "Se cambio el estado de la propiedad"}): BadRequest(new { message = "No se pudo dar de baja"});
|
Ok(new {message = "Se cambio el estado de la propiedad"}): BadRequest(new { message = "No se pudo dar de baja"});
|
||||||
}
|
}
|
||||||
@@ -146,4 +407,13 @@ public class AdminController: ControllerBase
|
|||||||
int ret = RepositorioPropiedades.Singleton.CuantasPaginasBusqueda(cantidadHabitaciones, servicios, tipoPropiedad, 0);
|
int ret = RepositorioPropiedades.Singleton.CuantasPaginasBusqueda(cantidadHabitaciones, servicios, tipoPropiedad, 0);
|
||||||
return Ok(new { message = ret});
|
return Ok(new { message = ret});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string checkdto(UpdateUsuarioAdmin d){
|
||||||
|
string ret ="";
|
||||||
|
if (d.Nombre=="") ret+="Campo Nombre vacio\n";
|
||||||
|
if (d.Apellido=="") ret+="Campo Apellido vacio\n";
|
||||||
|
if (d.Celular=="") ret+="Campo Celular vacio\n";
|
||||||
|
if (d.Domicilio=="")ret+="Campo Domicilio vacio\n";
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
using Entidades.Dto;
|
using Entidades.Dto;
|
||||||
using Modelo;
|
using Modelo;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Entidades.Admin;
|
||||||
|
using AlquilaFacil.StrategyBusqueda;
|
||||||
|
|
||||||
namespace AlquilaFacil.Controllers;
|
namespace AlquilaFacil.Controllers;
|
||||||
|
|
||||||
@@ -13,27 +15,14 @@ public class BusquedaController: ControllerBase {
|
|||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
IQueryable<PropiedadesDto>? props = null;
|
IQueryable<PropiedadesDto>? props = null;
|
||||||
if (servicios == ""){
|
|
||||||
//no hay parametros de busqueda
|
var clave = $"{(cantidadHabitaciones != 0 ? "1" : "0")}{(tipoPropiedad != 0 ? "1" : "0")}{(!string.IsNullOrEmpty(servicios) ? "1" : "0")}";
|
||||||
if (cantidadHabitaciones == 0 && tipoPropiedad == 0 ) props = RepositorioPropiedades.Singleton.ListarPropiedades();
|
|
||||||
//Solo Habitaciones
|
|
||||||
if (cantidadHabitaciones != 0 && tipoPropiedad == 0) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones(cantidadHabitaciones);
|
|
||||||
//Solo TipoPropiedad
|
|
||||||
if (cantidadHabitaciones == 0 && tipoPropiedad != 0) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo(tipoPropiedad);
|
|
||||||
//Habitaciones y TipoPropiedad
|
|
||||||
if (cantidadHabitaciones != 0 && tipoPropiedad != 0) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo(cantidadHabitaciones, tipoPropiedad);
|
|
||||||
} else {
|
|
||||||
//Solo se filtra por servicios
|
|
||||||
if (cantidadHabitaciones == 0 && tipoPropiedad == 0 ) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorServicios(servicios);
|
|
||||||
//Servicios y habitaciones
|
|
||||||
if (cantidadHabitaciones != 0 && tipoPropiedad == 0) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Servicios(cantidadHabitaciones, servicios);
|
|
||||||
//Tipo y Servicios
|
|
||||||
if (cantidadHabitaciones == 0 && tipoPropiedad != 0) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo_Servicios(tipoPropiedad, servicios);
|
|
||||||
// Todos los parametros
|
|
||||||
if (cantidadHabitaciones != 0 && tipoPropiedad != 0) props = RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo_Servicios(cantidadHabitaciones, tipoPropiedad, servicios);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ok(props);
|
var gen = BusquedaContext.Singleton;
|
||||||
|
var estrategia = gen.ObtenerEstrategia(clave);
|
||||||
|
props = estrategia.Filtrar(servicios, cantidadHabitaciones, tipoPropiedad);
|
||||||
|
|
||||||
|
return Ok(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("api/busqueda/cantPag")]
|
[HttpGet("api/busqueda/cantPag")]
|
||||||
|
|||||||
@@ -1,14 +1,838 @@
|
|||||||
|
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 Microsoft.AspNetCore.Mvc;
|
||||||
|
using Minio;
|
||||||
|
using Minio.DataModel;
|
||||||
|
using Minio.DataModel.Args;
|
||||||
|
using Minio.Exceptions;
|
||||||
using Modelo;
|
using Modelo;
|
||||||
|
|
||||||
namespace AlquilaFacil.Controllers;
|
namespace AlquilaFacil.Controllers;
|
||||||
|
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class ContratoController: ControllerBase {
|
public class ContratoController: ControllerBase {
|
||||||
|
|
||||||
[HttpGet("api/contratos")]
|
[HttpPost("api/contrato/GenerarRecibo")]
|
||||||
public IActionResult ObtenerContratosPorUsuario([FromHeader(Name="Auth")]string Auth) {
|
public ActionResult GenerarRecibo([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto, bool html= true) {
|
||||||
return Ok();
|
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 = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ret = RepositorioCanons.Singleton.SetRecibo(c, re, cli.Dni);
|
||||||
|
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 = DateTime.Now,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ret = RepositorioCanons.Singleton.SetRecibo(c, re, cli.Dni);
|
||||||
|
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, cli.Dni);
|
||||||
|
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)
|
||||||
|
.SetOpcionVenta(dto.TieneOpcionVenta)
|
||||||
|
.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();
|
||||||
|
|
||||||
|
bool ret;
|
||||||
|
if (dto.TieneOpcionVenta==false){
|
||||||
|
ret = RepositorioContratos.Singleton.CargaPrecontrato(cli.Dni, precontrato, notificacion);
|
||||||
|
} else {
|
||||||
|
Venta v = new Venta{
|
||||||
|
Idestado = 1,
|
||||||
|
Iddivisa = dto.iddivisa,
|
||||||
|
Monto = dto.MontoOpcion,
|
||||||
|
};
|
||||||
|
ret = RepositorioContratos.Singleton.CargaPrecontratoOpcionVenta(precontrato, notificacion, v, cli.Dni);
|
||||||
|
}
|
||||||
|
|
||||||
|
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, cli.Dni);
|
||||||
|
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? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli==null) return Unauthorized();
|
||||||
|
|
||||||
|
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, cli.Dni);
|
||||||
|
if (ret) {
|
||||||
|
prop.Idestado = 1;
|
||||||
|
ret = RepositorioPropiedades.Singleton.PatchPropiedad(prop, pro.Dni);
|
||||||
|
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("0.0.0.0: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, cli.Dni);
|
||||||
|
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, cli.Dni);
|
||||||
|
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, cli.Dni);
|
||||||
|
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";
|
||||||
|
if (dto.TieneOpcionVenta == true && dto.MontoOpcion <=0) ret +="No puede tener un monto de venta negativo o 0";
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
101
Aspnet/Controllers/DefectoController.cs
Normal file
101
Aspnet/Controllers/DefectoController.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
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();
|
||||||
|
|
||||||
|
Cliente? cli =RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) 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, cli.Dni);
|
||||||
|
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();
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli==null) return Unauthorized();
|
||||||
|
|
||||||
|
if (iddefecto<=0) return BadRequest(new { message = "No hay canones con id 0 o menor"});
|
||||||
|
bool ret = RepositorioDefectos.Singleton.MarcarPago(iddefecto, cli.Dni);
|
||||||
|
|
||||||
|
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" });
|
||||||
|
}
|
||||||
|
}
|
||||||
73
Aspnet/Controllers/EstadisticaController.cs
Normal file
73
Aspnet/Controllers/EstadisticaController.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
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/contrato/stats")]
|
||||||
|
public IActionResult ObtenerMesesPagos([FromHeader(Name ="Auth")]string Auth, long idcontrato=0){
|
||||||
|
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"});
|
||||||
|
|
||||||
|
var ret = RepositorioEstadisticas.Singleton.ObtenerDatosPagosContrato(idcontrato);
|
||||||
|
return Ok(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
[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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#if DEBUG
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Modelo;
|
|
||||||
namespace AlquilaFacil.Controllers;
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
public class GruposController: ControllerBase {
|
|
||||||
[HttpPost("api/admin/grupos")]
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public record AdminGrupo(string descripcion);
|
|
||||||
#endif
|
|
||||||
@@ -30,6 +30,8 @@ public class InquilinoController: ControllerBase
|
|||||||
var ret3 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 4);
|
var ret3 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 4);
|
||||||
if (ret3 == false) return BadRequest(new {message = "Falló el permiso"});
|
if (ret3 == false) return BadRequest(new {message = "Falló el permiso"});
|
||||||
|
|
||||||
|
Cliente? rep = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (rep == null) return Unauthorized();
|
||||||
|
|
||||||
var ret = verificarCrearUsuario(cid);
|
var ret = verificarCrearUsuario(cid);
|
||||||
if (ret != "") return BadRequest(new {message = ret});
|
if (ret != "") return BadRequest(new {message = ret});
|
||||||
@@ -41,10 +43,11 @@ public class InquilinoController: ControllerBase
|
|||||||
Apellido = cid.apellido,
|
Apellido = cid.apellido,
|
||||||
Celular = cid.celular,
|
Celular = cid.celular,
|
||||||
Email = cid.email,
|
Email = cid.email,
|
||||||
Contraseña = Encoding.UTF8.GetBytes(HacerHash(cid.contraseña))
|
Contraseña = Encoding.UTF8.GetBytes(HacerHash(cid.contraseña)),
|
||||||
|
Habilitado = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ret2 = RepositorioUsuarios.Singleton.AltaInquilino(cli);
|
bool ret2 = RepositorioUsuarios.Singleton.AltaInquilino(cli, rep.Dni);
|
||||||
return (ret2) ? Ok(new {message = "Se dio de alta la cuenta"}) : BadRequest(new {message = "Fallo Dar de Alta El inquilino"});
|
return (ret2) ? Ok(new {message = "Se dio de alta la cuenta"}) : BadRequest(new {message = "Fallo Dar de Alta El inquilino"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
62
Aspnet/Controllers/LogsController.cs
Normal file
62
Aspnet/Controllers/LogsController.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using Entidades.Dto;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Modelo;
|
||||||
|
|
||||||
|
namespace AlquilaFacil.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
public class LogsController: ControllerBase {
|
||||||
|
|
||||||
|
[HttpGet("/api/Logs")]
|
||||||
|
public IActionResult ObtenerLogs([FromHeader(Name = "Auth")] string Auth, int pag=1) {
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
if (pag<=0) return BadRequest(new { message = "no puede haber una pagina 0 o menor"});
|
||||||
|
|
||||||
|
pag-=1;
|
||||||
|
|
||||||
|
var l = RepositorioLogs.Singleton.ObtenerLogsPaginado(pag);
|
||||||
|
List<LogDto> ll = new();
|
||||||
|
foreach (var i in l) {
|
||||||
|
ll.Add(new LogDto{
|
||||||
|
Fecha = i.Fecha,
|
||||||
|
Accion = i.Accion,
|
||||||
|
Dniusuario = i.Dniusuario,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Ok(ll);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/Logs/detalle")]
|
||||||
|
public IActionResult ObtenerLogs([FromHeader(Name = "Auth")] string Auth, [FromQuery]DateTime fecha, [FromQuery]long idusuario) {
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
if (idusuario<=0) return BadRequest(new { message = "no puede haber un id 0 o menor"});
|
||||||
|
|
||||||
|
var l = RepositorioLogs.Singleton.ObtenerDetallesLogs(fecha, idusuario);
|
||||||
|
List<LogDetalleDto> ll = new();
|
||||||
|
foreach (var i in l) {
|
||||||
|
ll.Add(new LogDetalleDto{
|
||||||
|
Fecha = i.Fecha,
|
||||||
|
Dniusuario = i.Dniusuario,
|
||||||
|
NombreTabla = i.NombreTabla,
|
||||||
|
Columna = i.Columna,
|
||||||
|
ValorAnterior = i.ValorAnterior,
|
||||||
|
ValorNuevo = i.ValorNuevo,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Ok(ll);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/Logs/cantPag")]
|
||||||
|
public IActionResult cantidadPaginas([FromHeader(Name = "Auth")] string Auth){
|
||||||
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Informes");
|
||||||
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
int c = RepositorioLogs.Singleton.ObtenerCantidadPaginas();
|
||||||
|
return Ok(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
158
Aspnet/Controllers/NotificacionesController.cs
Normal file
158
Aspnet/Controllers/NotificacionesController.cs
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
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" });
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/notificar/ConsultaCompra")]
|
||||||
|
public IActionResult EnviarConsultaCompra([FromHeader(Name ="Auth")]string Auth, AltaNotificacionDto dto) {
|
||||||
|
if (String.IsNullOrWhiteSpace(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.Accion == "") return BadRequest(new{message = "El campo Accion esta vacio"});
|
||||||
|
if (dto.Mensaje == "") return BadRequest(new {message = "El campo Mensaje esta vacio"});
|
||||||
|
|
||||||
|
Cliente?cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(dto.Propiedad);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No hay una propiedad con id 0 o menor"});
|
||||||
|
|
||||||
|
var n = new NotificacioneBuilder()
|
||||||
|
.SetAccion("Consulta Compra")
|
||||||
|
.SetMensaje(dto.Mensaje)
|
||||||
|
.SetLeido(false)
|
||||||
|
.SetDnicliente(prop.Dnipropietario??0)
|
||||||
|
.SetDniremitente(cli.Dni)
|
||||||
|
.SetIdpropiedad(prop.Id)
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.Build();
|
||||||
|
var ret2= RepositorioNotificaciones.Singleton.AltaNotificacion(n, cli.Dni);
|
||||||
|
return ret2?
|
||||||
|
Ok(new { message = "se envio el aviso" }):BadRequest(new { message = "Fallo al intentar enviar el aviso" });
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#if DEBUG
|
|
||||||
using System.Text.Json;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Modelo;
|
|
||||||
namespace AlquilaFacil.Controllers;
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
public class PermisosController: ControllerBase {
|
|
||||||
[HttpPost("api/admin/permisos")]
|
|
||||||
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);
|
|
||||||
return (ret) ? Ok(ret) : BadRequest();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public record AdminPermiso(string descripcion);
|
|
||||||
#endif
|
|
||||||
@@ -8,20 +8,93 @@ namespace AlquilaFacil.Controllers;
|
|||||||
[ApiController]
|
[ApiController]
|
||||||
public class PropiedadesController: ControllerBase {
|
public class PropiedadesController: ControllerBase {
|
||||||
[HttpGet("api/propiedades")]
|
[HttpGet("api/propiedades")]
|
||||||
public IActionResult ListarPropiedades([FromHeader(Name = "Auth")] string Auth) {
|
public IActionResult ListarPropiedades([FromHeader(Name = "Auth")] string Auth, int pag = 0) {
|
||||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 12);
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||||
if (validacion1 == false) validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
if (validacion1 == false) validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
var ret = RepositorioPropiedades.Singleton.ListarPropiedades();
|
IQueryable<PropiedadesDto> ret;
|
||||||
|
|
||||||
|
if (pag == 0){
|
||||||
|
ret = RepositorioPropiedades.Singleton.ListarPropiedades();
|
||||||
|
} else{
|
||||||
|
ret = RepositorioPropiedades.Singleton.ListarPropiedadesPorPagina(pag);
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(ret);
|
return Ok(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/propiedades/Venta")]
|
||||||
|
public IActionResult ObtenerPropiedadesParaVenta([FromHeader(Name = "Auth")] string Auth, int pag = 0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pag<=0) return BadRequest(new { message = "no existe una pagina 0"});
|
||||||
|
|
||||||
|
pag-=1;
|
||||||
|
|
||||||
|
var props = RepositorioPropiedades.Singleton.ObtenerPropiedadesEnVenta(pag);
|
||||||
|
if (props == null) return BadRequest(new { message = "no tengo claro que fallo creo que no existen propiedades en venta"});
|
||||||
|
|
||||||
|
List<PropiedadesVentaDto> l = new();
|
||||||
|
|
||||||
|
foreach (var i in props) {
|
||||||
|
var p = new PropiedadesVentaDto{
|
||||||
|
Id = i.Id,
|
||||||
|
Ubicacion = i.Ubicacion,
|
||||||
|
Canthabitaciones = i.Canthabitaciones,
|
||||||
|
Divisa = i.IddivisaNavigation.Signo,
|
||||||
|
Letra = i.Letra??"",
|
||||||
|
Monto = i.Monto,
|
||||||
|
Piso = i.Piso??0,
|
||||||
|
Servicios =string.Join(", ", i.IdServicios.Select(s => s.Descripcion)),
|
||||||
|
Tipo = i.IdtipropiedadNavigation.Descripcion,
|
||||||
|
};
|
||||||
|
l.Add(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cantpag = RepositorioPropiedades.Singleton.ObtenerPaginasDePropiedadesEnVenta();
|
||||||
|
|
||||||
|
return Ok(new { propiedades = l, cantpaginas = cantpag});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("api/propiedades/Venta/Propietario")]
|
||||||
|
public IActionResult ObtenerPropiedadesVentaDePropietario( [FromHeader(Name = "Auth")] string Auth){
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
var props = RepositorioPropiedades.Singleton.ObtenerPropiedadesAVentaPorDni(cli.Dni);
|
||||||
|
List<PropiedadesDto> ll = new();
|
||||||
|
|
||||||
|
foreach (var i in props) {
|
||||||
|
var a = new PropiedadesDto {
|
||||||
|
id = i.Id,
|
||||||
|
Ubicacion = i.Ubicacion,
|
||||||
|
canthabitaciones = i.Canthabitaciones,
|
||||||
|
Iddivisa = i.Iddivisa,
|
||||||
|
letra = i.Letra??"",
|
||||||
|
Monto = (int)i.Monto, //mmmm
|
||||||
|
piso = i.Piso??0,
|
||||||
|
Servicios = string.Join(", ", i.IdServicios.Select(x => x.Descripcion)),
|
||||||
|
Tipo = i.IdtipropiedadNavigation.Descripcion,
|
||||||
|
};
|
||||||
|
ll.Add(a);
|
||||||
|
}
|
||||||
|
return Ok(ll);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet("api/propiedad")]
|
[HttpGet("api/propiedad")]
|
||||||
public IActionResult ObtenerPropiedadPorId(int Id, [FromHeader(Name = "Auth")] string Auth) {
|
public IActionResult ObtenerPropiedadPorId(int Id, [FromHeader(Name = "Auth")] string Auth) {
|
||||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 12);
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
if (Id < 0) return BadRequest(new {message ="la id de propiedad no puede ser negativa"});
|
if (Id < 0) return BadRequest(new {message ="la id de propiedad no puede ser negativa"});
|
||||||
@@ -31,6 +104,25 @@ public class PropiedadesController: ControllerBase {
|
|||||||
return Ok(ret);
|
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")]
|
[HttpGet("api/propiedades/Propietario")]
|
||||||
public IActionResult ObtenerPropiedadesPorPropietario (
|
public IActionResult ObtenerPropiedadesPorPropietario (
|
||||||
[FromHeader(Name = "Email")] string email,
|
[FromHeader(Name = "Email")] string email,
|
||||||
@@ -83,6 +175,7 @@ public class PropiedadesController: ControllerBase {
|
|||||||
Letra = propiedad.Letra ?? null,
|
Letra = propiedad.Letra ?? null,
|
||||||
Piso = propiedad.Piso ?? null,
|
Piso = propiedad.Piso ?? null,
|
||||||
Monto = propiedad.Monto,
|
Monto = propiedad.Monto,
|
||||||
|
Iddivisa = propiedad.Iddivisa,
|
||||||
};
|
};
|
||||||
|
|
||||||
var ret = RepositorioPropiedades.Singleton.AñadirPropiedad(Prop);
|
var ret = RepositorioPropiedades.Singleton.AñadirPropiedad(Prop);
|
||||||
@@ -115,10 +208,11 @@ public class PropiedadesController: ControllerBase {
|
|||||||
Letra = propiedad.Letra ?? null,
|
Letra = propiedad.Letra ?? null,
|
||||||
Piso = propiedad.Piso ?? null,
|
Piso = propiedad.Piso ?? null,
|
||||||
IdServicios = servs,
|
IdServicios = servs,
|
||||||
Monto = propiedad.Monto
|
Monto = propiedad.Monto,
|
||||||
|
Iddivisa = propiedad.Iddivisa,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ret = RepositorioPropiedades.Singleton.PatchPropiedad(Prop);
|
bool ret = RepositorioPropiedades.Singleton.PatchPropiedad(Prop, cli.Dni);
|
||||||
return (ret)?
|
return (ret)?
|
||||||
Ok(new {message = "Fue modificado Correctamente"}):
|
Ok(new {message = "Fue modificado Correctamente"}):
|
||||||
BadRequest(new {message = "Fallo al modificar la base de datos"});
|
BadRequest(new {message = "Fallo al modificar la base de datos"});
|
||||||
@@ -175,11 +269,13 @@ public class PropiedadesController: ControllerBase {
|
|||||||
if (servicio.idServicios.Count() < 1) return BadRequest(new {message ="Falta añadir servicios"});
|
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"});
|
if (servicio.idServicios.Any(x => x<= 0)) return BadRequest(new {message ="No tienen haber ids negativas o cero de servicio"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
|
||||||
var serv = RepositorioServicios.Singleton.ObtenerServiciosPorPropiedad(servicio.propiedadid);
|
var serv = RepositorioServicios.Singleton.ObtenerServiciosPorPropiedad(servicio.propiedadid);
|
||||||
|
|
||||||
var repetidos = serv.Intersect(servicio.idServicios);
|
var repetidos = serv.Intersect(servicio.idServicios);
|
||||||
|
|
||||||
bool ret = RepositorioPropiedades.Singleton.BajaServiciosAPropiedad(servicio.propiedadid, servicio.idServicios);
|
bool ret = RepositorioPropiedades.Singleton.BajaServiciosAPropiedad(servicio.propiedadid, servicio.idServicios, cli.Dni);
|
||||||
|
|
||||||
return ret ?
|
return ret ?
|
||||||
Ok(new {message ="Se Eliminaron los servicios seleccionados de la propiedad"}) : BadRequest(new {message ="Fallo al eliminarse los servicios de la propiedad"});
|
Ok(new {message ="Se Eliminaron los servicios seleccionados de la propiedad"}) : BadRequest(new {message ="Fallo al eliminarse los servicios de la propiedad"});
|
||||||
@@ -199,6 +295,9 @@ public class PropiedadesController: ControllerBase {
|
|||||||
if (String.IsNullOrEmpty(prop.Ubicacion)) ret += "Tiene que definir la ubicacion de la propiedad\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.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;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -218,6 +317,9 @@ public class PropiedadesController: ControllerBase {
|
|||||||
if (String.IsNullOrEmpty(prop.Ubicacion)) ret += "Tiene que definir la ubicacion de la propiedad\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.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;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public class PropietarioController: ControllerBase {
|
|||||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 5);
|
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 5);
|
||||||
if (validacion1 == false) return Unauthorized();
|
if (validacion1 == false) return Unauthorized();
|
||||||
|
|
||||||
|
Cliente? rep = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (rep == null) return Unauthorized();
|
||||||
|
|
||||||
string validacion2 = verificarCrearUsuario(Propietario);
|
string validacion2 = verificarCrearUsuario(Propietario);
|
||||||
if (validacion2 != "") return BadRequest(validacion2);
|
if (validacion2 != "") return BadRequest(validacion2);
|
||||||
|
|
||||||
@@ -38,10 +41,11 @@ public class PropietarioController: ControllerBase {
|
|||||||
Apellido = Propietario.apellido,
|
Apellido = Propietario.apellido,
|
||||||
Celular = Propietario.celular,
|
Celular = Propietario.celular,
|
||||||
Email = Propietario.email,
|
Email = Propietario.email,
|
||||||
Contraseña = Encoding.UTF8.GetBytes(HacerHash(Propietario.contraseña))
|
Contraseña = Encoding.UTF8.GetBytes(HacerHash(Propietario.contraseña)),
|
||||||
|
Habilitado = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ret = RepositorioUsuarios.Singleton.AltaPropietario(cli);
|
bool ret = RepositorioUsuarios.Singleton.AltaPropietario(cli, rep.Dni);
|
||||||
return ret ?
|
return ret ?
|
||||||
Ok(new {message = "Se añadio el propietario exitosamente"}) : BadRequest();
|
Ok(new {message = "Se añadio el propietario exitosamente"}) : BadRequest();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
using Entidades;
|
|
||||||
using Entidades.Dto;
|
|
||||||
using Microsoft.AspNetCore.Http.HttpResults;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Modelo;
|
|
||||||
|
|
||||||
namespace AlquilaFacil.Controllers;
|
|
||||||
|
|
||||||
[ApiController]
|
|
||||||
public class ServiciosController: ControllerBase {
|
|
||||||
|
|
||||||
}
|
|
||||||
460
Aspnet/Controllers/VentaController.cs
Normal file
460
Aspnet/Controllers/VentaController.cs
Normal file
@@ -0,0 +1,460 @@
|
|||||||
|
using System.Configuration;
|
||||||
|
using System.Formats.Asn1;
|
||||||
|
using System.Text.Json;
|
||||||
|
using AlquilaFacil.Builder;
|
||||||
|
using AlquilaFacil.Config;
|
||||||
|
using Entidades;
|
||||||
|
using Entidades.Dto;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Minio;
|
||||||
|
using Minio.DataModel.Args;
|
||||||
|
using Modelo;
|
||||||
|
|
||||||
|
namespace AlquilaFacil.Controllers;
|
||||||
|
[ApiController]
|
||||||
|
public class VentaController:ControllerBase {
|
||||||
|
|
||||||
|
[HttpPost("api/venta/AceptarConsultaVenta")]
|
||||||
|
public IActionResult AceptarConsultaVenta([FromHeader(Name="Auth")]string Auth, NotificacionMarcarLeidoDto dto) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
if (dto.Email == "") return BadRequest(new { message = "Falta dato Email"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) Unauthorized();
|
||||||
|
if (cli.Email != dto.Email) return BadRequest(new {message = "El token de autorizacion no corresponde a tu usuario"});
|
||||||
|
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.Fecha);
|
||||||
|
|
||||||
|
Notificacione? n = RepositorioNotificaciones.Singleton.ObtenerNotificacionPorKeys(cli.Dni, dto.Fecha);
|
||||||
|
if (n == null) return BadRequest(new { message = "No se encuentra la notificacion"});
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(n.Idpropiedad);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No se encuentra una propiedad por ese id"});
|
||||||
|
Venta? v = new Venta{
|
||||||
|
Fechainicio = DateTime.Now,
|
||||||
|
IdVendedor = prop.Dnipropietario,
|
||||||
|
IdComprador = n.Dniremitente,
|
||||||
|
Monto = prop.Monto,
|
||||||
|
Idpropiedad = prop.Id,
|
||||||
|
Iddivisa = prop.Iddivisa,
|
||||||
|
Idestado = 2,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
bool ret = RepositorioVentas.Singleton.IniciarVenta(v, cli.Dni);
|
||||||
|
if (ret){
|
||||||
|
var noti = new NotificacioneBuilder()
|
||||||
|
.SetAccion("Notificacion")
|
||||||
|
.SetMensaje("Debe Realizar el pago para que se registre el traspaso de la propiedad")
|
||||||
|
.SetLeido(false)
|
||||||
|
.SetDnicliente(n.Dniremitente)
|
||||||
|
.SetDniremitente(n.Dnicliente)
|
||||||
|
.SetIdpropiedad(n.Idpropiedad)
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.Build();
|
||||||
|
ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||||
|
}
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "Se inicio la venta"}):BadRequest(new { message ="fallo al iniciar la venta"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("api/venta/CancelarConsultaVenta")]
|
||||||
|
public IActionResult CancelarConsultaVenta([FromHeader(Name="Auth")]string Auth, NotificacionMarcarLeidoDto dto) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dto.Email == "") return BadRequest(new { message = "Falta dato Email"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) Unauthorized();
|
||||||
|
if (cli.Email != dto.Email) return BadRequest(new {message = "El token de autorizacion no corresponde a tu usuario"});
|
||||||
|
|
||||||
|
RepositorioNotificaciones.Singleton.MarcarComoLeido(cli.Dni, dto.Fecha);
|
||||||
|
Notificacione? n = RepositorioNotificaciones.Singleton.ObtenerNotificacionPorKeys(cli.Dni, dto.Fecha);
|
||||||
|
var noti = new NotificacioneBuilder()
|
||||||
|
.SetAccion("Notificacion")
|
||||||
|
.SetMensaje("El propietario no quiere vender")
|
||||||
|
.SetLeido(false)
|
||||||
|
.SetDnicliente(n.Dniremitente)
|
||||||
|
.SetDniremitente(n.Dnicliente)
|
||||||
|
.SetIdpropiedad(n.Idpropiedad)
|
||||||
|
.SetFecha(DateTime.Now)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var ret = RepositorioNotificaciones.Singleton.AltaNotificacion(noti);
|
||||||
|
return ret ?
|
||||||
|
Ok(new{message = "Se Envio una notificacion"}):BadRequest(new{message = "Fallo al Descartar Consulta"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/propiedad/EstaALaVenta")]
|
||||||
|
public IActionResult EstaALaVenta([FromHeader(Name="Auth")]string Auth, int idprop=0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
if (idprop<=0) return BadRequest(new { message = "No hay propiedades con id 0 o menor"});
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(idprop);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No hay propiedades por ese id"});
|
||||||
|
return Ok(new { EstaAVenta = prop.Idestado ==4?true:false});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("/api/propiedad/setPropiedadAVenta")]
|
||||||
|
public IActionResult setPropiedadAVenta([FromHeader(Name="Auth")]string Auth, SetVentaDto dto) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dto.iddivisa != 0 && dto.iddivisa!=1) return BadRequest(new { message = "no hay una divisa por esa id"});
|
||||||
|
if (dto.idpropiedad<=0) return BadRequest(new { message = "No hay propiedades con id 0 o menor"});
|
||||||
|
if (dto.monto<1) return BadRequest(new { message = "No se pueden hacer ventas por montos menores a 1"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(dto.idpropiedad);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No hay propiedades por ese id"});
|
||||||
|
|
||||||
|
if (cli.Dni != prop.Dnipropietario) return Unauthorized();
|
||||||
|
|
||||||
|
var ret = RepositorioVentas.Singleton.SetVenta(prop.Id, dto.monto, dto.iddivisa, cli.Dni);
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "Se puso la propiedad de venta"}) : BadRequest(new { message = "No se pudo poner a la Venta"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("/api/propiedad/unsetPropiedadAVenta")]
|
||||||
|
public IActionResult unsetPropiedadAVenta([FromHeader(Name="Auth")]string Auth, SetVentaDto dto) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dto.iddivisa != 0 && dto.iddivisa!=1) return BadRequest(new { message = "no hay una divisa por esa id"});
|
||||||
|
if (dto.idpropiedad<=0) return BadRequest(new { message = "No hay propiedades con id 0 o menor"});
|
||||||
|
if (dto.monto<1) return BadRequest(new { message = "No se pueden hacer ventas por montos menores a 1"});
|
||||||
|
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
Propiedade? prop = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(dto.idpropiedad);
|
||||||
|
if (prop == null) return BadRequest(new { message = "No hay propiedades por ese id"});
|
||||||
|
|
||||||
|
if (cli.Dni != prop.Dnipropietario) return Unauthorized();
|
||||||
|
|
||||||
|
bool ret = RepositorioVentas.Singleton.UnSetVenta(prop.Id, dto.monto, dto.iddivisa, cli.Dni);
|
||||||
|
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "Se Bajo la propiedad de venta"}) : BadRequest(new { message = "No se pudo Bajar de venta"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("/api/ventas/ejercerOpcionVenta")]
|
||||||
|
public IActionResult EjercerOpcionVenta([FromHeader(Name="Auth")]string Auth, [FromQuery]long idcontrato=0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
if (idcontrato <= 0) return BadRequest(new { message = "No pueden hacer cotratos con id 0 o menor"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
Contrato? cont = RepositorioVentas.Singleton.ObtenerVentaPorContrato(idcontrato);
|
||||||
|
if (cont == null || cont.IdventaNavigation == null) return BadRequest(new { message = "no hay un contrato por esa id"});
|
||||||
|
if (cont.Tieneopcionventa == 0) return BadRequest(new { message = "No tiene opcion de venta"});
|
||||||
|
if (puedeEjercer(cont) == false) return BadRequest(new { message = "No cumple con los requisitos para ejercer la opcion de compra"});
|
||||||
|
|
||||||
|
Venta venta = cont.IdventaNavigation;
|
||||||
|
venta.IdVendedor = cont.Dnipropietario;
|
||||||
|
venta.IdComprador = cont.Dniinquilino;
|
||||||
|
venta.Idpropiedad = cont.Idpropiedad;
|
||||||
|
venta.Fechainicio = DateTime.Now;
|
||||||
|
|
||||||
|
bool ret = RepositorioVentas.Singleton.PatchVenta(venta, cli.Dni);
|
||||||
|
|
||||||
|
return ret?
|
||||||
|
Ok(new { message = "Se ejercio la opcion de venta"}):
|
||||||
|
BadRequest(new { message = "No se pude ejercer la opcion de venta"});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("/api/ventas/subirReciboPago")]
|
||||||
|
public async Task<IActionResult> SubirRecibo([FromHeader(Name="Auth")]string Auth, IFormFile file, long idventa ) {
|
||||||
|
if (String.IsNullOrWhiteSpace(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 (idventa <=0) return BadRequest(new { message = "Las id 0 o menor no son validas" });
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
Venta? venta = RepositorioVentas.Singleton.ObtenerVentaPorId(idventa);
|
||||||
|
if (venta == null) return BadRequest(new { message = "no hay una venta por esa id"});
|
||||||
|
|
||||||
|
if (cli.Dni !=venta.IdComprador && cli.Dni != venta.IdVendedor) return Unauthorized();
|
||||||
|
|
||||||
|
if (file == null) return BadRequest(new { message = "Debe subir un archivo." });
|
||||||
|
if (file.ContentType != "application/pdf") return BadRequest(new { message = "El archivo debe ser un documento PDF." });
|
||||||
|
if (!Path.GetExtension(file.FileName).Equals(".pdf", StringComparison.OrdinalIgnoreCase)) return BadRequest(new { message = "El archivo debe tener la extensión .pdf." });
|
||||||
|
|
||||||
|
string nuevoNombreArchivo = $"id:{venta.Id}-comprador:{venta.IdComprador}-vendedor:{venta.IdVendedor}-idprop:{venta.Idpropiedad}.pdf";
|
||||||
|
bool ret = await subirContrato(file, nuevoNombreArchivo);
|
||||||
|
if(ret == false) return BadRequest(new {message = "No se pudo subir el archivo"});
|
||||||
|
|
||||||
|
ret = RepositorioVentas.Singleton.SetUrlRecibo(venta.Id, nuevoNombreArchivo, cli.Dni);
|
||||||
|
if (ret == false) return BadRequest(new { message = "no se pudo guardar el nombre del archivo subido"});
|
||||||
|
|
||||||
|
return Ok(new { message = "Se Subio el Recibo"});
|
||||||
|
|
||||||
|
}
|
||||||
|
private readonly IMinioClient mc;
|
||||||
|
public VentaController(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("0.0.0.0:9000")
|
||||||
|
.WithSSL(false)
|
||||||
|
.Build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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/ventas/verRecibo")]
|
||||||
|
public IActionResult verRecibo([FromHeader(Name="Auth")]string Auth, long idventa=0){
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false){
|
||||||
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idventa <= 0) return BadRequest(new { message = "No existen ventas validas para la id 0"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
Venta? venta = RepositorioVentas.Singleton.ObtenerVentaPorId(idventa);
|
||||||
|
if (venta == null) return BadRequest(new { message = "no hay una venta con esa id"});
|
||||||
|
if (cli.Dni != venta.IdComprador && cli.Dni != venta.IdVendedor) return Unauthorized();
|
||||||
|
|
||||||
|
try{
|
||||||
|
var memstream = new MemoryStream();
|
||||||
|
|
||||||
|
var goa = new GetObjectArgs()
|
||||||
|
.WithBucket("alquilafacil")
|
||||||
|
.WithObject(venta.UrlRecibo)
|
||||||
|
.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", venta.UrlRecibo);
|
||||||
|
|
||||||
|
} 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/ventas/propietarioverifica")]
|
||||||
|
public IActionResult PropietarioVerifica([FromHeader(Name="Auth")]string Auth, long idventa=0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false){
|
||||||
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idventa <= 0) return BadRequest(new { message = "No existen ventas validas para la id 0"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
var ventas = RepositorioVentas.Singleton.ObtenerVentaPorId(idventa);
|
||||||
|
if (ventas == null) return BadRequest(new { message ="No hay una venta con ese id"});
|
||||||
|
if (ventas.IdVendedor != cli.Dni) return Unauthorized();
|
||||||
|
|
||||||
|
bool ret = RepositorioVentas.Singleton.EfectuarVenta(idventa);
|
||||||
|
return ret ? Ok(new { message = "Se traspaso la propiedad"}): BadRequest(new { message = ""});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpGet("/api/venta")]
|
||||||
|
public IActionResult ObtenerVenta([FromHeader(Name="Auth")]string Auth, long idventa=0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false){
|
||||||
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idventa <= 0) return BadRequest(new { message = "No existen ventas validas para la id 0"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
var ventas = RepositorioVentas.Singleton.ObtenerVentaPorId(idventa);
|
||||||
|
if (ventas == null) return BadRequest(new { message ="No hay una venta con ese id"});
|
||||||
|
if (ventas.IdVendedor !=cli.Dni && ventas.IdComprador != cli.Dni) return Unauthorized();
|
||||||
|
|
||||||
|
var v = new VentasDtoBuilder()
|
||||||
|
.SetId(ventas.Id)
|
||||||
|
.SetMonto(ventas.Monto)
|
||||||
|
.SetDivisa(ventas.IddivisaNavigation.Signo)
|
||||||
|
.SetUbicacion(ventas.IdpropiedadNavigation.Ubicacion)
|
||||||
|
.SetNombreVendedor($"{ventas.IdVendedorNavigation.Nombre} {ventas.IdVendedorNavigation.Apellido}")
|
||||||
|
.SetIdVendedor(ventas.IdVendedor??0)
|
||||||
|
.SetNombreComprador($"{ventas.IdCompradorNavigation.Nombre} {ventas.IdCompradorNavigation.Apellido}")
|
||||||
|
.SetIdComprador(ventas.IdComprador??0)
|
||||||
|
.SetEstado(ventas.IdestadoNavigation.Descripcion??"")
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
return Ok(new { data = v, iscomprador = (ventas.IdComprador==cli.Dni)?true:false,
|
||||||
|
necesitaRecibo = ventas.UrlRecibo==null?true:false});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/ventas")]
|
||||||
|
public IActionResult ObtenerVentas([FromHeader(Name="Auth")]string Auth) {
|
||||||
|
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 ventas = RepositorioVentas.Singleton.ObtenerVentasPorDni(cli.Dni);
|
||||||
|
if (ventas == null) return BadRequest(new { message ="no estas involucrado en ninguna venta o compra"});
|
||||||
|
|
||||||
|
List<VentasDto> lista = new();
|
||||||
|
foreach (var i in ventas) {
|
||||||
|
var v = new VentasDtoBuilder()
|
||||||
|
.SetId(i.Id)
|
||||||
|
.SetMonto(i.Monto)
|
||||||
|
.SetDivisa(i.IddivisaNavigation.Signo)
|
||||||
|
.SetUbicacion(i.IdpropiedadNavigation.Ubicacion)
|
||||||
|
.SetNombreVendedor($"{i.IdVendedorNavigation.Nombre} {i.IdVendedorNavigation.Apellido}")
|
||||||
|
.SetIdVendedor(i.IdVendedor??0)
|
||||||
|
.SetNombreComprador($"{i.IdCompradorNavigation.Nombre} {i.IdCompradorNavigation.Apellido}")
|
||||||
|
.SetIdComprador(i.IdComprador??0)
|
||||||
|
.SetEstado(i.IdestadoNavigation.Descripcion??"")
|
||||||
|
.Build();
|
||||||
|
lista.Add(v);
|
||||||
|
}
|
||||||
|
return Ok(lista);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/opcionventa")]
|
||||||
|
public IActionResult ObtenerDto([FromHeader(Name="Auth")]string Auth, long idcontrato=0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false){
|
||||||
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idcontrato == 0) return BadRequest(new { message = "No existen contatos validos para la id 0"});
|
||||||
|
|
||||||
|
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||||
|
if (cli == null) return Unauthorized();
|
||||||
|
|
||||||
|
Contrato? cont = RepositorioVentas.Singleton.ObtenerVentaPorContrato(idcontrato);
|
||||||
|
if (cont == null) return BadRequest(new { message = "No hay un contrato por esa id"});
|
||||||
|
|
||||||
|
var dto = new OpcionVentaDtoBuilder()
|
||||||
|
.SetId(cont.Idventa??0)
|
||||||
|
.SetMonto(cont.IdventaNavigation.Monto)
|
||||||
|
.SetDivisa(cont.IdventaNavigation.IddivisaNavigation.Signo)
|
||||||
|
.SetEnOrden(puedeEjercer(cont))
|
||||||
|
.SetFueEjercido(cont.IdventaNavigation.Idestado??0)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
return Ok(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool puedeEjercer(Contrato c) {
|
||||||
|
bool ret = c.Idcanons.All(x => x.Pagado == 1);
|
||||||
|
|
||||||
|
if (ret) {
|
||||||
|
var canonConFechaMasTardia = c.Idcanons.OrderByDescending(x => x.Fecha).FirstOrDefault();
|
||||||
|
|
||||||
|
if (canonConFechaMasTardia != null && canonConFechaMasTardia.Fecha.Year >= DateTime.Now.Year
|
||||||
|
&& canonConFechaMasTardia.Fecha.Month >= DateTime.Now.Month) {
|
||||||
|
ret = true;
|
||||||
|
}else{
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/contrato/tieneopcionventa")]
|
||||||
|
public IActionResult TieneOpcionVenta([FromHeader(Name="Auth")]string Auth, long idcontrato=0) {
|
||||||
|
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||||
|
if (validacion1 == false){
|
||||||
|
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||||
|
if (validacion1 == false) {
|
||||||
|
return Unauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idcontrato == 0) return BadRequest(new { message = "No existen contatos validos para la id 0"});
|
||||||
|
|
||||||
|
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 un contrato por esa id"});
|
||||||
|
if (cont.Dniinquilino !=cli.Dni && cont.Dnipropietario != cli.Dni) return Unauthorized();
|
||||||
|
|
||||||
|
return Ok( new { message = cont.Tieneopcionventa});
|
||||||
|
}
|
||||||
|
}
|
||||||
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);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
|
|
||||||
|
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(File.ReadAllText("./settings.json"))?? null;
|
||||||
|
if (mcon == null) return;
|
||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
builder.Services.AddSwaggerGen();
|
builder.Services.AddSwaggerGen();
|
||||||
|
builder.Services.AddMinio(options => options
|
||||||
|
.WithCredentials(mcon.usr, mcon.scrt)
|
||||||
|
.WithEndpoint("127.0.0.0:9000")
|
||||||
|
.WithSSL(false)
|
||||||
|
.Build());
|
||||||
|
|
||||||
|
builder.Services.Configure<FormOptions>(options =>
|
||||||
|
{
|
||||||
|
options.MultipartBodyLengthLimit = 50 * 1024 * 1024; // 50 MB
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddCors(options =>
|
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":"nwFNMLJcn5m0owbzeXMs",
|
||||||
|
"scrt":"Mf9HxTir5mIGwWSBtQXd6DRK2k00V0EyXk7QTu70"
|
||||||
|
}
|
||||||
4
Aspnet/settings.json
Normal file
4
Aspnet/settings.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"usr":"nwFNMLJcn5m0owbzeXMs",
|
||||||
|
"scrt":"Mf9HxTir5mIGwWSBtQXd6DRK2k00V0EyXk7QTu70"
|
||||||
|
}
|
||||||
6
Entidades/Admin/NotificarAdmin.cs
Normal file
6
Entidades/Admin/NotificarAdmin.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Entidades.Admin;
|
||||||
|
public class NotificarAdmin {
|
||||||
|
public string Mensaje { get; set; }="";
|
||||||
|
public long Idcontrato{get;set;}
|
||||||
|
public long Idcanon {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/UpdateUsuarioAdmin.cs
Normal file
8
Entidades/Admin/UpdateUsuarioAdmin.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Entidades.Admin;
|
||||||
|
public class UpdateUsuarioAdmin {
|
||||||
|
public string Nombre { get; set; } = null!;
|
||||||
|
public string Apellido { get; set; } = null!;
|
||||||
|
public string Domicilio { get; set; } = null!;
|
||||||
|
public string Celular { get; set; } = null!;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
public virtual DbSet<Defecto> Defectos { get; set; }
|
public virtual DbSet<Defecto> Defectos { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Divisa> Divisas { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<EstadoPropiedad> EstadoPropiedads { get; set; }
|
public virtual DbSet<EstadoPropiedad> EstadoPropiedads { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Estadodefecto> Estadodefectos { get; set; }
|
public virtual DbSet<Estadodefecto> Estadodefectos { get; set; }
|
||||||
@@ -33,6 +35,12 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
public virtual DbSet<Grupo> Grupos { get; set; }
|
public virtual DbSet<Grupo> Grupos { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Log> Logs { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<LogDetalle> LogDetalles { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Notificacione> Notificaciones { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Permiso> Permisos { get; set; }
|
public virtual DbSet<Permiso> Permisos { get; set; }
|
||||||
|
|
||||||
public virtual DbSet<Propiedade> Propiedades { get; set; }
|
public virtual DbSet<Propiedade> Propiedades { get; set; }
|
||||||
@@ -47,7 +55,7 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||||
=> optionsBuilder.UseMySQL("Server=fedesrv.ddns.net;Port=30006;Database=AlquilaFacil;Uid=AlquilaFacil;Pwd=.n@9c2ve*0,b1ETv].Kipa/~pR~V;Connection Timeout=5;SslMode=none");
|
=> optionsBuilder.UseMySQL("Server=127.0.0.1;Port=3306;Database=AlquilaFacil;Uid=AlquilaFacil;Pwd=.n@9c2ve*0,b1ETv].Kipa/~pR~V;Connection Timeout=5;SslMode=none");
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@@ -151,9 +159,14 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
entity.HasIndex(e => e.Idventa, "FK_CON_VEN");
|
entity.HasIndex(e => e.Idventa, "FK_CON_VEN");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Iddivisa, "FK_contdiv");
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("id");
|
.HasColumnName("id");
|
||||||
|
entity.Property(e => e.Cancelado)
|
||||||
|
.HasColumnType("bit(1)")
|
||||||
|
.HasColumnName("cancelado");
|
||||||
entity.Property(e => e.Cantgarantemin)
|
entity.Property(e => e.Cantgarantemin)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("cantgarantemin");
|
.HasColumnName("cantgarantemin");
|
||||||
@@ -169,6 +182,9 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
entity.Property(e => e.Habilitado)
|
entity.Property(e => e.Habilitado)
|
||||||
.HasColumnType("bit(1)")
|
.HasColumnType("bit(1)")
|
||||||
.HasColumnName("habilitado");
|
.HasColumnName("habilitado");
|
||||||
|
entity.Property(e => e.Iddivisa)
|
||||||
|
.HasColumnType("int(11)")
|
||||||
|
.HasColumnName("iddivisa");
|
||||||
entity.Property(e => e.Idpropiedad)
|
entity.Property(e => e.Idpropiedad)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("idpropiedad");
|
.HasColumnName("idpropiedad");
|
||||||
@@ -178,6 +194,7 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
entity.Property(e => e.Indiceactualizacion)
|
entity.Property(e => e.Indiceactualizacion)
|
||||||
.HasPrecision(8)
|
.HasPrecision(8)
|
||||||
.HasColumnName("indiceactualizacion");
|
.HasColumnName("indiceactualizacion");
|
||||||
|
entity.Property(e => e.MesesDurationContrato).HasColumnType("int(11)");
|
||||||
entity.Property(e => e.MesesHastaAumento).HasColumnType("int(11)");
|
entity.Property(e => e.MesesHastaAumento).HasColumnType("int(11)");
|
||||||
entity.Property(e => e.Monto)
|
entity.Property(e => e.Monto)
|
||||||
.HasPrecision(12)
|
.HasPrecision(12)
|
||||||
@@ -185,6 +202,9 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
entity.Property(e => e.Tieneopcionventa)
|
entity.Property(e => e.Tieneopcionventa)
|
||||||
.HasColumnType("bit(1)")
|
.HasColumnType("bit(1)")
|
||||||
.HasColumnName("tieneopcionventa");
|
.HasColumnName("tieneopcionventa");
|
||||||
|
entity.Property(e => e.UrlContrato)
|
||||||
|
.HasMaxLength(100)
|
||||||
|
.HasColumnName("urlContrato");
|
||||||
|
|
||||||
entity.HasOne(d => d.DniinquilinoNavigation).WithMany(p => p.ContratoDniinquilinoNavigations)
|
entity.HasOne(d => d.DniinquilinoNavigation).WithMany(p => p.ContratoDniinquilinoNavigations)
|
||||||
.HasForeignKey(d => d.Dniinquilino)
|
.HasForeignKey(d => d.Dniinquilino)
|
||||||
@@ -196,6 +216,11 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_CON_PROPI");
|
.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)
|
entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Contratos)
|
||||||
.HasForeignKey(d => d.Idpropiedad)
|
.HasForeignKey(d => d.Idpropiedad)
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
@@ -241,6 +266,8 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
entity.HasIndex(e => e.Idestado, "FK_DEF_EST");
|
entity.HasIndex(e => e.Idestado, "FK_DEF_EST");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Iddivisa, "FK_defdiv");
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("id");
|
.HasColumnName("id");
|
||||||
@@ -248,11 +275,14 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.HasPrecision(12)
|
.HasPrecision(12)
|
||||||
.HasColumnName("costo");
|
.HasColumnName("costo");
|
||||||
entity.Property(e => e.Descripcion)
|
entity.Property(e => e.Descripcion)
|
||||||
.HasMaxLength(40)
|
.HasMaxLength(100)
|
||||||
.HasColumnName("descripcion");
|
.HasColumnName("descripcion");
|
||||||
entity.Property(e => e.Idcontrato)
|
entity.Property(e => e.Idcontrato)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("idcontrato");
|
.HasColumnName("idcontrato");
|
||||||
|
entity.Property(e => e.Iddivisa)
|
||||||
|
.HasColumnType("int(11)")
|
||||||
|
.HasColumnName("iddivisa");
|
||||||
entity.Property(e => e.Idestado)
|
entity.Property(e => e.Idestado)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("idestado");
|
.HasColumnName("idestado");
|
||||||
@@ -265,12 +295,29 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_DEF_CON");
|
.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)
|
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Defectos)
|
||||||
.HasForeignKey(d => d.Idestado)
|
.HasForeignKey(d => d.Idestado)
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_DEF_EST");
|
.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 =>
|
modelBuilder.Entity<EstadoPropiedad>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||||
@@ -281,7 +328,7 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("id");
|
.HasColumnName("id");
|
||||||
entity.Property(e => e.Descripcion)
|
entity.Property(e => e.Descripcion)
|
||||||
.HasMaxLength(11)
|
.HasMaxLength(30)
|
||||||
.HasColumnName("descripcion");
|
.HasColumnName("descripcion");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -313,17 +360,20 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
modelBuilder.Entity<Garante>(entity =>
|
modelBuilder.Entity<Garante>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Dni).HasName("PRIMARY");
|
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||||
|
|
||||||
entity.Property(e => e.Dni)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("dni");
|
.HasColumnName("id");
|
||||||
entity.Property(e => e.Apellido)
|
entity.Property(e => e.Apellido)
|
||||||
.HasMaxLength(20)
|
.HasMaxLength(20)
|
||||||
.HasColumnName("apellido");
|
.HasColumnName("apellido");
|
||||||
entity.Property(e => e.Celular)
|
entity.Property(e => e.Celular)
|
||||||
.HasMaxLength(40)
|
.HasMaxLength(40)
|
||||||
.HasColumnName("celular");
|
.HasColumnName("celular");
|
||||||
|
entity.Property(e => e.Dni)
|
||||||
|
.HasColumnType("bigint(20)")
|
||||||
|
.HasColumnName("dni");
|
||||||
entity.Property(e => e.Domicilio)
|
entity.Property(e => e.Domicilio)
|
||||||
.HasMaxLength(40)
|
.HasMaxLength(40)
|
||||||
.HasColumnName("domicilio");
|
.HasColumnName("domicilio");
|
||||||
@@ -334,7 +384,7 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.HasMaxLength(20)
|
.HasMaxLength(20)
|
||||||
.HasColumnName("nombre");
|
.HasColumnName("nombre");
|
||||||
|
|
||||||
entity.HasMany(d => d.Idcontratos).WithMany(p => p.Dnigarantes)
|
entity.HasMany(d => d.Idcontratos).WithMany(p => p.Idgarantes)
|
||||||
.UsingEntity<Dictionary<string, object>>(
|
.UsingEntity<Dictionary<string, object>>(
|
||||||
"ContratoGarante",
|
"ContratoGarante",
|
||||||
r => r.HasOne<Contrato>().WithMany()
|
r => r.HasOne<Contrato>().WithMany()
|
||||||
@@ -342,17 +392,17 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_CONGAR_CON"),
|
.HasConstraintName("FK_CONGAR_CON"),
|
||||||
l => l.HasOne<Garante>().WithMany()
|
l => l.HasOne<Garante>().WithMany()
|
||||||
.HasForeignKey("Dnigarante")
|
.HasForeignKey("Idgarante")
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_CONGAR_GAR"),
|
.HasConstraintName("FK_CONGAR_GAR"),
|
||||||
j =>
|
j =>
|
||||||
{
|
{
|
||||||
j.HasKey("Dnigarante", "Idcontrato").HasName("PRIMARY");
|
j.HasKey("Idgarante", "Idcontrato").HasName("PRIMARY");
|
||||||
j.ToTable("contrato_garantes");
|
j.ToTable("contrato_garantes");
|
||||||
j.HasIndex(new[] { "Idcontrato" }, "FK_CONGAR_CON");
|
j.HasIndex(new[] { "Idcontrato" }, "FK_CONGAR_CON");
|
||||||
j.IndexerProperty<long>("Dnigarante")
|
j.IndexerProperty<int>("Idgarante")
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("dnigarante");
|
.HasColumnName("idgarante");
|
||||||
j.IndexerProperty<long>("Idcontrato")
|
j.IndexerProperty<long>("Idcontrato")
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("idcontrato");
|
.HasColumnName("idcontrato");
|
||||||
@@ -371,6 +421,106 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.HasColumnName("nombre");
|
.HasColumnName("nombre");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Log>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => new { e.Fecha, e.Dniusuario }).HasName("PRIMARY");
|
||||||
|
|
||||||
|
entity.ToTable("Log");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Dniusuario, "fk_log_clientes");
|
||||||
|
|
||||||
|
entity.Property(e => e.Fecha)
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("fecha");
|
||||||
|
entity.Property(e => e.Dniusuario)
|
||||||
|
.HasColumnType("bigint(20)")
|
||||||
|
.HasColumnName("dniusuario");
|
||||||
|
entity.Property(e => e.Accion)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.HasColumnName("accion");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.DniusuarioNavigation).WithMany(p => p.Logs)
|
||||||
|
.HasForeignKey(d => d.Dniusuario)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.HasConstraintName("fk_log_clientes");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<LogDetalle>(entity =>
|
||||||
|
{
|
||||||
|
entity.HasKey(e => new { e.Id, e.Fecha, e.Dniusuario, e.NombreTabla, e.Columna }).HasName("PRIMARY");
|
||||||
|
|
||||||
|
entity.ToTable("LogDetalle");
|
||||||
|
|
||||||
|
entity.HasIndex(e => new { e.Fecha, e.Dniusuario }, "LogDetalle_ibfk_1");
|
||||||
|
|
||||||
|
entity.Property(e => e.Id)
|
||||||
|
.HasColumnType("int(11)")
|
||||||
|
.HasColumnName("id");
|
||||||
|
entity.Property(e => e.Fecha)
|
||||||
|
.HasColumnType("datetime")
|
||||||
|
.HasColumnName("fecha");
|
||||||
|
entity.Property(e => e.Dniusuario)
|
||||||
|
.HasColumnType("bigint(20)")
|
||||||
|
.HasColumnName("dniusuario");
|
||||||
|
entity.Property(e => e.NombreTabla).HasColumnName("nombreTabla");
|
||||||
|
entity.Property(e => e.Columna).HasColumnName("columna");
|
||||||
|
entity.Property(e => e.ValorAnterior)
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("valorAnterior");
|
||||||
|
entity.Property(e => e.ValorNuevo)
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("valorNuevo");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Log).WithMany(p => p.LogDetalles)
|
||||||
|
.HasForeignKey(d => new { d.Fecha, d.Dniusuario })
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.HasConstraintName("LogDetalle_ibfk_1");
|
||||||
|
});
|
||||||
|
|
||||||
|
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 =>
|
modelBuilder.Entity<Permiso>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||||
@@ -417,6 +567,8 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
entity.HasIndex(e => e.Idtipropiedad, "FK_PROP_TIPO");
|
entity.HasIndex(e => e.Idtipropiedad, "FK_PROP_TIPO");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Iddivisa, "FK_propdiv");
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("id");
|
.HasColumnName("id");
|
||||||
@@ -426,6 +578,9 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
entity.Property(e => e.Dnipropietario)
|
entity.Property(e => e.Dnipropietario)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("dnipropietario");
|
.HasColumnName("dnipropietario");
|
||||||
|
entity.Property(e => e.Iddivisa)
|
||||||
|
.HasColumnType("int(11)")
|
||||||
|
.HasColumnName("iddivisa");
|
||||||
entity.Property(e => e.Idestado)
|
entity.Property(e => e.Idestado)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("idestado");
|
.HasColumnName("idestado");
|
||||||
@@ -451,6 +606,11 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_PROP_PROPI");
|
.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)
|
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Propiedades)
|
||||||
.HasForeignKey(d => d.Idestado)
|
.HasForeignKey(d => d.Idestado)
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
@@ -541,6 +701,8 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
|
|
||||||
entity.HasIndex(e => e.Idpropiedad, "FK_VEN_PROP");
|
entity.HasIndex(e => e.Idpropiedad, "FK_VEN_PROP");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Iddivisa, "FK_ventdiv");
|
||||||
|
|
||||||
entity.Property(e => e.Id)
|
entity.Property(e => e.Id)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("id");
|
.HasColumnName("id");
|
||||||
@@ -556,6 +718,9 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
entity.Property(e => e.IdVendedor)
|
entity.Property(e => e.IdVendedor)
|
||||||
.HasColumnType("bigint(20)")
|
.HasColumnType("bigint(20)")
|
||||||
.HasColumnName("idVendedor");
|
.HasColumnName("idVendedor");
|
||||||
|
entity.Property(e => e.Iddivisa)
|
||||||
|
.HasColumnType("int(11)")
|
||||||
|
.HasColumnName("iddivisa");
|
||||||
entity.Property(e => e.Idestado)
|
entity.Property(e => e.Idestado)
|
||||||
.HasColumnType("int(11)")
|
.HasColumnType("int(11)")
|
||||||
.HasColumnName("idestado");
|
.HasColumnName("idestado");
|
||||||
@@ -565,6 +730,9 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
entity.Property(e => e.Monto)
|
entity.Property(e => e.Monto)
|
||||||
.HasPrecision(12)
|
.HasPrecision(12)
|
||||||
.HasColumnName("monto");
|
.HasColumnName("monto");
|
||||||
|
entity.Property(e => e.UrlRecibo)
|
||||||
|
.HasColumnType("text")
|
||||||
|
.HasColumnName("urlRecibo");
|
||||||
|
|
||||||
entity.HasOne(d => d.IdCompradorNavigation).WithMany(p => p.VentaIdCompradorNavigations)
|
entity.HasOne(d => d.IdCompradorNavigation).WithMany(p => p.VentaIdCompradorNavigations)
|
||||||
.HasForeignKey(d => d.IdComprador)
|
.HasForeignKey(d => d.IdComprador)
|
||||||
@@ -576,6 +744,11 @@ public partial class AlquilaFacilContext : DbContext
|
|||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
.HasConstraintName("FK_VEN_PROL");
|
.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)
|
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Venta)
|
||||||
.HasForeignKey(d => d.Idestado)
|
.HasForeignKey(d => d.Idestado)
|
||||||
.OnDelete(DeleteBehavior.Restrict)
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
|||||||
@@ -27,6 +27,12 @@ public partial class Cliente
|
|||||||
|
|
||||||
public virtual ICollection<Contrato> ContratoDnipropietarioNavigations { get; set; } = new List<Contrato>();
|
public virtual ICollection<Contrato> ContratoDnipropietarioNavigations { get; set; } = new List<Contrato>();
|
||||||
|
|
||||||
|
public virtual ICollection<Log> Logs { get; set; } = new List<Log>();
|
||||||
|
|
||||||
|
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<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
||||||
|
|
||||||
public virtual ICollection<Venta> VentaIdCompradorNavigations { get; set; } = new List<Venta>();
|
public virtual ICollection<Venta> VentaIdCompradorNavigations { get; set; } = new List<Venta>();
|
||||||
|
|||||||
@@ -29,17 +29,27 @@ public partial class Contrato
|
|||||||
|
|
||||||
public int MesesHastaAumento { 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 ICollection<Defecto> Defectos { get; set; } = new List<Defecto>();
|
||||||
|
|
||||||
public virtual Cliente? DniinquilinoNavigation { get; set; }
|
public virtual Cliente? DniinquilinoNavigation { get; set; }
|
||||||
|
|
||||||
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||||
|
|
||||||
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
||||||
|
|
||||||
public virtual Venta? IdventaNavigation { 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<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 ulong Pagainquilino { get; set; }
|
||||||
|
|
||||||
|
public int Iddivisa { get; set; }
|
||||||
|
|
||||||
public virtual Contrato? IdcontratoNavigation { get; set; }
|
public virtual Contrato? IdcontratoNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||||
|
|
||||||
public virtual Estadodefecto? IdestadoNavigation { get; set; }
|
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>();
|
||||||
|
}
|
||||||
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;}
|
||||||
|
}
|
||||||
@@ -7,4 +7,5 @@ public class AltaPropiedadDto {
|
|||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
public int Idtipropiedad { get; set; }
|
public int Idtipropiedad { get; set; }
|
||||||
public int Monto { 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; }
|
||||||
|
}
|
||||||
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; }
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace Entidades.Dto;
|
|
||||||
//WIP
|
|
||||||
public class CrearContratoDto {
|
|
||||||
public int Meses {get; set;}
|
|
||||||
public int Idpropiedad {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);
|
||||||
8
Entidades/Dto/OpcionVentaDto.cs
Normal file
8
Entidades/Dto/OpcionVentaDto.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public class OpcionVentaDto{
|
||||||
|
public long Id { get; set;}
|
||||||
|
public decimal Monto { get; set;}
|
||||||
|
public string Divisa { get; set;} ="";
|
||||||
|
public bool EnOrden { get; set;}
|
||||||
|
public bool FueEjercido { get; set; }
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
namespace Entidades.Dto;
|
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);
|
public record PatchPropiedadDto(int id, string Ubicacion, int Canthabitaciones, int? Piso, string? Letra, string Email, int tipo, List<string> Servicios, int Monto, int Iddivisa);
|
||||||
|
|||||||
13
Entidades/Dto/PrecontratoDto.cs
Normal file
13
Entidades/Dto/PrecontratoDto.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
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; }
|
||||||
|
public Decimal MontoOpcion {get; set; }
|
||||||
|
public int iddivisa { get; set; }
|
||||||
|
}
|
||||||
@@ -8,4 +8,5 @@ public class PropiedadesDto {
|
|||||||
public string Tipo { get; set; } = "";
|
public string Tipo { get; set; } = "";
|
||||||
public string? Servicios {get;set;} = "";
|
public string? Servicios {get;set;} = "";
|
||||||
public int Monto { get; set; }
|
public int Monto { get; set; }
|
||||||
|
public int Iddivisa { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
12
Entidades/Dto/PropiedadesVentaDto.cs
Normal file
12
Entidades/Dto/PropiedadesVentaDto.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public class PropiedadesVentaDto {
|
||||||
|
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 decimal Monto { get; set; }
|
||||||
|
public string Divisa { 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; }
|
||||||
|
}
|
||||||
6
Entidades/Dto/SetVentaDto.cs
Normal file
6
Entidades/Dto/SetVentaDto.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public class SetVentaDto {
|
||||||
|
public int idpropiedad {get; set;}
|
||||||
|
public decimal monto {get; set;}
|
||||||
|
public int iddivisa {get; set;}
|
||||||
|
}
|
||||||
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; }
|
||||||
|
}
|
||||||
12
Entidades/Dto/VentasDto.cs
Normal file
12
Entidades/Dto/VentasDto.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public class VentasDto {
|
||||||
|
public long Id { get; set; }
|
||||||
|
public decimal Monto { get; set; }
|
||||||
|
public string Divisa { get; set; }="";
|
||||||
|
public string Ubicacion { get; set; }="";
|
||||||
|
public string NombreVendedor { get; set; }="";
|
||||||
|
public long IdVendedor { get; set; }
|
||||||
|
public string NombreComprador { get; set; }="";
|
||||||
|
public long IdComprador { get; set; }
|
||||||
|
public string Estado { get; set; }="";
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ namespace Entidades;
|
|||||||
|
|
||||||
public partial class Garante
|
public partial class Garante
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
public long Dni { get; set; }
|
public long Dni { get; set; }
|
||||||
|
|
||||||
public string Nombre { get; set; } = null!;
|
public string Nombre { get; set; } = null!;
|
||||||
|
|||||||
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 "";
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
}
|
||||||
17
Entidades/Log.cs
Normal file
17
Entidades/Log.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Entidades;
|
||||||
|
|
||||||
|
public partial class Log
|
||||||
|
{
|
||||||
|
public DateTime Fecha { get; set; }
|
||||||
|
|
||||||
|
public long Dniusuario { get; set; }
|
||||||
|
|
||||||
|
public string Accion { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual Cliente DniusuarioNavigation { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual ICollection<LogDetalle> LogDetalles { get; set; } = new List<LogDetalle>();
|
||||||
|
}
|
||||||
23
Entidades/Logdetalle.cs
Normal file
23
Entidades/Logdetalle.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Entidades;
|
||||||
|
|
||||||
|
public partial class LogDetalle
|
||||||
|
{
|
||||||
|
public DateTime Fecha { get; set; }
|
||||||
|
|
||||||
|
public long Dniusuario { get; set; }
|
||||||
|
|
||||||
|
public string NombreTabla { get; set; } = null!;
|
||||||
|
|
||||||
|
public string Columna { get; set; } = null!;
|
||||||
|
|
||||||
|
public string? ValorAnterior { get; set; }
|
||||||
|
|
||||||
|
public string? ValorNuevo { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public virtual Log Log { get; set; } = null!;
|
||||||
|
}
|
||||||
9
Entidades/Logs/LogDetalleDto.cs
Normal file
9
Entidades/Logs/LogDetalleDto.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public class LogDetalleDto {
|
||||||
|
public DateTime Fecha { get; set; }
|
||||||
|
public long Dniusuario { get; set; }
|
||||||
|
public string NombreTabla { get; set; } = null!;
|
||||||
|
public string Columna { get; set; } = null!;
|
||||||
|
public string? ValorAnterior { get; set; }
|
||||||
|
public string? ValorNuevo { get; set; }
|
||||||
|
}
|
||||||
7
Entidades/Logs/LogDto.cs
Normal file
7
Entidades/Logs/LogDto.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Entidades.Dto;
|
||||||
|
public class LogDto {
|
||||||
|
public DateTime Fecha { get; set; }
|
||||||
|
public long Dniusuario { get; set; }
|
||||||
|
public string Accion { get; set; } = null!;
|
||||||
|
}
|
||||||
|
|
||||||
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 int Id { get; set; }
|
||||||
|
|
||||||
public string? Descripcion { get; set; }
|
public string Descripcion { get; set; } = null!;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||||
|
|||||||
@@ -23,14 +23,20 @@ public partial class Propiedade
|
|||||||
|
|
||||||
public decimal Monto { get; set; }
|
public decimal Monto { get; set; }
|
||||||
|
|
||||||
|
public int Iddivisa { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||||
|
|
||||||
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||||
|
|
||||||
public virtual EstadoPropiedad? IdestadoNavigation { get; set; }
|
public virtual EstadoPropiedad? IdestadoNavigation { get; set; }
|
||||||
|
|
||||||
public virtual TipoPropiedad IdtipropiedadNavigation { get; set; } = null!;
|
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<Venta> Venta { get; set; } = new List<Venta>();
|
||||||
|
|
||||||
public virtual ICollection<Servicio> IdServicios { get; set; } = new List<Servicio>();
|
public virtual ICollection<Servicio> IdServicios { get; set; } = new List<Servicio>();
|
||||||
|
|||||||
@@ -17,16 +17,22 @@ public partial class Venta
|
|||||||
|
|
||||||
public int? Idpropiedad { get; set; }
|
public int? Idpropiedad { get; set; }
|
||||||
|
|
||||||
public DateTime Fechainicio { get; set; }
|
public DateTime? Fechainicio { get; set; }
|
||||||
|
|
||||||
public DateTime? Fechafinal { get; set; }
|
public DateTime? Fechafinal { get; set; }
|
||||||
|
|
||||||
|
public int Iddivisa { get; set; }
|
||||||
|
|
||||||
|
public string? UrlRecibo { get; set; }
|
||||||
|
|
||||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||||
|
|
||||||
public virtual Cliente? IdCompradorNavigation { get; set; }
|
public virtual Cliente? IdCompradorNavigation { get; set; }
|
||||||
|
|
||||||
public virtual Cliente? IdVendedorNavigation { get; set; }
|
public virtual Cliente? IdVendedorNavigation { get; set; }
|
||||||
|
|
||||||
|
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||||
|
|
||||||
public virtual Estadoventa? IdestadoNavigation { get; set; }
|
public virtual Estadoventa? IdestadoNavigation { get; set; }
|
||||||
|
|
||||||
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
run:
|
run:
|
||||||
dotnet ef dbcontext scaffold "Server=fedesrv.ddns.net;Port=30006;Database=AlquilaFacil;Uid=AlquilaFacil;Pwd=.n@9c2ve*0,b1ETv].Kipa/~pR~V;Connection Timeout=5;SslMode=none" MySql.EntityFrameworkCore -o .
|
dotnet ef dbcontext scaffold "Server=127.0.0.1;Port=3306;Database=AlquilaFacil;Uid=AlquilaFacil;Pwd=.n@9c2ve*0,b1ETv].Kipa/~pR~V;Connection Timeout=5;SslMode=none" MySql.EntityFrameworkCore -o .
|
||||||
./convert_to_pascalcase.sh
|
./convert_to_pascalcase.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
4
Front/.prettierrc
Normal file
4
Front/.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 4,
|
||||||
|
"useTabs": false
|
||||||
|
}
|
||||||
84
Front/.svelte-kit/ambient.d.ts
vendored
84
Front/.svelte-kit/ambient.d.ts
vendored
@@ -35,59 +35,47 @@ declare module '$env/static/private' {
|
|||||||
export const LESS: string;
|
export const LESS: string;
|
||||||
export const XDG_SESSION_PATH: string;
|
export const XDG_SESSION_PATH: string;
|
||||||
export const XDG_MENU_PREFIX: string;
|
export const XDG_MENU_PREFIX: string;
|
||||||
export const ICEAUTHORITY: string;
|
|
||||||
export const LANGUAGE: string;
|
|
||||||
export const NODE: string;
|
export const NODE: string;
|
||||||
export const LC_ADDRESS: string;
|
export const LC_ADDRESS: string;
|
||||||
export const LC_NAME: string;
|
export const LC_NAME: string;
|
||||||
|
export const SSH_AUTH_SOCK: string;
|
||||||
export const GRADLE_HOME: string;
|
export const GRADLE_HOME: string;
|
||||||
export const SHELL_SESSION_ID: string;
|
export const XDG_CONFIG_HOME: string;
|
||||||
export const MEMORY_PRESSURE_WRITE: string;
|
|
||||||
export const npm_config_local_prefix: string;
|
export const npm_config_local_prefix: string;
|
||||||
export const DESKTOP_SESSION: string;
|
export const DESKTOP_SESSION: string;
|
||||||
export const LC_MONETARY: string;
|
export const LC_MONETARY: string;
|
||||||
export const GTK_RC_FILES: string;
|
export const SSH_AGENT_PID: string;
|
||||||
export const EDITOR: string;
|
export const EDITOR: string;
|
||||||
|
export const GTK_MODULES: string;
|
||||||
export const XDG_SEAT: string;
|
export const XDG_SEAT: string;
|
||||||
export const PWD: string;
|
export const PWD: string;
|
||||||
export const XDG_SESSION_DESKTOP: string;
|
|
||||||
export const LOGNAME: string;
|
export const LOGNAME: string;
|
||||||
|
export const XDG_SESSION_DESKTOP: string;
|
||||||
export const XDG_SESSION_TYPE: string;
|
export const XDG_SESSION_TYPE: string;
|
||||||
export const BUN_WHICH_IGNORE_CWD: string;
|
export const PANEL_GDK_CORE_DEVICE_EVENTS: string;
|
||||||
export const SYSTEMD_EXEC_PID: string;
|
|
||||||
export const _: string;
|
export const _: string;
|
||||||
export const XAUTHORITY: string;
|
export const XAUTHORITY: string;
|
||||||
|
export const XDG_GREETER_DATA_DIR: string;
|
||||||
export const MOTD_SHOWN: string;
|
export const MOTD_SHOWN: string;
|
||||||
export const GTK2_RC_FILES: string;
|
export const GDM_LANG: string;
|
||||||
export const HOME: string;
|
export const HOME: string;
|
||||||
export const LC_PAPER: string;
|
export const LC_PAPER: string;
|
||||||
export const LANG: string;
|
export const LANG: string;
|
||||||
export const LS_COLORS: string;
|
export const LS_COLORS: string;
|
||||||
export const XDG_CURRENT_DESKTOP: string;
|
export const XDG_CURRENT_DESKTOP: string;
|
||||||
export const KONSOLE_DBUS_SERVICE: string;
|
|
||||||
export const npm_package_version: string;
|
export const npm_package_version: string;
|
||||||
export const MEMORY_PRESSURE_WATCH: string;
|
export const VTE_VERSION: string;
|
||||||
export const WAYLAND_DISPLAY: string;
|
|
||||||
export const KONSOLE_DBUS_SESSION: string;
|
|
||||||
export const PROFILEHOME: string;
|
|
||||||
export const XDG_SEAT_PATH: string;
|
export const XDG_SEAT_PATH: string;
|
||||||
export const INVOCATION_ID: string;
|
export const XDG_CACHE_HOME: string;
|
||||||
export const KONSOLE_VERSION: string;
|
|
||||||
export const MANAGERPID: string;
|
|
||||||
export const INIT_CWD: string;
|
|
||||||
export const KDE_SESSION_UID: string;
|
|
||||||
export const XKB_DEFAULT_LAYOUT: string;
|
|
||||||
export const XDG_SESSION_CLASS: string;
|
export const XDG_SESSION_CLASS: string;
|
||||||
export const TERM: string;
|
export const TERM: string;
|
||||||
export const LC_IDENTIFICATION: string;
|
export const LC_IDENTIFICATION: string;
|
||||||
export const npm_package_name: string;
|
export const npm_package_name: string;
|
||||||
export const ZSH: string;
|
export const ZSH: string;
|
||||||
export const USER: string;
|
export const USER: string;
|
||||||
export const COLORFGBG: string;
|
|
||||||
export const QT_WAYLAND_RECONNECT: string;
|
|
||||||
export const KDE_SESSION_VERSION: string;
|
|
||||||
export const PAM_KWALLET5_LOGIN: string;
|
export const PAM_KWALLET5_LOGIN: string;
|
||||||
export const DISPLAY: string;
|
export const DISPLAY: string;
|
||||||
|
export const npm_lifecycle_event: string;
|
||||||
export const SHLVL: string;
|
export const SHLVL: string;
|
||||||
export const PAGER: string;
|
export const PAGER: string;
|
||||||
export const LC_TELEPHONE: string;
|
export const LC_TELEPHONE: string;
|
||||||
@@ -101,19 +89,17 @@ declare module '$env/static/private' {
|
|||||||
export const npm_package_json: string;
|
export const npm_package_json: string;
|
||||||
export const LC_TIME: string;
|
export const LC_TIME: string;
|
||||||
export const BUN_INSTALL: string;
|
export const BUN_INSTALL: string;
|
||||||
export const QT_AUTO_SCREEN_SCALE_FACTOR: string;
|
export const GTK3_MODULES: string;
|
||||||
export const JOURNAL_STREAM: string;
|
|
||||||
export const XDG_DATA_DIRS: string;
|
export const XDG_DATA_DIRS: string;
|
||||||
export const KDE_FULL_SESSION: string;
|
|
||||||
export const BROWSER: string;
|
export const BROWSER: string;
|
||||||
export const PATH: string;
|
export const PATH: string;
|
||||||
|
export const GDMSESSION: string;
|
||||||
export const DBUS_SESSION_BUS_ADDRESS: string;
|
export const DBUS_SESSION_BUS_ADDRESS: string;
|
||||||
export const KDE_APPLICATIONS_AS_SCOPE: string;
|
|
||||||
export const MAIL: string;
|
export const MAIL: string;
|
||||||
export const npm_node_execpath: string;
|
export const npm_node_execpath: string;
|
||||||
export const LC_NUMERIC: string;
|
export const LC_NUMERIC: string;
|
||||||
export const OLDPWD: string;
|
export const OLDPWD: string;
|
||||||
export const KONSOLE_DBUS_WINDOW: string;
|
export const NODE_ENV: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -154,59 +140,47 @@ declare module '$env/dynamic/private' {
|
|||||||
LESS: string;
|
LESS: string;
|
||||||
XDG_SESSION_PATH: string;
|
XDG_SESSION_PATH: string;
|
||||||
XDG_MENU_PREFIX: string;
|
XDG_MENU_PREFIX: string;
|
||||||
ICEAUTHORITY: string;
|
|
||||||
LANGUAGE: string;
|
|
||||||
NODE: string;
|
NODE: string;
|
||||||
LC_ADDRESS: string;
|
LC_ADDRESS: string;
|
||||||
LC_NAME: string;
|
LC_NAME: string;
|
||||||
|
SSH_AUTH_SOCK: string;
|
||||||
GRADLE_HOME: string;
|
GRADLE_HOME: string;
|
||||||
SHELL_SESSION_ID: string;
|
XDG_CONFIG_HOME: string;
|
||||||
MEMORY_PRESSURE_WRITE: string;
|
|
||||||
npm_config_local_prefix: string;
|
npm_config_local_prefix: string;
|
||||||
DESKTOP_SESSION: string;
|
DESKTOP_SESSION: string;
|
||||||
LC_MONETARY: string;
|
LC_MONETARY: string;
|
||||||
GTK_RC_FILES: string;
|
SSH_AGENT_PID: string;
|
||||||
EDITOR: string;
|
EDITOR: string;
|
||||||
|
GTK_MODULES: string;
|
||||||
XDG_SEAT: string;
|
XDG_SEAT: string;
|
||||||
PWD: string;
|
PWD: string;
|
||||||
XDG_SESSION_DESKTOP: string;
|
|
||||||
LOGNAME: string;
|
LOGNAME: string;
|
||||||
|
XDG_SESSION_DESKTOP: string;
|
||||||
XDG_SESSION_TYPE: string;
|
XDG_SESSION_TYPE: string;
|
||||||
BUN_WHICH_IGNORE_CWD: string;
|
PANEL_GDK_CORE_DEVICE_EVENTS: string;
|
||||||
SYSTEMD_EXEC_PID: string;
|
|
||||||
_: string;
|
_: string;
|
||||||
XAUTHORITY: string;
|
XAUTHORITY: string;
|
||||||
|
XDG_GREETER_DATA_DIR: string;
|
||||||
MOTD_SHOWN: string;
|
MOTD_SHOWN: string;
|
||||||
GTK2_RC_FILES: string;
|
GDM_LANG: string;
|
||||||
HOME: string;
|
HOME: string;
|
||||||
LC_PAPER: string;
|
LC_PAPER: string;
|
||||||
LANG: string;
|
LANG: string;
|
||||||
LS_COLORS: string;
|
LS_COLORS: string;
|
||||||
XDG_CURRENT_DESKTOP: string;
|
XDG_CURRENT_DESKTOP: string;
|
||||||
KONSOLE_DBUS_SERVICE: string;
|
|
||||||
npm_package_version: string;
|
npm_package_version: string;
|
||||||
MEMORY_PRESSURE_WATCH: string;
|
VTE_VERSION: string;
|
||||||
WAYLAND_DISPLAY: string;
|
|
||||||
KONSOLE_DBUS_SESSION: string;
|
|
||||||
PROFILEHOME: string;
|
|
||||||
XDG_SEAT_PATH: string;
|
XDG_SEAT_PATH: string;
|
||||||
INVOCATION_ID: string;
|
XDG_CACHE_HOME: string;
|
||||||
KONSOLE_VERSION: string;
|
|
||||||
MANAGERPID: string;
|
|
||||||
INIT_CWD: string;
|
|
||||||
KDE_SESSION_UID: string;
|
|
||||||
XKB_DEFAULT_LAYOUT: string;
|
|
||||||
XDG_SESSION_CLASS: string;
|
XDG_SESSION_CLASS: string;
|
||||||
TERM: string;
|
TERM: string;
|
||||||
LC_IDENTIFICATION: string;
|
LC_IDENTIFICATION: string;
|
||||||
npm_package_name: string;
|
npm_package_name: string;
|
||||||
ZSH: string;
|
ZSH: string;
|
||||||
USER: string;
|
USER: string;
|
||||||
COLORFGBG: string;
|
|
||||||
QT_WAYLAND_RECONNECT: string;
|
|
||||||
KDE_SESSION_VERSION: string;
|
|
||||||
PAM_KWALLET5_LOGIN: string;
|
PAM_KWALLET5_LOGIN: string;
|
||||||
DISPLAY: string;
|
DISPLAY: string;
|
||||||
|
npm_lifecycle_event: string;
|
||||||
SHLVL: string;
|
SHLVL: string;
|
||||||
PAGER: string;
|
PAGER: string;
|
||||||
LC_TELEPHONE: string;
|
LC_TELEPHONE: string;
|
||||||
@@ -220,19 +194,17 @@ declare module '$env/dynamic/private' {
|
|||||||
npm_package_json: string;
|
npm_package_json: string;
|
||||||
LC_TIME: string;
|
LC_TIME: string;
|
||||||
BUN_INSTALL: string;
|
BUN_INSTALL: string;
|
||||||
QT_AUTO_SCREEN_SCALE_FACTOR: string;
|
GTK3_MODULES: string;
|
||||||
JOURNAL_STREAM: string;
|
|
||||||
XDG_DATA_DIRS: string;
|
XDG_DATA_DIRS: string;
|
||||||
KDE_FULL_SESSION: string;
|
|
||||||
BROWSER: string;
|
BROWSER: string;
|
||||||
PATH: string;
|
PATH: string;
|
||||||
|
GDMSESSION: string;
|
||||||
DBUS_SESSION_BUS_ADDRESS: string;
|
DBUS_SESSION_BUS_ADDRESS: string;
|
||||||
KDE_APPLICATIONS_AS_SCOPE: string;
|
|
||||||
MAIL: string;
|
MAIL: string;
|
||||||
npm_node_execpath: string;
|
npm_node_execpath: string;
|
||||||
LC_NUMERIC: string;
|
LC_NUMERIC: string;
|
||||||
OLDPWD: string;
|
OLDPWD: string;
|
||||||
KONSOLE_DBUS_WINDOW: string;
|
NODE_ENV: string;
|
||||||
[key: `PUBLIC_${string}`]: undefined;
|
[key: `PUBLIC_${string}`]: undefined;
|
||||||
[key: `${string}`]: string | undefined;
|
[key: `${string}`]: string | undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,15 @@ export const dictionary = {
|
|||||||
|
|
||||||
export const hooks = {
|
export const hooks = {
|
||||||
handleError: (({ error }) => { console.error(error) }),
|
handleError: (({ error }) => { console.error(error) }),
|
||||||
|
|
||||||
reroute: (() => {})
|
reroute: (() => {}),
|
||||||
|
transport: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const decoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.decode]));
|
||||||
|
|
||||||
|
export const hash = false;
|
||||||
|
|
||||||
|
export const decode = (type, value) => decoders[type](value);
|
||||||
|
|
||||||
export { default as root } from '../root.js';
|
export { default as root } from '../root.js';
|
||||||
@@ -1,13 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"paths": {
|
"paths": {},
|
||||||
"$lib": [
|
|
||||||
"../src/lib"
|
|
||||||
],
|
|
||||||
"$lib/*": [
|
|
||||||
"../src/lib/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rootDirs": [
|
"rootDirs": [
|
||||||
"..",
|
"..",
|
||||||
"./types"
|
"./types"
|
||||||
|
|||||||
BIN
Front/bun.lockb
BIN
Front/bun.lockb
Binary file not shown.
@@ -5,6 +5,7 @@
|
|||||||
<link rel="icon" type="image/png" href="/favicon.svg" />
|
<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"/>
|
<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/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>
|
<script>
|
||||||
// Configura el tema desde localStorage antes de cargar la aplicación
|
// Configura el tema desde localStorage antes de cargar la aplicación
|
||||||
const savedTheme = localStorage.getItem("theme") || "light";
|
const savedTheme = localStorage.getItem("theme") || "light";
|
||||||
|
|||||||
641
Front/package-lock.json
generated
Normal file
641
Front/package-lock.json
generated
Normal file
@@ -0,0 +1,641 @@
|
|||||||
|
{
|
||||||
|
"name": "front",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "front",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@sveltestrap/sveltestrap": "^6.2.8",
|
||||||
|
"chartjs": "^0.3.24",
|
||||||
|
"svelte-routing": "^2.13.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
||||||
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
|
"prettier": "^3.5.0",
|
||||||
|
"prettier-plugin-svelte": "^3.3.3",
|
||||||
|
"svelte": "^5.20.0",
|
||||||
|
"svelte-check": "^4.1.4",
|
||||||
|
"tslib": "^2.8.1",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"vite": "^5.4.14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"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/@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"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||||
|
"version": "4.24.0",
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
],
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/@sveltejs/vite-plugin-svelte": {
|
||||||
|
"version": "4.0.4",
|
||||||
|
"dev": true,
|
||||||
|
"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",
|
||||||
|
"dev": true,
|
||||||
|
"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.8",
|
||||||
|
"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/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/clsx": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "4.3.7",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/deepmerge": {
|
||||||
|
"version": "4.3.1",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/esbuild": {
|
||||||
|
"version": "0.21.5",
|
||||||
|
"dev": true,
|
||||||
|
"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.2.2",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/esrap": {
|
||||||
|
"version": "1.4.4",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/sourcemap-codec": "^1.4.15"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fdir": {
|
||||||
|
"version": "6.4.0",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"picomatch": "^3 || ^4"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"picomatch": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-reference": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/estree": "^1.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/kleur": {
|
||||||
|
"version": "4.1.5",
|
||||||
|
"dev": true,
|
||||||
|
"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",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/nanoid": {
|
||||||
|
"version": "3.3.7",
|
||||||
|
"dev": true,
|
||||||
|
"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",
|
||||||
|
"dev": true,
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/postcss": {
|
||||||
|
"version": "8.4.47",
|
||||||
|
"dev": true,
|
||||||
|
"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.5.0",
|
||||||
|
"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",
|
||||||
|
"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",
|
||||||
|
"dev": true,
|
||||||
|
"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",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mri": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/source-map-js": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"dev": true,
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/svelte": {
|
||||||
|
"version": "5.20.0",
|
||||||
|
"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",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
|
"esm-env": "^1.2.1",
|
||||||
|
"esrap": "^1.4.3",
|
||||||
|
"is-reference": "^3.0.3",
|
||||||
|
"locate-character": "^3.0.0",
|
||||||
|
"magic-string": "^0.30.11",
|
||||||
|
"zimmerframe": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/svelte-check": {
|
||||||
|
"version": "4.1.4",
|
||||||
|
"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/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"dev": true,
|
||||||
|
"license": "0BSD"
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.7.3",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/vite": {
|
||||||
|
"version": "5.4.14",
|
||||||
|
"dev": true,
|
||||||
|
"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",
|
||||||
|
"dev": true,
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,17 +10,18 @@
|
|||||||
"check": "svelte-check --tsconfig ./tsconfig.json && tsc -p tsconfig.node.json"
|
"check": "svelte-check --tsconfig ./tsconfig.json && tsc -p tsconfig.node.json"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
||||||
"@tsconfig/svelte": "^5.0.4",
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
"svelte": "^5.0.0",
|
"prettier": "^3.5.0",
|
||||||
"svelte-check": "^4.0.5",
|
"prettier-plugin-svelte": "^3.3.3",
|
||||||
"tslib": "^2.8.0",
|
"svelte": "^5.20.0",
|
||||||
"typescript": "^5.6.3",
|
"svelte-check": "^4.1.4",
|
||||||
"vite": "^5.4.10"
|
"tslib": "^2.8.1",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"vite": "^5.4.14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sveltejs/kit": "^2.7.3",
|
"@sveltestrap/sveltestrap": "^6.2.8",
|
||||||
"@sveltestrap/sveltestrap": "^6.2.7",
|
|
||||||
"chartjs": "^0.3.24",
|
"chartjs": "^0.3.24",
|
||||||
"svelte-routing": "^2.13.0"
|
"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 |
@@ -14,9 +14,21 @@
|
|||||||
import FrontPropietario from "./paginas/grupos/PropietarioG.svelte";
|
import FrontPropietario from "./paginas/grupos/PropietarioG.svelte";
|
||||||
import PublicarPropiedad from "./paginas/PublicarPropiedad.svelte";
|
import PublicarPropiedad from "./paginas/PublicarPropiedad.svelte";
|
||||||
import BusquedaPropiedades from "./paginas/BusquedaPropiedades.svelte";
|
import BusquedaPropiedades from "./paginas/BusquedaPropiedades.svelte";
|
||||||
import ControlUsuarios from "./paginas/AdminUsuarios.svelte";
|
import AdminUsuarios from "./paginas/AdminUsuarios.svelte";
|
||||||
import ControlPropiedades from "./paginas/AdminPropiedades.svelte";
|
import AdminPropiedades from "./paginas/AdminPropiedades.svelte";
|
||||||
import Notificaciones from "./paginas/Notificaciones.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";
|
||||||
|
import CompraYVentas from "./paginas/CompraYVenta.svelte";
|
||||||
|
import Ventas from "./paginas/Ventas.svelte";
|
||||||
|
import VerLogs from "./paginas/VerLogs.svelte";
|
||||||
|
import ControlPagos from "./paginas/ControlPagos.svelte";
|
||||||
|
import ContratoAdmin from "./paginas/ContratoAdmin.svelte";
|
||||||
|
import BuscarVentas from "./paginas/BuscarVentas.svelte";
|
||||||
|
import MisPropiedadesEnVenta from "./paginas/MisPropiedadesEnVenta.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Router>
|
<Router>
|
||||||
@@ -34,7 +46,8 @@
|
|||||||
<ProteRoute componente={MenuPage} />
|
<ProteRoute componente={MenuPage} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<!--Publicar Propiedad-->
|
<!--Publicar Prop
|
||||||
|
iedad-->
|
||||||
<Route path="/accion/1">
|
<Route path="/accion/1">
|
||||||
<ProteRoute componente={PublicarPropiedad}/>
|
<ProteRoute componente={PublicarPropiedad}/>
|
||||||
</Route>
|
</Route>
|
||||||
@@ -59,6 +72,16 @@
|
|||||||
<ProteRoute componente={PropPage}/>
|
<ProteRoute componente={PropPage}/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<!--Crear Cuenta Propietario-->
|
||||||
|
<Route path="/accion/6">
|
||||||
|
<ProteRoute componente={Informes}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!--Ver Logs-->
|
||||||
|
<Route path="/accion/7">
|
||||||
|
<ProteRoute componente={VerLogs}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
<!--Administrar Propiedades Dadas de Baja-->
|
<!--Administrar Propiedades Dadas de Baja-->
|
||||||
<Route path="/accion/8">
|
<Route path="/accion/8">
|
||||||
<ProteRoute componente={MisPropiedadesDeBaja}/>
|
<ProteRoute componente={MisPropiedadesDeBaja}/>
|
||||||
@@ -66,9 +89,48 @@
|
|||||||
|
|
||||||
<!-- Pantalla Control Usuarios -->
|
<!-- Pantalla Control Usuarios -->
|
||||||
<Route path="/accion/9">
|
<Route path="/accion/9">
|
||||||
<ProteRoute componente={ControlUsuarios}/>
|
<ProteRoute componente={AdminUsuarios}/>
|
||||||
</Route>
|
</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>
|
||||||
|
|
||||||
|
<!-- Compra y Ventas -->
|
||||||
|
<Route path="/accion/13">
|
||||||
|
<ProteRoute componente={CompraYVentas}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!-- Control Pago Contratos Incumplidos -->
|
||||||
|
<Route path="/accion/14">
|
||||||
|
<ProteRoute componente={ControlPagos}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!-- VerPropiedadesEnVenta -->
|
||||||
|
<Route path="/accion/15">
|
||||||
|
<ProteRoute componente={MisPropiedadesEnVenta}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!-- Buscar Ventas -->
|
||||||
|
<Route path="/accion/16">
|
||||||
|
<ProteRoute componente={BuscarVentas}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!-- Pagina Ventas -->
|
||||||
|
<Route path="/Ventas">
|
||||||
|
<ProteRoute componente={Ventas}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
<!--Paginas info Grupo-->
|
<!--Paginas info Grupo-->
|
||||||
<Route path="/grupo/Inquilino">
|
<Route path="/grupo/Inquilino">
|
||||||
@@ -89,6 +151,19 @@
|
|||||||
<ProteRoute componente={Notificaciones}/>
|
<ProteRoute componente={Notificaciones}/>
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<!--Contratos Propietarios-->
|
||||||
|
<Route path="/propietario/contratos">
|
||||||
|
<ProteRoute componente={ContratosPropietario}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!--Contratos Inquilino-->
|
||||||
|
<Route path="/inquilino/contratos">
|
||||||
|
<ProteRoute componente={ContratoInquilino}/>
|
||||||
|
</Route>
|
||||||
|
|
||||||
|
<!--Contratos Admin-->
|
||||||
|
<Route path="/admin/contratos">
|
||||||
|
<ProteRoute componente={ContratoAdmin}/>
|
||||||
|
</Route>
|
||||||
</Router>
|
</Router>
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user