diff --git a/carina/core/exh_exhortos_partes/models.py b/carina/core/exh_exhortos_partes/models.py index a6fec1a..c0bc904 100644 --- a/carina/core/exh_exhortos_partes/models.py +++ b/carina/core/exh_exhortos_partes/models.py @@ -17,6 +17,7 @@ class ExhExhortoParte(Base, UniversalMixin): GENEROS = { "M": "MASCULINO", "F": "FEMENINO", + "-": "SIN SEXO", } # Nombre de la tabla diff --git a/carina/core/exh_exhortos_promociones_promoventes/models.py b/carina/core/exh_exhortos_promociones_promoventes/models.py index 403d52b..456e96e 100644 --- a/carina/core/exh_exhortos_promociones_promoventes/models.py +++ b/carina/core/exh_exhortos_promociones_promoventes/models.py @@ -19,6 +19,7 @@ class ExhExhortoPromocionPromovente(Base, UniversalMixin): GENEROS = { "M": "MASCULINO", "F": "FEMENINO", + "-": "SIN SEXO", } TIPOS_PARTES = { diff --git a/carina/v4/exh_exhortos/crud.py b/carina/v4/exh_exhortos/crud.py index e3aecf5..f300e7e 100644 --- a/carina/v4/exh_exhortos/crud.py +++ b/carina/v4/exh_exhortos/crud.py @@ -183,8 +183,8 @@ def create_exh_exhorto(database: Session, exh_exhorto_in: ExhExhortoIn) -> ExhEx # Remitente es EXTERNO exh_exhorto.remitente = "EXTERNO" - # Estado es PENDIENTE - exh_exhorto.estado = "PENDIENTE" + # Estado es RECIBIDO + exh_exhorto.estado = "RECIBIDO" # Insertar el exhorto database.add(exh_exhorto) @@ -198,7 +198,10 @@ def create_exh_exhorto(database: Session, exh_exhorto_in: ExhExhortoIn) -> ExhEx exh_exhorto_parte.nombre = safe_string(parte.nombre, save_enie=True) exh_exhorto_parte.apellido_paterno = safe_string(parte.apellidoPaterno, save_enie=True) exh_exhorto_parte.apellido_materno = safe_string(parte.apellidoMaterno, save_enie=True) - exh_exhorto_parte.genero = safe_string(parte.genero) + if parte.genero in ExhExhortoParte.GENEROS: + exh_exhorto_parte.genero = parte.genero + else: + exh_exhorto_parte.genero = "-" exh_exhorto_parte.es_persona_moral = parte.esPersonaMoral exh_exhorto_parte.tipo_parte = parte.tipoParte exh_exhorto_parte.tipo_parte_nombre = safe_string(parte.tipoParteNombre, save_enie=True) diff --git a/carina/v4/exh_exhortos_promociones/crud.py b/carina/v4/exh_exhortos_promociones/crud.py index 3a2415a..90d46e6 100644 --- a/carina/v4/exh_exhortos_promociones/crud.py +++ b/carina/v4/exh_exhortos_promociones/crud.py @@ -103,7 +103,10 @@ def create_exh_exhorto_promocion(database: Session, exh_exhorto_promocion_in: Ex exh_exhorto_promocion_promovente.nombre = safe_string(promovente.nombre, save_enie=True) exh_exhorto_promocion_promovente.apellido_paterno = safe_string(promovente.apellidoPaterno, save_enie=True) exh_exhorto_promocion_promovente.apellido_materno = safe_string(promovente.apellidoMaterno, save_enie=True) - exh_exhorto_promocion_promovente.genero = safe_string(promovente.genero) + if promovente.genero in ExhExhortoPromocionPromovente.GENEROS: + exh_exhorto_promocion_promovente.genero = promovente.genero + else: + exh_exhorto_promocion_promovente.genero = "-" exh_exhorto_promocion_promovente.es_persona_moral = promovente.esPersonaMoral exh_exhorto_promocion_promovente.tipo_parte = promovente.tipoParte exh_exhorto_promocion_promovente.tipo_parte_nombre = safe_string(promovente.tipoParteNombre, save_enie=True) diff --git a/lib/pwgen.py b/lib/pwgen.py index 4c34943..7e5a40d 100644 --- a/lib/pwgen.py +++ b/lib/pwgen.py @@ -17,7 +17,7 @@ def generar_api_key(id: int, email: str, random_length: int = 24) -> str: """Generar API key a partir de un ID, un e-mail y una cadena aleatoria""" aleatorio = "".join(random.sample(string.ascii_letters + string.digits, k=random_length)) hash_email = Hashids(salt=email, min_length=8).encode(1) - hash_id = Hashids(salt=settings.SALT, min_length=8).encode(id) + hash_id = Hashids(salt=settings.salt, min_length=8).encode(id) return f"{hash_id}.{hash_email}.{aleatorio}" diff --git a/lib/schemas_base.py b/lib/schemas_base.py index 6d7ef96..6b599af 100644 --- a/lib/schemas_base.py +++ b/lib/schemas_base.py @@ -14,5 +14,5 @@ class OneBaseOut(BaseModel): success: bool = True message: str = "Success" - errors: list[str] = [] - data: list[T] = [] + errors: list[str] + data: list[T] diff --git a/pyproject.toml b/pyproject.toml index 6017831..ee32e9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,16 +11,16 @@ readme = "README.md" python = "^3.11" click = "^8.1.7" cryptography = "^44.0.0" -fastapi = {extras = ["sqlalchemy"], version = "^0.115.4"} +fastapi = {extras = ["sqlalchemy"], version = "^0.115.6"} fastapi-pagination = "^0.12.26" -google-auth = "^2.32.0" +google-auth = "^2.37.0" google-cloud = "^0.34.0" google-cloud-secret-manager = "^2.20.2" -google-cloud-storage = "^2.18.0" +google-cloud-storage = "^2.19.0" gunicorn = "^23.0.0" hashids = "^1.3.1" psycopg2-binary = "^2.9.9" -pydantic = "^2.8.2" +pydantic = "^2.10.3" pydantic-settings = "^2.4.0" python-dotenv = "^1.0.1" python-multipart = "^0.0.19" diff --git a/requirements.txt b/requirements.txt index 286b451..96c7487 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ annotated-types==0.7.0 ; python_version >= "3.11" and python_version < "4.0" -anyio==4.6.2.post1 ; python_version >= "3.11" and python_version < "4.0" +anyio==4.7.0 ; python_version >= "3.11" and python_version < "4.0" cachetools==5.5.0 ; python_version >= "3.11" and python_version < "4.0" certifi==2024.8.30 ; python_version >= "3.11" and python_version < "4.0" cffi==1.17.1 ; python_version >= "3.11" and python_version < "4.0" and platform_python_implementation != "PyPy" @@ -8,13 +8,13 @@ click==8.1.7 ; python_version >= "3.11" and python_version < "4.0" colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows" cryptography==44.0.0 ; python_version >= "3.11" and python_version < "4.0" fastapi-pagination==0.12.32 ; python_version >= "3.11" and python_version < "4.0" -fastapi[sqlalchemy]==0.115.5 ; python_version >= "3.11" and python_version < "4.0" -google-api-core==2.23.0 ; python_version >= "3.11" and python_version < "4.0" -google-api-core[grpc]==2.23.0 ; python_version >= "3.11" and python_version < "4.0" -google-auth==2.36.0 ; python_version >= "3.11" and python_version < "4.0" +fastapi[sqlalchemy]==0.115.6 ; python_version >= "3.11" and python_version < "4.0" +google-api-core==2.24.0 ; python_version >= "3.11" and python_version < "4.0" +google-api-core[grpc]==2.24.0 ; python_version >= "3.11" and python_version < "4.0" +google-auth==2.37.0 ; python_version >= "3.11" and python_version < "4.0" google-cloud-core==2.4.1 ; python_version >= "3.11" and python_version < "4.0" google-cloud-secret-manager==2.21.1 ; python_version >= "3.11" and python_version < "4.0" -google-cloud-storage==2.18.2 ; python_version >= "3.11" and python_version < "4.0" +google-cloud-storage==2.19.0 ; python_version >= "3.11" and python_version < "4.0" google-cloud==0.34.0 ; python_version >= "3.11" and python_version < "4.0" google-crc32c==1.6.0 ; python_version >= "3.11" and python_version < "4.0" google-resumable-media==2.7.2 ; python_version >= "3.11" and python_version < "4.0" @@ -30,14 +30,14 @@ hashids==1.3.1 ; python_version >= "3.11" and python_version < "4.0" idna==3.10 ; python_version >= "3.11" and python_version < "4.0" packaging==24.2 ; python_version >= "3.11" and python_version < "4.0" proto-plus==1.25.0 ; python_version >= "3.11" and python_version < "4.0" -protobuf==5.29.0 ; python_version >= "3.11" and python_version < "4.0" +protobuf==5.29.1 ; python_version >= "3.11" and python_version < "4.0" psycopg2-binary==2.9.10 ; python_version >= "3.11" and python_version < "4.0" pyasn1-modules==0.4.1 ; python_version >= "3.11" and python_version < "4.0" pyasn1==0.6.1 ; python_version >= "3.11" and python_version < "4.0" pycparser==2.22 ; python_version >= "3.11" and python_version < "4.0" and platform_python_implementation != "PyPy" pydantic-core==2.27.1 ; python_version >= "3.11" and python_version < "4.0" pydantic-settings==2.6.1 ; python_version >= "3.11" and python_version < "4.0" -pydantic==2.10.2 ; python_version >= "3.11" and python_version < "4.0" +pydantic==2.10.3 ; python_version >= "3.11" and python_version < "4.0" python-dotenv==1.0.1 ; python_version >= "3.11" and python_version < "4.0" python-multipart==0.0.19 ; python_version >= "3.11" and python_version < "4.0" pytz==2024.2 ; python_version >= "3.11" and python_version < "4.0"