Compare commits
116 Commits
acciones_a
...
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 | |||
| 28b0a6b785 | |||
| c776e06183 | |||
| cb4f814320 | |||
| 0a9ac0a787 | |||
| 2fa110bb89 | |||
| 45ebdb24be | |||
| a89852804d | |||
| 8c5d0108a1 | |||
| 872415cdde | |||
| f1c9632855 | |||
| bb860b1a16 | |||
| f9204cd835 | |||
| 6f34d628c4 | |||
| 76bcec58d2 | |||
| 3f08dcfc81 | |||
| 990f866a71 | |||
| dbc255dd4b | |||
| c8daa303e4 | |||
| edaf8c6600 | |||
| 9216efc59f | |||
| 5a26fe8bd1 | |||
| dee2031d87 | |||
| 5289c07d84 | |||
| 646cf3e009 | |||
| c116c924cd | |||
| 28cf77ad18 | |||
| 00cce75fad | |||
| 29f7dc4efe | |||
| e9b3baa9ca | |||
| aa36454730 | |||
| 50bb59e15f | |||
| d2a7368dee | |||
| feb4db86c0 | |||
| 80c778d91a |
4
.editorconfig
Normal file
4
.editorconfig
Normal file
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# CS8602: Dereference of a possibly null reference.
|
||||
dotnet_diagnostic.CS8602.severity = suggestion
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -7,3 +7,5 @@
|
||||
/Entidades/obj/
|
||||
/Aspnet/obj/
|
||||
/Modelo/bin/
|
||||
Aspnet/bin/
|
||||
node_modules/
|
||||
@@ -10,6 +10,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
|
||||
<PackageReference Include="minio" Version="6.0.3" />
|
||||
<PackageReference Include="QuestPDF" Version="2024.12.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.002.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlquilaFacil", "AlquilaFacil.csproj", "{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{76BA8B31-BAD3-49CD-B8B8-BE22D8AEA281}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {CF93AFAC-32EF-4993-84A2-CA2EB32F58FF}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
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; } = "";
|
||||
}
|
||||
@@ -1,24 +1,40 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
using System.Text.Json;
|
||||
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class AccionesController: ControllerBase {
|
||||
|
||||
//Reutilizo el loginDto pero no lleno el campo de contraseña
|
||||
[HttpPost("api/acciones")]
|
||||
public IActionResult ListarAccionesPorUsuario([FromBody] LoginDto email, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (email.Email == "" || email.Email == null) return BadRequest();
|
||||
[HttpGet("api/acciones")]
|
||||
public IActionResult ListarAccionesPorUsuario([FromHeader(Name ="Email")] string Email, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (Email == "" || Email == null) return BadRequest();
|
||||
|
||||
if (Auth == "") return Unauthorized(new { esValido = false});
|
||||
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(email.Email, Auth);
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(Email, Auth);
|
||||
if (!esValido) return Unauthorized();
|
||||
|
||||
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(email.Email);
|
||||
var Permisos = RepositorioPermisos.Singleton.ListarPermisos(Email);
|
||||
Response.Headers["Content-Type"] = "application/json";
|
||||
return Ok(Permisos);
|
||||
}
|
||||
|
||||
[HttpPost("api/acciones/grupo")]
|
||||
public IActionResult ListarAccionesPorGrupo([FromHeader(Name = "Auth")] string Auth,
|
||||
[FromBody] AccionesPorGrupoDto req) {
|
||||
if (string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||
bool esValido = RepositorioUsuarios.Singleton.CheckToken(req.Email, Auth);
|
||||
if (esValido == false) return BadRequest(esValido);
|
||||
|
||||
bool tieneGrupo = RepositorioUsuarios.Singleton.CheckGrupo(req.Email, req.Grupo);
|
||||
if (tieneGrupo == false) return Unauthorized();
|
||||
|
||||
var permisos = RepositorioGrupos.Singleton.ListarPermisosDeGrupo(req.Grupo);
|
||||
return Ok(permisos);
|
||||
}
|
||||
}
|
||||
419
Aspnet/Controllers/AdminController.cs
Normal file
419
Aspnet/Controllers/AdminController.cs
Normal file
@@ -0,0 +1,419 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
using Entidades.Admin;
|
||||
using Entidades.Dto;
|
||||
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;
|
||||
|
||||
[ApiController]
|
||||
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")]
|
||||
public IActionResult GetClientes([FromHeader(Name ="Auth")]string Auth){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
IEnumerable<UsuarioAdmin>list = RepositorioUsuarios.Singleton.GetClientes();
|
||||
return Ok(list);
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/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")]
|
||||
public IActionResult GetGruposByCliente([FromHeader(Name ="Auth")]string Auth, [FromQuery]long Dni){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (Dni <= 0) return BadRequest(new {message = "No puede tener un dni con numero negativo o cero"});
|
||||
|
||||
IEnumerable<GrupoAdmin> list = RepositorioGrupos.Singleton.ObtenerGruposPorDni(Dni);
|
||||
return Ok(list);
|
||||
}
|
||||
[HttpPatch("api/admin/cliente/addGrupo")]
|
||||
public IActionResult AddGrupoACliente([FromHeader(Name = "Auth")]string Auth, [FromBody]EmailGrupo data){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
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" });
|
||||
|
||||
var ret = RepositorioUsuarios.Singleton.CheckGrupo(data.email, data.grupo);
|
||||
if (ret) return BadRequest(new { message = $"El usuario ya pertenece al grupo {data.grupo}"});
|
||||
|
||||
var ret2 = RepositorioUsuarios.Singleton.AñadirClienteAGrupo(data.email, data.grupo, cli.Dni);
|
||||
|
||||
return ret2 ? Ok(new {message = "Se Añadio al Grupo"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
||||
}
|
||||
|
||||
[HttpPatch("api/admin/cliente/rmGrupo")]
|
||||
public IActionResult RmGrupoACliente([FromHeader(Name = "Auth")]string Auth, [FromBody]EmailGrupo data){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
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" });
|
||||
|
||||
//una ward para que no me bloquee a mi mismo de tener acceso a admin
|
||||
if (data.email == "celu@fedesrv.ddns.net" && data.grupo == "Admin") return BadRequest(new { message = "Si hago esto me estaria bloqueando la cuenta a mi mismo" });
|
||||
|
||||
var ret = RepositorioUsuarios.Singleton.CheckGrupo(data.email, data.grupo);
|
||||
if (!ret) return BadRequest(new { message = $"El usuario no pertenece al grupo {data.grupo}"});
|
||||
|
||||
if (data.grupo == "Propietario") {
|
||||
IQueryable<PropiedadesDto> ret3 = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(data.email);
|
||||
if (ret3.Count() > 0){
|
||||
bool ret4 = RepositorioPropiedades.Singleton.BajaPropiedades(data.email);
|
||||
if (ret4 == false) return BadRequest(new { message = "No se pudo dar de baja las propiedades"});
|
||||
}
|
||||
}
|
||||
if (data.grupo == "Inquilino") {
|
||||
var ret5 = RepositorioContratos.Singleton.ObtenerContratosPorEmailInquilino(data.email);
|
||||
if ( ret5 == null || ret5.Where(x=>x.Habilitado == 0).Count() > 0) return BadRequest(new { message = "Aun tenes alquileres pendientes o fallo al intentar obtener la lista de alquileres, no se puede dar de baja"});
|
||||
}
|
||||
|
||||
var ret2 = RepositorioUsuarios.Singleton.EliminarClienteAGrupo(data.email, data.grupo, cli.Dni);
|
||||
return ret2 ? Ok(new {message = $"Se elimino del Grupo: {data.grupo}"}): BadRequest(new { message = "Fallo al añadirse al Grupo" });
|
||||
}
|
||||
|
||||
[HttpDelete("api/admin/cliente")]
|
||||
public IActionResult BajaCliente([FromHeader(Name ="Auth")]string Auth, long Dni){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 9);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if ( Dni <=0) return BadRequest(new {message = "No puede tener un Dni menor o igual a 0"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorDni(Dni);
|
||||
|
||||
if (cli == null) return BadRequest(new {message = "No existe un cliente con ese numero de dni"});
|
||||
|
||||
bool esPropietario = RepositorioUsuarios.Singleton.CheckGrupo(cli.Email, "Propietario");
|
||||
bool esInquilino = RepositorioUsuarios.Singleton.CheckGrupo(cli.Email, "Inquilino");
|
||||
|
||||
if (esPropietario) {
|
||||
IQueryable<PropiedadesDto> ret3 = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(cli.Email);
|
||||
if (ret3.Count() > 0){
|
||||
bool ret4 = RepositorioPropiedades.Singleton.BajaPropiedades(cli.Email);
|
||||
if (ret4 == false) return BadRequest(new { message = "No se pudo dar de baja las propiedades"});
|
||||
}
|
||||
}
|
||||
|
||||
if (esInquilino) {
|
||||
var ret5 = RepositorioContratos.Singleton.ObtenerContratosPorEmailInquilino(cli.Email);
|
||||
if ( ret5 == null || ret5.Where(x=>x.Habilitado == 0).Count() > 0) return BadRequest(new { message = "Aun tenes alquileres pendientes o fallo al intentar obtener la lista de alquileres, no se puede dar de baja"});
|
||||
}
|
||||
// lo da de baja si no tiene el grupo propietario y no tiene alquileres pendientes
|
||||
var ret = RepositorioUsuarios.Singleton.BajaCliente(Dni);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpDelete("api/admin/propiedad")]
|
||||
public IActionResult BajaPropiedad([FromHeader(Name = "Auth")] string Auth, int id = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (id <= 0) return BadRequest(new { message = "Falto indicar id Propiedad"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null) return Unauthorized();
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id, cli.Dni);
|
||||
return ret ?
|
||||
Ok(new {message = "Se cambio el estado de la propiedad"}): BadRequest(new { message = "No se pudo dar de baja"});
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/busqueda/paginada")]
|
||||
public IActionResult FiltroPropiedadesPaginado([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "", int pag = 1) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
IQueryable<PropiedadesAdmin>? props = null;
|
||||
pag -= 1;
|
||||
|
||||
var clave = $"{(cantidadHabitaciones != 0 ? "1" : "0")}{(tipoPropiedad != 0 ? "1" : "0")}{(!string.IsNullOrEmpty(servicios) ? "1" : "0")}";
|
||||
var gen = AdminBusquedaContext.Singleton;
|
||||
var estrategia = gen.ObtenerEstrategia(clave);
|
||||
props = estrategia.Filtrar(servicios, cantidadHabitaciones, tipoPropiedad, pag);
|
||||
|
||||
return Ok(props);
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/busqueda/cantPag")]
|
||||
public IActionResult CantidadPaginas([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "") {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
int ret = RepositorioPropiedades.Singleton.CuantasPaginasBusqueda(cantidadHabitaciones, servicios, tipoPropiedad, 0);
|
||||
return Ok(new { message = ret});
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
38
Aspnet/Controllers/BusquedaControler.cs
Normal file
38
Aspnet/Controllers/BusquedaControler.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Entidades.Dto;
|
||||
using Modelo;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Entidades.Admin;
|
||||
using AlquilaFacil.StrategyBusqueda;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class BusquedaController: ControllerBase {
|
||||
[HttpGet("api/busqueda")]
|
||||
public IActionResult FiltroPropiedades([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "") {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 3);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
IQueryable<PropiedadesDto>? props = null;
|
||||
|
||||
var clave = $"{(cantidadHabitaciones != 0 ? "1" : "0")}{(tipoPropiedad != 0 ? "1" : "0")}{(!string.IsNullOrEmpty(servicios) ? "1" : "0")}";
|
||||
|
||||
var gen = BusquedaContext.Singleton;
|
||||
var estrategia = gen.ObtenerEstrategia(clave);
|
||||
props = estrategia.Filtrar(servicios, cantidadHabitaciones, tipoPropiedad);
|
||||
|
||||
return Ok(props);
|
||||
}
|
||||
|
||||
[HttpGet("api/busqueda/cantPag")]
|
||||
public IActionResult GetCantPag([FromHeader(Name = "Auth")]string Auth, int cantidadHabitaciones = 0, int tipoPropiedad = 0, [FromQuery]string servicios = "") {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 3);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
int ret = RepositorioPropiedades.Singleton.CuantasPaginasBusqueda(cantidadHabitaciones, servicios, tipoPropiedad, 1);
|
||||
return Ok(new { message = ret});
|
||||
|
||||
}
|
||||
}
|
||||
838
Aspnet/Controllers/ContratoController.cs
Normal file
838
Aspnet/Controllers/ContratoController.cs
Normal file
@@ -0,0 +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 Minio;
|
||||
using Minio.DataModel;
|
||||
using Minio.DataModel.Args;
|
||||
using Minio.Exceptions;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.Controllers;
|
||||
|
||||
[ApiController]
|
||||
public class ContratoController: ControllerBase {
|
||||
|
||||
[HttpPost("api/contrato/GenerarRecibo")]
|
||||
public ActionResult GenerarRecibo([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto, bool html= true) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false){
|
||||
validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Inquilino");
|
||||
if (validacion1 == false) {
|
||||
return Unauthorized();
|
||||
}
|
||||
}
|
||||
|
||||
if (dto.Idcontrato <= 0) return BadRequest(new { message = "No puede tener un contrato con id 0 o menor"});
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(dto.Idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "No hay un contrato por ese id"});
|
||||
|
||||
if (cont.DniinquilinoNavigation == null || cont.DnipropietarioNavigation == null || cont.IdpropiedadNavigation == null ||
|
||||
cont.IdpropiedadNavigation.IdtipropiedadNavigation == null) return BadRequest(new { message = "comunicate con el admin esta mal cargado el contratod de alguina forma"});
|
||||
|
||||
Canon? can = RepositorioCanons.Singleton.ObtenerCanonContrato(dto.fecha, dto.Idcontrato);
|
||||
if (can == null) return BadRequest(new { message = "no hay un canon para ese contrato con esa fecha"});
|
||||
if (can.IdreciboNavigation == null) return BadRequest(new { message = "No hay un recibo para ese canon"});
|
||||
|
||||
var cdb = new ContratoDtoBuilder()
|
||||
.SetInquilino($"{cont.DniinquilinoNavigation.Nombre} {cont.DniinquilinoNavigation.Apellido}")
|
||||
.SetUbicacion(cont.IdpropiedadNavigation.Ubicacion)
|
||||
.SetPropietario($"{cont.DnipropietarioNavigation.Nombre} {cont.DnipropietarioNavigation.Apellido}")
|
||||
.SetId(cont.Id)
|
||||
.SetTipo(cont.IdpropiedadNavigation.IdtipropiedadNavigation.Descripcion)
|
||||
.SetFechaInicio(cont.Fechainicio)
|
||||
.SetEstado(cont.Habilitado, cont.Cancelado)
|
||||
.Build();
|
||||
|
||||
var dof = new DocumentoFacade();
|
||||
MemoryStream? memstr = new();
|
||||
if (html){
|
||||
dof.GenerarHtml(cdb, can.IdreciboNavigation, memstr);
|
||||
return File(memstr, "text/html", "Recibo.html");
|
||||
} else {
|
||||
dof.GenerarPdf (cdb, can.IdreciboNavigation, memstr);
|
||||
return File(memstr, "application/pdf", "Recibo.pdf");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost("api/contratos/marcarPago")]
|
||||
public IActionResult marcarPago([FromHeader(Name="Auth")]string Auth, MarcarPagoDto dto) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioGrupos.Singleton.CheckGrupos(Auth, "Propietario");
|
||||
if (validacion1 == false)return Unauthorized();
|
||||
if (dto.Idcontrato<=0) return BadRequest(new { message = "No puede existir un contrato con id 0 o menor"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (cli == null)return Unauthorized();
|
||||
|
||||
Contrato? cont = RepositorioContratos.Singleton.ObtenerContratoPorId(dto.Idcontrato);
|
||||
if (cont == null) return BadRequest(new { message = "No hay un contrato por esa id"});
|
||||
|
||||
if (cli.Dni != cont.Dnipropietario) return BadRequest(new {message = "No sos propietario o intenta volviendote a logear"});
|
||||
|
||||
Canon? c = RepositorioCanons.Singleton.ObtenerCanonContrato(dto.fecha, dto.Idcontrato);
|
||||
if (c == null) return BadRequest(new { message = "no hay un canon por esa id"});
|
||||
|
||||
Recibo re = new Recibo{
|
||||
Monto = c.Monto,
|
||||
Fecha = 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,27 +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();
|
||||
}
|
||||
|
||||
[HttpGet("api/admin/grupos")]
|
||||
public IActionResult ListarGrupo(){
|
||||
return Ok(RepositorioGrupos.Singleton.Listar());
|
||||
}
|
||||
}
|
||||
|
||||
public record AdminGrupo(string descripcion);
|
||||
#endif
|
||||
@@ -26,13 +26,15 @@ public class InquilinoController: ControllerBase
|
||||
|
||||
[HttpPost("api/inquilino")]
|
||||
public IActionResult Post([FromBody] CrearClienteDto cid, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (!string.IsNullOrEmpty(Auth)) return BadRequest();
|
||||
if (string.IsNullOrEmpty(Auth)) return BadRequest(new {message = "El String Auth Esta Vacio"});
|
||||
var ret3 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 4);
|
||||
if (ret3 == false) return BadRequest(ret3);
|
||||
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);
|
||||
if (ret != "") return BadRequest(ret);
|
||||
if (ret != "") return BadRequest(new {message = ret});
|
||||
|
||||
var cli = new Cliente {
|
||||
Dni = cid.dni,
|
||||
@@ -41,11 +43,12 @@ public class InquilinoController: ControllerBase
|
||||
Apellido = cid.apellido,
|
||||
Celular = cid.celular,
|
||||
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);
|
||||
return (ret2) ? Ok() : BadRequest(ret);
|
||||
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"});
|
||||
}
|
||||
|
||||
private string verificarCrearUsuario(CrearClienteDto cid) {
|
||||
|
||||
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
|
||||
@@ -1,6 +1,5 @@
|
||||
using Entidades;
|
||||
using Entidades.Dto;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Modelo;
|
||||
|
||||
@@ -9,42 +8,150 @@ namespace AlquilaFacil.Controllers;
|
||||
[ApiController]
|
||||
public class PropiedadesController: ControllerBase {
|
||||
[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();
|
||||
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) 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);
|
||||
}
|
||||
|
||||
[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")]
|
||||
public IActionResult ObtenerPropiedadPorId(int Id, [FromHeader(Name = "Auth")] string Auth) {
|
||||
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 (Id < 0) return BadRequest("la id de propiedad no puede ser negativa");
|
||||
if (Id < 0) return BadRequest(new {message ="la id de propiedad no puede ser negativa"});
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.ObtenerPropiedadPorId(Id);
|
||||
if (ret == null) return BadRequest("No existe la propiedad");
|
||||
if (ret == null) return BadRequest(new {message ="No existe la propiedad"});
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedad/cantPagina")]
|
||||
public IActionResult ObtenerCantidadDePaginas([FromHeader(Name = "Auth")] string Auth, int estado = 0) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 10);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (estado < 0) return BadRequest(new {message = "No puede tener un numero menor a 0"});
|
||||
int cant;
|
||||
|
||||
if(estado == 0){
|
||||
cant = RepositorioPropiedades.Singleton.CuantasPaginas();
|
||||
}else{
|
||||
cant = RepositorioPropiedades.Singleton.CuantasPaginas(estado);
|
||||
}
|
||||
|
||||
return Ok(new {message = cant});
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedades/Propietario")]
|
||||
public IActionResult ObtenerPropiedadesPorPropietario (
|
||||
[FromBody] string email,
|
||||
[FromHeader(Name = "Email")] string email,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 12);
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
email = email.Trim();
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest("falta campo email");
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new {message ="falta campo email"});
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(email);
|
||||
IQueryable<PropiedadesDto> ret = RepositorioPropiedades.Singleton.ObtenerPropiedadesPorEmail(email);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpGet("api/propiedades/Propietario/Bajas")]
|
||||
public IActionResult ObtenerPropiedadesPorPropietarioBajas (
|
||||
[FromHeader(Name = "Email")] string email,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 8);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
email = email.Trim();
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new {message ="falta campo email"});
|
||||
|
||||
IQueryable<PropiedadesDto> ret = RepositorioPropiedades.Singleton.ObtenerPropiedadesDeBajaPorEmail(email);
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
@@ -58,80 +165,120 @@ public class PropiedadesController: ControllerBase {
|
||||
if (validacion2 != "") return BadRequest(new { message = validacion2 });
|
||||
|
||||
Cliente? cli = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(propiedad.Email);
|
||||
if (cli == null) return BadRequest("El email no corresponde a un propietario");
|
||||
if (cli == null) return BadRequest(new { message = "El email no corresponde a un propietario"});
|
||||
|
||||
Propiedade Prop = new Propiedade{
|
||||
Canthabitaciones = propiedad.Canthabitaciones,
|
||||
Dnipropietario = cli.Dni,
|
||||
Idtipropiedad = propiedad.Idtipropiedad,
|
||||
Ubicacion = propiedad.Ubicacion,
|
||||
Letra = propiedad.Letra != null ? propiedad.Letra : null,
|
||||
Piso = propiedad.Piso != null ? propiedad.Piso : null,
|
||||
Letra = propiedad.Letra ?? null,
|
||||
Piso = propiedad.Piso ?? null,
|
||||
Monto = propiedad.Monto,
|
||||
Iddivisa = propiedad.Iddivisa,
|
||||
};
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.AñadirPropiedad(Prop);
|
||||
return (ret)?
|
||||
Ok("Fue Cargado Correctamente") :
|
||||
BadRequest("Fallo al momento de añadir la propiedad a la base de datos");
|
||||
Ok(new { message = "Fue Cargado Correctamente"}) :
|
||||
BadRequest(new { message = "Fallo al momento de añadir la propiedad a la base de datos"});
|
||||
}
|
||||
|
||||
[HttpPatch("api/propiedad")]
|
||||
public IActionResult PatchPropiedad([FromBody] PatchPropiedadDto propiedad, [FromHeader(Name = "Auth")] string Auth) {
|
||||
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
string validacion2 = ValidarPropiedad(propiedad);
|
||||
if (validacion2 != "") return BadRequest(new { message = validacion2 });
|
||||
|
||||
Cliente? cli = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(propiedad.Email);
|
||||
if (cli == null) return BadRequest(new { message = "El email no corresponde a un propietario"});
|
||||
|
||||
List<Servicio> servs = RepositorioServicios.Singleton.ObtenerServiciosPorDescripcion(propiedad.Servicios);
|
||||
|
||||
Propiedade Prop = new Propiedade{
|
||||
Id = propiedad.id,
|
||||
Canthabitaciones = propiedad.Canthabitaciones,
|
||||
Dnipropietario = cli.Dni,
|
||||
Idtipropiedad = propiedad.tipo,
|
||||
Ubicacion = propiedad.Ubicacion,
|
||||
Letra = propiedad.Letra ?? null,
|
||||
Piso = propiedad.Piso ?? null,
|
||||
IdServicios = servs,
|
||||
Monto = propiedad.Monto,
|
||||
Iddivisa = propiedad.Iddivisa,
|
||||
};
|
||||
|
||||
bool ret = RepositorioPropiedades.Singleton.PatchPropiedad(Prop, cli.Dni);
|
||||
return (ret)?
|
||||
Ok(new {message = "Fue modificado Correctamente"}):
|
||||
BadRequest(new {message = "Fallo al modificar la base de datos"});
|
||||
}
|
||||
|
||||
[HttpDelete("api/propiedad")]
|
||||
public IActionResult BajaPropiedad(int id, [FromHeader(Name = "Auth")] string Auth){
|
||||
public IActionResult BajaPropiedad(int id, [FromHeader(Name = "Auth")] string Auth, [FromHeader(Name = "Email")] string email){
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (id <= 0) return BadRequest("No es una id valida");
|
||||
if (String.IsNullOrEmpty(email)) return BadRequest(new { message = "Fallo al identificarse el usuario"});
|
||||
if (id <= 0) return BadRequest(new { message = "No es una id valida"});
|
||||
|
||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id);
|
||||
Cliente? propie = RepositorioPropietario.Singleton.ObtenerPropietarioPorEmail(email);
|
||||
var ret = RepositorioPropiedades.Singleton.BajaPropiedad(id, propie);
|
||||
|
||||
return ret ?
|
||||
Ok(new {message = $"la propiedad con id {id} fue dada de baja"}):
|
||||
BadRequest("Fallo al dar de baja la propiedad");
|
||||
Ok(new { message = $"Se Cambio el estado de la propiedad con id {id}"}):
|
||||
BadRequest(new {message="Fallo al cambiar el estado de la propiedad"});
|
||||
}
|
||||
|
||||
[HttpPut("api/propiedades/addServicio")]
|
||||
public IActionResult AñadirServicio([FromBody] ServicioAPropiedadDto Servicios, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 8);
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (Servicios.propiedadid <= 0) return BadRequest("No puede tener una id negativa o cero");
|
||||
if (Servicios.idServicios.Count() < 1) return BadRequest("Falta añadir servicios");
|
||||
if (Servicios.idServicios.Any(x => x<= 0)) return BadRequest("No tienen haber ids negativas o cero de servicio");
|
||||
if (Servicios.propiedadid <= 0) return BadRequest(new {message ="No puede tener una id negativa o cero"});
|
||||
if (Servicios.idServicios.Count() < 1) return BadRequest(new {message ="Falta añadir servicios"});
|
||||
if (Servicios.idServicios.Any(x => x<= 0)) return BadRequest(new {message ="No tienen haber ids negativas o cero de servicio"});
|
||||
|
||||
var serv = RepositorioServicios.Singleton.ObtenerServiciosPorPropiedad(Servicios.propiedadid);
|
||||
|
||||
bool validacion2 = Servicios.idServicios.Any(x => serv.Contains(x));
|
||||
|
||||
if (validacion2 == true) return BadRequest("Hay elementos repetidos");
|
||||
if (validacion2 == true) return BadRequest(new {message ="Hay elementos repetidos"});
|
||||
|
||||
bool ret = RepositorioPropiedades.
|
||||
Singleton.AñadirServicioAPropiedad(Servicios.propiedadid, Servicios.idServicios);
|
||||
|
||||
return ret ?
|
||||
Ok("Los Servicios Se Cargaron correctamente a la propiedad") : BadRequest("No se pudo Cargar los Servicios a la propiedad");
|
||||
Ok(new {message ="Los Servicios Se Cargaron correctamente a la propiedad"}) : BadRequest(new {message ="No se pudo Cargar los Servicios a la propiedad"});
|
||||
|
||||
}
|
||||
|
||||
[HttpPut("api/propiedades/RmServicio")]
|
||||
public IActionResult EliminarServicio([FromBody] ServicioAPropiedadDto servicio, [FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 13);
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 2);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
if (servicio.propiedadid <= 0) return BadRequest("No puede tener una id negativa o cero");
|
||||
if (servicio.idServicios.Count() < 1) return BadRequest("Falta añadir servicios");
|
||||
if (servicio.idServicios.Any(x => x<= 0)) return BadRequest("No tienen haber ids negativas o cero de servicio");
|
||||
if (servicio.propiedadid <= 0) return BadRequest(new {message ="No puede tener una id negativa o cero"});
|
||||
if (servicio.idServicios.Count() < 1) return BadRequest(new {message ="Falta añadir servicios"});
|
||||
if (servicio.idServicios.Any(x => x<= 0)) return BadRequest(new {message ="No tienen haber ids negativas o cero de servicio"});
|
||||
|
||||
Cliente? cli = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
|
||||
var serv = RepositorioServicios.Singleton.ObtenerServiciosPorPropiedad(servicio.propiedadid);
|
||||
|
||||
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 ?
|
||||
Ok("Se Eliminaron los servicios seleccionados de la propiedad") : BadRequest("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"});
|
||||
|
||||
}
|
||||
|
||||
@@ -140,11 +287,40 @@ public class PropiedadesController: ControllerBase {
|
||||
|
||||
string ret = "";
|
||||
if (String.IsNullOrEmpty(prop.Email)) ret += "Falta Definir un email de propietario\n";
|
||||
|
||||
if (prop.Canthabitaciones < 0) ret += "No se puede tener una cantidad de habitaciones negativa\n";
|
||||
if (prop.Idtipropiedad <= 0) ret += "No tiene un tipo de propiedad asociada";
|
||||
|
||||
if (prop.Idtipropiedad <= 0) ret += "No tiene un tipo de propiedad asociada\n";
|
||||
|
||||
if (String.IsNullOrEmpty(prop.Ubicacion)) ret += "Tiene que definir la ubicacion de la propiedad\n";
|
||||
|
||||
if (prop.Monto<=1) ret += "El monto tiene que ser como minimo mayor a 0";
|
||||
|
||||
if (prop.Iddivisa<0 || prop.Iddivisa>1) ret += "se tiene que elejir entre AR$ y US$";
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
private string ValidarPropiedad(PatchPropiedadDto prop) {
|
||||
if (prop == null) return "Esta mal formado el body de la request";
|
||||
|
||||
string ret = "";
|
||||
if (prop.id <1) ret += "No Cargo el dato de id";
|
||||
if (String.IsNullOrEmpty(prop.Email)) ret += "Falta Definir un email de propietario\n";
|
||||
|
||||
if (prop.id <1 ) ret += "No puede haber una id menor a 1\n";
|
||||
|
||||
if (prop.Canthabitaciones < 0) ret += "No se puede tener una cantidad de habitaciones negativa\n";
|
||||
|
||||
if (prop.tipo <= 0) ret += "No tiene un tipo de propiedad asociada\n";
|
||||
|
||||
if (String.IsNullOrEmpty(prop.Ubicacion)) ret += "Tiene que definir la ubicacion de la propiedad\n";
|
||||
|
||||
if (prop.Monto<=1) ret += "El monto tiene que ser como minimo mayor a 0";
|
||||
|
||||
if (prop.Iddivisa<0 || prop.Iddivisa>1) ret += "se tiene que elejir entre AR$ y US$";
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,13 +21,16 @@ public class PropietarioController: ControllerBase {
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
[HttpPost("api/propietarios")]
|
||||
[HttpPost("api/propietario")]
|
||||
public IActionResult AltaPropietario([FromBody]CrearClienteDto Propietario,
|
||||
[FromHeader(Name = "Auth")] string Auth) {
|
||||
if (String.IsNullOrEmpty(Auth)) return Unauthorized();
|
||||
var validacion1 = RepositorioPermisos.Singleton.CheckPermisos(Auth, 5);
|
||||
if (validacion1 == false) return Unauthorized();
|
||||
|
||||
Cliente? rep = RepositorioUsuarios.Singleton.ObtenerClientePorToken(Auth);
|
||||
if (rep == null) return Unauthorized();
|
||||
|
||||
string validacion2 = verificarCrearUsuario(Propietario);
|
||||
if (validacion2 != "") return BadRequest(validacion2);
|
||||
|
||||
@@ -38,10 +41,11 @@ public class PropietarioController: ControllerBase {
|
||||
Apellido = Propietario.apellido,
|
||||
Celular = Propietario.celular,
|
||||
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 ?
|
||||
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);
|
||||
|
||||
|
||||
MinioConfigcus? mcon = JsonSerializer.Deserialize<MinioConfigcus>(File.ReadAllText("./settings.json"))?? null;
|
||||
if (mcon == null) return;
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddMinio(options => options
|
||||
.WithCredentials(mcon.usr, mcon.scrt)
|
||||
.WithEndpoint("127.0.0.0:9000")
|
||||
.WithSSL(false)
|
||||
.Build());
|
||||
|
||||
builder.Services.Configure<FormOptions>(options =>
|
||||
{
|
||||
options.MultipartBodyLengthLimit = 50 * 1024 * 1024; // 50 MB
|
||||
});
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
|
||||
29
Aspnet/Strategy/Busqueda/BusquedaContext.cs
Normal file
29
Aspnet/Strategy/Busqueda/BusquedaContext.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace AlquilaFacil.StrategyBusqueda;
|
||||
|
||||
public class BusquedaContext
|
||||
{
|
||||
private static readonly BusquedaContext singleton = new();
|
||||
public static BusquedaContext Singleton {get { return singleton; } }
|
||||
|
||||
private readonly Dictionary<string, IBusquedaStrategy> _estrategias;
|
||||
|
||||
public BusquedaContext()
|
||||
{
|
||||
_estrategias = new Dictionary<string, IBusquedaStrategy>
|
||||
{
|
||||
{ "000", new BusquedaSinParametros() },
|
||||
{ "100", new BusquedaPorHabitaciones() },
|
||||
{ "010", new BusquedaPorTipo() },
|
||||
{ "001", new BusquedaPorServicios() },
|
||||
{ "110", new BusquedaPorHabitacionesTipo() },
|
||||
{ "101", new BusquedaPorHabitacionesServicios() },
|
||||
{ "011", new BusquedaTipoServicios() },
|
||||
{ "111", new BusquedaFull() }
|
||||
};
|
||||
}
|
||||
|
||||
public IBusquedaStrategy ObtenerEstrategia(string clave)
|
||||
{
|
||||
return _estrategias.ContainsKey(clave) ? _estrategias[clave] : new BusquedaSinParametros();
|
||||
}
|
||||
}
|
||||
52
Aspnet/Strategy/Busqueda/Filtros.cs
Normal file
52
Aspnet/Strategy/Busqueda/Filtros.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Entidades.Dto;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.StrategyBusqueda;
|
||||
|
||||
public class BusquedaSinParametros : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ListarPropiedades();
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitaciones : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones(cantidadHabitaciones);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorTipo : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo(tipoPropiedad);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorServicios : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorServicios(servicios);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesTipo : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo(cantidadHabitaciones, tipoPropiedad);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesServicios : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Servicios(cantidadHabitaciones, servicios);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaTipoServicios : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo_Servicios(tipoPropiedad, servicios);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaFull : IBusquedaStrategy {
|
||||
public IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo_Servicios(cantidadHabitaciones, tipoPropiedad, servicios);
|
||||
}
|
||||
}
|
||||
6
Aspnet/Strategy/Busqueda/IBusquedaStrategy.cs
Normal file
6
Aspnet/Strategy/Busqueda/IBusquedaStrategy.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace AlquilaFacil.StrategyBusqueda;
|
||||
using Entidades.Dto;
|
||||
public interface IBusquedaStrategy {
|
||||
IQueryable<PropiedadesDto> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad);
|
||||
}
|
||||
|
||||
29
Aspnet/Strategy/BusquedaAdmin/AdminBusquedaContext.cs
Normal file
29
Aspnet/Strategy/BusquedaAdmin/AdminBusquedaContext.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace AlquilaFacil.StrategyBusquedaAdmin;
|
||||
|
||||
public class AdminBusquedaContext
|
||||
{
|
||||
private static readonly AdminBusquedaContext singleton = new();
|
||||
public static AdminBusquedaContext Singleton {get { return singleton; } }
|
||||
|
||||
private readonly Dictionary<string, IAdminBusquedaStrategy> _estrategias;
|
||||
|
||||
public AdminBusquedaContext()
|
||||
{
|
||||
_estrategias = new Dictionary<string, IAdminBusquedaStrategy>
|
||||
{
|
||||
{ "000", new BusquedaSinParametros() },
|
||||
{ "100", new BusquedaPorHabitaciones() },
|
||||
{ "010", new BusquedaPorTipo() },
|
||||
{ "001", new BusquedaPorServicios() },
|
||||
{ "110", new BusquedaPorHabitacionesTipo() },
|
||||
{ "101", new BusquedaPorHabitacionesServicios() },
|
||||
{ "011", new BusquedaTipoServicios() },
|
||||
{ "111", new BusquedaFull() }
|
||||
};
|
||||
}
|
||||
|
||||
public IAdminBusquedaStrategy ObtenerEstrategia(string clave)
|
||||
{
|
||||
return _estrategias.ContainsKey(clave) ? _estrategias[clave] : new BusquedaSinParametros();
|
||||
}
|
||||
}
|
||||
52
Aspnet/Strategy/BusquedaAdmin/Filtros.cs
Normal file
52
Aspnet/Strategy/BusquedaAdmin/Filtros.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Entidades.Admin;
|
||||
using Modelo;
|
||||
|
||||
namespace AlquilaFacil.StrategyBusquedaAdmin;
|
||||
|
||||
public class BusquedaSinParametros : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ListarPropiedadesPorPaginaAdmin(pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitaciones : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitacionesPaginado(cantidadHabitaciones, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorTipo : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipoPaginado(tipoPropiedad, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorServicios : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorServiciosPaginado(servicios, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesTipo : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_TipoPaginado(cantidadHabitaciones, tipoPropiedad, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaPorHabitacionesServicios : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Servicios_Paginado(cantidadHabitaciones, servicios, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaTipoServicios : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorTipo_Servicios_Paginado(tipoPropiedad, servicios, pag);
|
||||
}
|
||||
}
|
||||
|
||||
public class BusquedaFull : IAdminBusquedaStrategy {
|
||||
public IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag) {
|
||||
return RepositorioPropiedades.Singleton.ObtenerPropiedesPorHabitaciones_Tipo_Servicios_Paginado(cantidadHabitaciones, tipoPropiedad, servicios, pag);
|
||||
}
|
||||
}
|
||||
6
Aspnet/Strategy/BusquedaAdmin/IAdminBusquedaStrategy.cs
Normal file
6
Aspnet/Strategy/BusquedaAdmin/IAdminBusquedaStrategy.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace AlquilaFacil.StrategyBusquedaAdmin;
|
||||
using Entidades.Admin;
|
||||
public interface IAdminBusquedaStrategy {
|
||||
IQueryable<PropiedadesAdmin> Filtrar(string servicios, int cantidadHabitaciones, int tipoPropiedad, int pag);
|
||||
}
|
||||
|
||||
4
Aspnet/bin/Debug/net8.0/settings.json
Normal file
4
Aspnet/bin/Debug/net8.0/settings.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usr":"nwFNMLJcn5m0owbzeXMs",
|
||||
"scrt":"Mf9HxTir5mIGwWSBtQXd6DRK2k00V0EyXk7QTu70"
|
||||
}
|
||||
4
Aspnet/settings.json
Normal file
4
Aspnet/settings.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usr":"nwFNMLJcn5m0owbzeXMs",
|
||||
"scrt":"Mf9HxTir5mIGwWSBtQXd6DRK2k00V0EyXk7QTu70"
|
||||
}
|
||||
2
Entidades/Admin/EmailGrupo.cs
Normal file
2
Entidades/Admin/EmailGrupo.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
namespace Entidades.Admin;
|
||||
public record EmailGrupo(string email, string grupo);
|
||||
7
Entidades/Admin/GrupoAdmin.cs
Normal file
7
Entidades/Admin/GrupoAdmin.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Entidades.Admin;
|
||||
|
||||
public class GrupoAdmin {
|
||||
public int Id {get; set;} = 0;
|
||||
public String Descripcion {get; set;} = "";
|
||||
public List<Entidades.Admin.PermisoAdmin> Permisos {get; set;} = new();
|
||||
}
|
||||
6
Entidades/Admin/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;}
|
||||
}
|
||||
6
Entidades/Admin/PermisosAdmin.cs
Normal file
6
Entidades/Admin/PermisosAdmin.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Admin;
|
||||
|
||||
public class PermisoAdmin {
|
||||
public int Id {get; set;}
|
||||
public String Descripcion {get; set;} = "";
|
||||
}
|
||||
13
Entidades/Admin/PropiedadesAdmin.cs
Normal file
13
Entidades/Admin/PropiedadesAdmin.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Entidades.Admin;
|
||||
public class PropiedadesAdmin {
|
||||
public int id { get; set; }
|
||||
public string Ubicacion { get; set; } = "";
|
||||
public int canthabitaciones { get; set; }
|
||||
public int piso { get; set; }
|
||||
public string letra { get; set; } = "";
|
||||
public string Tipo { get; set; } = "";
|
||||
public string? Servicios {get;set;} = "";
|
||||
public int Monto { get; set; }
|
||||
public string Estado { get; set; } = "";
|
||||
public int Iddivisa { get; set; }
|
||||
}
|
||||
8
Entidades/Admin/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!;
|
||||
|
||||
}
|
||||
8
Entidades/Admin/UsuarioAdmin.cs
Normal file
8
Entidades/Admin/UsuarioAdmin.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Admin;
|
||||
|
||||
public record UsuarioAdmin {
|
||||
public long Dni { get; set; } = 0;
|
||||
public string Nombre { get; set; } = "";
|
||||
public string Email { get; set; } = "";
|
||||
public ulong Habilitado { get; set; }
|
||||
}
|
||||
@@ -23,6 +23,8 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
public virtual DbSet<Defecto> Defectos { get; set; }
|
||||
|
||||
public virtual DbSet<Divisa> Divisas { get; set; }
|
||||
|
||||
public virtual DbSet<EstadoPropiedad> EstadoPropiedads { get; set; }
|
||||
|
||||
public virtual DbSet<Estadodefecto> Estadodefectos { get; set; }
|
||||
@@ -33,6 +35,12 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
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<Propiedade> Propiedades { get; set; }
|
||||
@@ -47,7 +55,7 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
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.
|
||||
=> 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)
|
||||
{
|
||||
@@ -151,9 +159,14 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idventa, "FK_CON_VEN");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_contdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Cancelado)
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("cancelado");
|
||||
entity.Property(e => e.Cantgarantemin)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("cantgarantemin");
|
||||
@@ -169,6 +182,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Habilitado)
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("habilitado");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idpropiedad)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idpropiedad");
|
||||
@@ -178,12 +194,17 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Indiceactualizacion)
|
||||
.HasPrecision(8)
|
||||
.HasColumnName("indiceactualizacion");
|
||||
entity.Property(e => e.MesesDurationContrato).HasColumnType("int(11)");
|
||||
entity.Property(e => e.MesesHastaAumento).HasColumnType("int(11)");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasPrecision(12)
|
||||
.HasColumnName("monto");
|
||||
entity.Property(e => e.Tieneopcionventa)
|
||||
.HasColumnType("bit(1)")
|
||||
.HasColumnName("tieneopcionventa");
|
||||
entity.Property(e => e.UrlContrato)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("urlContrato");
|
||||
|
||||
entity.HasOne(d => d.DniinquilinoNavigation).WithMany(p => p.ContratoDniinquilinoNavigations)
|
||||
.HasForeignKey(d => d.Dniinquilino)
|
||||
@@ -195,6 +216,11 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_CON_PROPI");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_contdiv");
|
||||
|
||||
entity.HasOne(d => d.IdpropiedadNavigation).WithMany(p => p.Contratos)
|
||||
.HasForeignKey(d => d.Idpropiedad)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
@@ -240,6 +266,8 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idestado, "FK_DEF_EST");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_defdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("id");
|
||||
@@ -247,11 +275,14 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasPrecision(12)
|
||||
.HasColumnName("costo");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(40)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("descripcion");
|
||||
entity.Property(e => e.Idcontrato)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("idcontrato");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idestado)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idestado");
|
||||
@@ -264,12 +295,29 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_DEF_CON");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Defectos)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_defdiv");
|
||||
|
||||
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Defectos)
|
||||
.HasForeignKey(d => d.Idestado)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_DEF_EST");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Divisa>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Signo)
|
||||
.HasMaxLength(3)
|
||||
.HasColumnName("signo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<EstadoPropiedad>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
@@ -280,7 +328,7 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(11)
|
||||
.HasMaxLength(30)
|
||||
.HasColumnName("descripcion");
|
||||
});
|
||||
|
||||
@@ -312,17 +360,20 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
modelBuilder.Entity<Garante>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Dni).HasName("PRIMARY");
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
|
||||
entity.Property(e => e.Dni)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dni");
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Apellido)
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("apellido");
|
||||
entity.Property(e => e.Celular)
|
||||
.HasMaxLength(40)
|
||||
.HasColumnName("celular");
|
||||
entity.Property(e => e.Dni)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dni");
|
||||
entity.Property(e => e.Domicilio)
|
||||
.HasMaxLength(40)
|
||||
.HasColumnName("domicilio");
|
||||
@@ -333,7 +384,7 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("nombre");
|
||||
|
||||
entity.HasMany(d => d.Idcontratos).WithMany(p => p.Dnigarantes)
|
||||
entity.HasMany(d => d.Idcontratos).WithMany(p => p.Idgarantes)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"ContratoGarante",
|
||||
r => r.HasOne<Contrato>().WithMany()
|
||||
@@ -341,17 +392,17 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_CONGAR_CON"),
|
||||
l => l.HasOne<Garante>().WithMany()
|
||||
.HasForeignKey("Dnigarante")
|
||||
.HasForeignKey("Idgarante")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_CONGAR_GAR"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Dnigarante", "Idcontrato").HasName("PRIMARY");
|
||||
j.HasKey("Idgarante", "Idcontrato").HasName("PRIMARY");
|
||||
j.ToTable("contrato_garantes");
|
||||
j.HasIndex(new[] { "Idcontrato" }, "FK_CONGAR_CON");
|
||||
j.IndexerProperty<long>("Dnigarante")
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dnigarante");
|
||||
j.IndexerProperty<int>("Idgarante")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idgarante");
|
||||
j.IndexerProperty<long>("Idcontrato")
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("idcontrato");
|
||||
@@ -370,6 +421,106 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.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 =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
@@ -378,7 +529,7 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Descripcion)
|
||||
.HasMaxLength(15)
|
||||
.HasMaxLength(25)
|
||||
.HasColumnName("descripcion");
|
||||
|
||||
entity.HasMany(d => d.Idgrupos).WithMany(p => p.Idpermisos)
|
||||
@@ -416,6 +567,8 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idtipropiedad, "FK_PROP_TIPO");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_propdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("id");
|
||||
@@ -425,6 +578,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Dnipropietario)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("dnipropietario");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idestado)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idestado");
|
||||
@@ -435,6 +591,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.HasMaxLength(1)
|
||||
.IsFixedLength()
|
||||
.HasColumnName("letra");
|
||||
entity.Property(e => e.Monto)
|
||||
.HasPrecision(10)
|
||||
.HasColumnName("monto");
|
||||
entity.Property(e => e.Piso)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("piso");
|
||||
@@ -447,6 +606,11 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_PROP_PROPI");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Propiedades)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_propdiv");
|
||||
|
||||
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Propiedades)
|
||||
.HasForeignKey(d => d.Idestado)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
@@ -537,6 +701,8 @@ public partial class AlquilaFacilContext : DbContext
|
||||
|
||||
entity.HasIndex(e => e.Idpropiedad, "FK_VEN_PROP");
|
||||
|
||||
entity.HasIndex(e => e.Iddivisa, "FK_ventdiv");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("id");
|
||||
@@ -552,6 +718,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.IdVendedor)
|
||||
.HasColumnType("bigint(20)")
|
||||
.HasColumnName("idVendedor");
|
||||
entity.Property(e => e.Iddivisa)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("iddivisa");
|
||||
entity.Property(e => e.Idestado)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("idestado");
|
||||
@@ -561,6 +730,9 @@ public partial class AlquilaFacilContext : DbContext
|
||||
entity.Property(e => e.Monto)
|
||||
.HasPrecision(12)
|
||||
.HasColumnName("monto");
|
||||
entity.Property(e => e.UrlRecibo)
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("urlRecibo");
|
||||
|
||||
entity.HasOne(d => d.IdCompradorNavigation).WithMany(p => p.VentaIdCompradorNavigations)
|
||||
.HasForeignKey(d => d.IdComprador)
|
||||
@@ -572,6 +744,11 @@ public partial class AlquilaFacilContext : DbContext
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_VEN_PROL");
|
||||
|
||||
entity.HasOne(d => d.IddivisaNavigation).WithMany(p => p.Venta)
|
||||
.HasForeignKey(d => d.Iddivisa)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.HasConstraintName("FK_ventdiv");
|
||||
|
||||
entity.HasOne(d => d.IdestadoNavigation).WithMany(p => p.Venta)
|
||||
.HasForeignKey(d => d.Idestado)
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
|
||||
@@ -27,6 +27,12 @@ public partial class Cliente
|
||||
|
||||
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<Venta> VentaIdCompradorNavigations { get; set; } = new List<Venta>();
|
||||
|
||||
@@ -27,17 +27,29 @@ public partial class Contrato
|
||||
|
||||
public ulong Habilitado { get; set; }
|
||||
|
||||
public int MesesHastaAumento { get; set; }
|
||||
|
||||
public string? UrlContrato { get; set; }
|
||||
|
||||
public ulong Cancelado { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public int MesesDurationContrato { get; set; }
|
||||
|
||||
public virtual ICollection<Defecto> Defectos { get; set; } = new List<Defecto>();
|
||||
|
||||
public virtual Cliente? DniinquilinoNavigation { get; set; }
|
||||
|
||||
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
||||
|
||||
public virtual Venta? IdventaNavigation { get; set; }
|
||||
|
||||
public virtual ICollection<Garante> Dnigarantes { get; set; } = new List<Garante>();
|
||||
|
||||
public virtual ICollection<Canon> Idcanons { get; set; } = new List<Canon>();
|
||||
|
||||
public virtual ICollection<Garante> Idgarantes { get; set; } = new List<Garante>();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@ public partial class Defecto
|
||||
|
||||
public ulong Pagainquilino { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public virtual Contrato? IdcontratoNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Estadodefecto? IdestadoNavigation { get; set; }
|
||||
}
|
||||
|
||||
19
Entidades/Divisa.cs
Normal file
19
Entidades/Divisa.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
public partial class Divisa
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Signo { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual ICollection<Defecto> Defectos { get; set; } = new List<Defecto>();
|
||||
|
||||
public virtual ICollection<Propiedade> Propiedades { get; set; } = new List<Propiedade>();
|
||||
|
||||
public virtual ICollection<Venta> Venta { get; set; } = new List<Venta>();
|
||||
}
|
||||
2
Entidades/Dto/AccionesDeGrupo.cs
Normal file
2
Entidades/Dto/AccionesDeGrupo.cs
Normal file
@@ -0,0 +1,2 @@
|
||||
namespace Entidades.Dto;
|
||||
public record AccionesPorGrupoDto(string Email, string Grupo);
|
||||
5
Entidades/Dto/AceptarContratoDto.cs
Normal file
5
Entidades/Dto/AceptarContratoDto.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AceptarContratoDto {
|
||||
public long Idcontrato { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
}
|
||||
8
Entidades/Dto/AltaDefectoDto.cs
Normal file
8
Entidades/Dto/AltaDefectoDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AltaDefectoDto {
|
||||
public string Descripcion { get; set; } ="";
|
||||
public Decimal Costo { get; set; }
|
||||
public ulong Pagainquilino { get; set; }
|
||||
public int Iddivisa { get; set; }
|
||||
public long Idcontrato { get; set; }
|
||||
}
|
||||
9
Entidades/Dto/AltaGarantesDto.cs
Normal file
9
Entidades/Dto/AltaGarantesDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public class AltaGarantesDto {
|
||||
public string EmailInquilino { get; set; } = "";
|
||||
public int Idpropiedad {get; set;}
|
||||
public DateTime fecha { get; set;}
|
||||
public List<GaranteDto> garantes{ get; set; } = new();
|
||||
|
||||
}
|
||||
7
Entidades/Dto/AltaNotificacionDto.cs
Normal file
7
Entidades/Dto/AltaNotificacionDto.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AltaNotificacionDto {
|
||||
public string Remitente { get; set; } ="";
|
||||
public string Accion { get; set; } ="";
|
||||
public string Mensaje { get; set; } ="";
|
||||
public int Propiedad { get; set;}
|
||||
}
|
||||
@@ -6,4 +6,6 @@ public class AltaPropiedadDto {
|
||||
public string? Letra { get; set; } = null;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public int Idtipropiedad { get; set; }
|
||||
public int Monto { get; set; }
|
||||
public int Iddivisa { get; set; }
|
||||
}
|
||||
5
Entidades/Dto/AvisoInquilinoDto.cs
Normal file
5
Entidades/Dto/AvisoInquilinoDto.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Entidades.Dto;
|
||||
public class AvisoInquilinoDto {
|
||||
public string Mensaje { get; set; } ="";
|
||||
public long Idpropiedad { get; set; }
|
||||
}
|
||||
3
Entidades/Dto/BusquedaDto.cs
Normal file
3
Entidades/Dto/BusquedaDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public record BusquedaDto(int Id, string Ubicacion, string? Servicios = "");
|
||||
8
Entidades/Dto/CancelarPrecontratoDto.cs
Normal file
8
Entidades/Dto/CancelarPrecontratoDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Dto;
|
||||
public class CancelarPrecontratoDto {
|
||||
public string EmailPropietario { get; set; } ="";
|
||||
public string EmailInquilino { get; set; } ="";
|
||||
public DateTime fecha { get; set; }
|
||||
|
||||
public int idpropiedad { get; set; } = 0;
|
||||
}
|
||||
10
Entidades/Dto/CanonDto.cs
Normal file
10
Entidades/Dto/CanonDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Entidades.Dto;
|
||||
public class CanonDto{
|
||||
public long Id { get; set;}
|
||||
public int MesNum { get; set;}
|
||||
public DateTime Mes { get; set;}
|
||||
public Decimal Monto { get; set;}
|
||||
public string Divisa { get; set;} = "";
|
||||
public bool Pago { get; set;}
|
||||
|
||||
}
|
||||
23
Entidades/Dto/Chart/Chartjs.cs
Normal file
23
Entidades/Dto/Chart/Chartjs.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
public class ChartData
|
||||
{
|
||||
[JsonPropertyName("labels")]
|
||||
public List<string> Labels { get; set; }=new();
|
||||
|
||||
[JsonPropertyName("datasets")]
|
||||
public List<Dataset> Datasets { get; set; }=new();
|
||||
}
|
||||
|
||||
public class Dataset
|
||||
{
|
||||
[JsonPropertyName("label")]
|
||||
public string Label { get; set; } ="";
|
||||
|
||||
[JsonPropertyName("data")]
|
||||
public List<string> Data { get; set; }= new();
|
||||
|
||||
[JsonPropertyName("borderWidth")]
|
||||
public int BorderWidth { get; set; }=1;
|
||||
}
|
||||
11
Entidades/Dto/ContratoDto.cs
Normal file
11
Entidades/Dto/ContratoDto.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace Entidades.Dto;
|
||||
public class ContratoDto {
|
||||
public long id { get; set; }
|
||||
public string Ubicacion { get; set; }="";
|
||||
public string TipoPropiedad { get; set; }="";
|
||||
public DateTime Fechainicio { get; set; }
|
||||
public string Inquilino { get; set; }="";
|
||||
public string Propietario { get; set; }="";
|
||||
public string Estado {get; set;}="";
|
||||
|
||||
}
|
||||
8
Entidades/Dto/ContratoPropiedadDto.cs
Normal file
8
Entidades/Dto/ContratoPropiedadDto.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Entidades.Dto;
|
||||
public class ContratoPropiedadDto : ContratoDto {
|
||||
public int Habitaciones { get; set; }
|
||||
public int Piso { get; set;}
|
||||
public string Letra { get; set; } = "";
|
||||
public int MesesAumento { get; set; }
|
||||
public int MesesDuracion { get; set; }
|
||||
}
|
||||
6
Entidades/Dto/CrearCanonsDto.cs
Normal file
6
Entidades/Dto/CrearCanonsDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public class CrearCanonsDto {
|
||||
public long idcontrato{ get; set; }
|
||||
public decimal aumento{ get; set; }
|
||||
}
|
||||
10
Entidades/Dto/DefectoDto.cs
Normal file
10
Entidades/Dto/DefectoDto.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Entidades.Dto;
|
||||
public class DefectoDto {
|
||||
public long Id { get; set;}
|
||||
public string Descripcion { get; set;} ="";
|
||||
public Decimal Costo { get; set;}
|
||||
public string Estado { get; set;} ="";
|
||||
public long Idcontrato { get; set;}
|
||||
public string Pagainquilino { get; set;} ="";
|
||||
public string Divisa { get; set;} ="";
|
||||
}
|
||||
16
Entidades/Dto/GaranteDto.cs
Normal file
16
Entidades/Dto/GaranteDto.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public class GaranteDto {
|
||||
public long Dni { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
public string Apellido { get; set; } = null!;
|
||||
|
||||
public string Domicilio { get; set; } = null!;
|
||||
|
||||
public string Celular { get; set; } = null!;
|
||||
|
||||
public string Domiciliolaboral { get; set; } = null!;
|
||||
|
||||
}
|
||||
6
Entidades/Dto/MarcarPagoDto.cs
Normal file
6
Entidades/Dto/MarcarPagoDto.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Dto;
|
||||
public class MarcarPagoDto {
|
||||
public long Idcontrato { get; set; }
|
||||
public DateTime fecha { get; set; }
|
||||
|
||||
}
|
||||
9
Entidades/Dto/NotificacionDto.cs
Normal file
9
Entidades/Dto/NotificacionDto.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Entidades.Dto;
|
||||
public class NotificacionDto {
|
||||
public string Remitente { get; set; } ="";
|
||||
public string Accion { get; set; } ="";
|
||||
public string Receptor { get; set; } ="";
|
||||
public string Mensaje { get; set; } ="";
|
||||
public DateTime? Fecha{get; set;} =null;
|
||||
public string Propiedad { get; set;} ="";
|
||||
}
|
||||
1
Entidades/Dto/NotificacionMarcarLeidoDto.cs
Normal file
1
Entidades/Dto/NotificacionMarcarLeidoDto.cs
Normal file
@@ -0,0 +1 @@
|
||||
public record NotificacionMarcarLeidoDto(DateTime? Fecha, string Email);
|
||||
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; }
|
||||
}
|
||||
3
Entidades/Dto/PatchPropiedadDto.cs
Normal file
3
Entidades/Dto/PatchPropiedadDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace Entidades.Dto;
|
||||
|
||||
public record PatchPropiedadDto(int id, string Ubicacion, int Canthabitaciones, int? Piso, string? Letra, string Email, int tipo, List<string> Servicios, int Monto, int Iddivisa);
|
||||
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; }
|
||||
}
|
||||
@@ -3,7 +3,10 @@ public class PropiedadesDto {
|
||||
public int id { get; set; }
|
||||
public string Ubicacion { get; set; } = "";
|
||||
public int canthabitaciones { get; set; }
|
||||
public string piso { get; set; } = "";
|
||||
public int piso { get; set; }
|
||||
public string letra { get; set; } = "";
|
||||
public string TipoPropiedad { get; set; } = "";
|
||||
}
|
||||
public string Tipo { get; set; } = "";
|
||||
public string? Servicios {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 int Id { get; set; }
|
||||
|
||||
public long Dni { get; set; }
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Entidades;
|
||||
|
||||
@@ -9,6 +10,7 @@ public partial class Grupo
|
||||
|
||||
public string Nombre { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Cliente> Idclientes { get; set; } = new List<Cliente>();
|
||||
|
||||
public virtual ICollection<Permiso> Idpermisos { get; set; } = new List<Permiso>();
|
||||
|
||||
6
Entidades/Informes/InfomesAlquiler.cs
Normal file
6
Entidades/Informes/InfomesAlquiler.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Entidades.Informes;
|
||||
public class InformesAlquiler {
|
||||
public long Id { get; set; }
|
||||
public string Ubicacion { get; set; }="";
|
||||
public string Divisa { get; set; }="";
|
||||
}
|
||||
17
Entidades/Informes/InformeMeses.cs
Normal file
17
Entidades/Informes/InformeMeses.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Entidades.Informes;
|
||||
public class InformesMeses {
|
||||
public int Meses { get; set; }
|
||||
public int Repes{ get; set; }
|
||||
public string Semaforizacion {get {
|
||||
switch(Repes.CompareTo(2)){
|
||||
case 1:
|
||||
return "🟢";
|
||||
case 0:
|
||||
return "🟡";
|
||||
case -1:
|
||||
return "🔴";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}}
|
||||
}
|
||||
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 string? Descripcion { get; set; }
|
||||
public string Descripcion { get; set; } = null!;
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<Grupo> Idgrupos { get; set; } = new List<Grupo>();
|
||||
|
||||
@@ -21,14 +21,22 @@ public partial class Propiedade
|
||||
|
||||
public int? Idestado { get; set; }
|
||||
|
||||
public decimal Monto { get; set; }
|
||||
|
||||
public int Iddivisa { get; set; }
|
||||
|
||||
public virtual ICollection<Contrato> Contratos { get; set; } = new List<Contrato>();
|
||||
|
||||
public virtual Cliente? DnipropietarioNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual EstadoPropiedad? IdestadoNavigation { get; set; }
|
||||
|
||||
public virtual TipoPropiedad IdtipropiedadNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Notificacione> Notificaciones { get; set; } = new List<Notificacione>();
|
||||
|
||||
public virtual ICollection<Venta> Venta { get; set; } = new List<Venta>();
|
||||
|
||||
public virtual ICollection<Servicio> IdServicios { get; set; } = new List<Servicio>();
|
||||
|
||||
@@ -17,16 +17,22 @@ public partial class Venta
|
||||
|
||||
public int? Idpropiedad { get; set; }
|
||||
|
||||
public DateTime Fechainicio { get; set; }
|
||||
public DateTime? Fechainicio { 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 Cliente? IdCompradorNavigation { get; set; }
|
||||
|
||||
public virtual Cliente? IdVendedorNavigation { get; set; }
|
||||
|
||||
public virtual Divisa IddivisaNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Estadoventa? IdestadoNavigation { get; set; }
|
||||
|
||||
public virtual Propiedade? IdpropiedadNavigation { get; set; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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
|
||||
|
||||
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 XDG_SESSION_PATH: string;
|
||||
export const XDG_MENU_PREFIX: string;
|
||||
export const ICEAUTHORITY: string;
|
||||
export const LANGUAGE: string;
|
||||
export const NODE: string;
|
||||
export const LC_ADDRESS: string;
|
||||
export const LC_NAME: string;
|
||||
export const SSH_AUTH_SOCK: string;
|
||||
export const GRADLE_HOME: string;
|
||||
export const SHELL_SESSION_ID: string;
|
||||
export const MEMORY_PRESSURE_WRITE: string;
|
||||
export const XDG_CONFIG_HOME: string;
|
||||
export const npm_config_local_prefix: string;
|
||||
export const DESKTOP_SESSION: string;
|
||||
export const LC_MONETARY: string;
|
||||
export const GTK_RC_FILES: string;
|
||||
export const SSH_AGENT_PID: string;
|
||||
export const EDITOR: string;
|
||||
export const GTK_MODULES: string;
|
||||
export const XDG_SEAT: string;
|
||||
export const PWD: string;
|
||||
export const XDG_SESSION_DESKTOP: string;
|
||||
export const LOGNAME: string;
|
||||
export const XDG_SESSION_DESKTOP: string;
|
||||
export const XDG_SESSION_TYPE: string;
|
||||
export const BUN_WHICH_IGNORE_CWD: string;
|
||||
export const SYSTEMD_EXEC_PID: string;
|
||||
export const PANEL_GDK_CORE_DEVICE_EVENTS: string;
|
||||
export const _: string;
|
||||
export const XAUTHORITY: string;
|
||||
export const XDG_GREETER_DATA_DIR: string;
|
||||
export const MOTD_SHOWN: string;
|
||||
export const GTK2_RC_FILES: string;
|
||||
export const GDM_LANG: string;
|
||||
export const HOME: string;
|
||||
export const LC_PAPER: string;
|
||||
export const LANG: string;
|
||||
export const LS_COLORS: string;
|
||||
export const XDG_CURRENT_DESKTOP: string;
|
||||
export const KONSOLE_DBUS_SERVICE: string;
|
||||
export const npm_package_version: string;
|
||||
export const MEMORY_PRESSURE_WATCH: string;
|
||||
export const WAYLAND_DISPLAY: string;
|
||||
export const KONSOLE_DBUS_SESSION: string;
|
||||
export const PROFILEHOME: string;
|
||||
export const VTE_VERSION: string;
|
||||
export const XDG_SEAT_PATH: string;
|
||||
export const INVOCATION_ID: 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_CACHE_HOME: string;
|
||||
export const XDG_SESSION_CLASS: string;
|
||||
export const TERM: string;
|
||||
export const LC_IDENTIFICATION: string;
|
||||
export const npm_package_name: string;
|
||||
export const ZSH: 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 DISPLAY: string;
|
||||
export const npm_lifecycle_event: string;
|
||||
export const SHLVL: string;
|
||||
export const PAGER: string;
|
||||
export const LC_TELEPHONE: string;
|
||||
@@ -101,19 +89,17 @@ declare module '$env/static/private' {
|
||||
export const npm_package_json: string;
|
||||
export const LC_TIME: string;
|
||||
export const BUN_INSTALL: string;
|
||||
export const QT_AUTO_SCREEN_SCALE_FACTOR: string;
|
||||
export const JOURNAL_STREAM: string;
|
||||
export const GTK3_MODULES: string;
|
||||
export const XDG_DATA_DIRS: string;
|
||||
export const KDE_FULL_SESSION: string;
|
||||
export const BROWSER: string;
|
||||
export const PATH: string;
|
||||
export const GDMSESSION: string;
|
||||
export const DBUS_SESSION_BUS_ADDRESS: string;
|
||||
export const KDE_APPLICATIONS_AS_SCOPE: string;
|
||||
export const MAIL: string;
|
||||
export const npm_node_execpath: string;
|
||||
export const LC_NUMERIC: 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;
|
||||
XDG_SESSION_PATH: string;
|
||||
XDG_MENU_PREFIX: string;
|
||||
ICEAUTHORITY: string;
|
||||
LANGUAGE: string;
|
||||
NODE: string;
|
||||
LC_ADDRESS: string;
|
||||
LC_NAME: string;
|
||||
SSH_AUTH_SOCK: string;
|
||||
GRADLE_HOME: string;
|
||||
SHELL_SESSION_ID: string;
|
||||
MEMORY_PRESSURE_WRITE: string;
|
||||
XDG_CONFIG_HOME: string;
|
||||
npm_config_local_prefix: string;
|
||||
DESKTOP_SESSION: string;
|
||||
LC_MONETARY: string;
|
||||
GTK_RC_FILES: string;
|
||||
SSH_AGENT_PID: string;
|
||||
EDITOR: string;
|
||||
GTK_MODULES: string;
|
||||
XDG_SEAT: string;
|
||||
PWD: string;
|
||||
XDG_SESSION_DESKTOP: string;
|
||||
LOGNAME: string;
|
||||
XDG_SESSION_DESKTOP: string;
|
||||
XDG_SESSION_TYPE: string;
|
||||
BUN_WHICH_IGNORE_CWD: string;
|
||||
SYSTEMD_EXEC_PID: string;
|
||||
PANEL_GDK_CORE_DEVICE_EVENTS: string;
|
||||
_: string;
|
||||
XAUTHORITY: string;
|
||||
XDG_GREETER_DATA_DIR: string;
|
||||
MOTD_SHOWN: string;
|
||||
GTK2_RC_FILES: string;
|
||||
GDM_LANG: string;
|
||||
HOME: string;
|
||||
LC_PAPER: string;
|
||||
LANG: string;
|
||||
LS_COLORS: string;
|
||||
XDG_CURRENT_DESKTOP: string;
|
||||
KONSOLE_DBUS_SERVICE: string;
|
||||
npm_package_version: string;
|
||||
MEMORY_PRESSURE_WATCH: string;
|
||||
WAYLAND_DISPLAY: string;
|
||||
KONSOLE_DBUS_SESSION: string;
|
||||
PROFILEHOME: string;
|
||||
VTE_VERSION: string;
|
||||
XDG_SEAT_PATH: string;
|
||||
INVOCATION_ID: string;
|
||||
KONSOLE_VERSION: string;
|
||||
MANAGERPID: string;
|
||||
INIT_CWD: string;
|
||||
KDE_SESSION_UID: string;
|
||||
XKB_DEFAULT_LAYOUT: string;
|
||||
XDG_CACHE_HOME: string;
|
||||
XDG_SESSION_CLASS: string;
|
||||
TERM: string;
|
||||
LC_IDENTIFICATION: string;
|
||||
npm_package_name: string;
|
||||
ZSH: string;
|
||||
USER: string;
|
||||
COLORFGBG: string;
|
||||
QT_WAYLAND_RECONNECT: string;
|
||||
KDE_SESSION_VERSION: string;
|
||||
PAM_KWALLET5_LOGIN: string;
|
||||
DISPLAY: string;
|
||||
npm_lifecycle_event: string;
|
||||
SHLVL: string;
|
||||
PAGER: string;
|
||||
LC_TELEPHONE: string;
|
||||
@@ -220,19 +194,17 @@ declare module '$env/dynamic/private' {
|
||||
npm_package_json: string;
|
||||
LC_TIME: string;
|
||||
BUN_INSTALL: string;
|
||||
QT_AUTO_SCREEN_SCALE_FACTOR: string;
|
||||
JOURNAL_STREAM: string;
|
||||
GTK3_MODULES: string;
|
||||
XDG_DATA_DIRS: string;
|
||||
KDE_FULL_SESSION: string;
|
||||
BROWSER: string;
|
||||
PATH: string;
|
||||
GDMSESSION: string;
|
||||
DBUS_SESSION_BUS_ADDRESS: string;
|
||||
KDE_APPLICATIONS_AS_SCOPE: string;
|
||||
MAIL: string;
|
||||
npm_node_execpath: string;
|
||||
LC_NUMERIC: string;
|
||||
OLDPWD: string;
|
||||
KONSOLE_DBUS_WINDOW: string;
|
||||
NODE_ENV: string;
|
||||
[key: `PUBLIC_${string}`]: undefined;
|
||||
[key: `${string}`]: string | undefined;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user