Skip to content

Commit

Permalink
Merge pull request #973 from ricval/Exhortos
Browse files Browse the repository at this point in the history
Exhortos - Modelos
  • Loading branch information
guivaloz authored Apr 29, 2024
2 parents 0ca7518 + 76296e6 commit 600e901
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plataforma_web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
from plataforma_web.blueprints.est_informes.views import est_informes
from plataforma_web.blueprints.est_informes_registros.views import est_informes_registros
from plataforma_web.blueprints.estados.views import estados
from plataforma_web.blueprints.exh_exhortos.views import exh_exhortos
from plataforma_web.blueprints.exh_exhortos_archivos.views import exh_exhortos_archivos
from plataforma_web.blueprints.exh_exhortos_partes.views import exh_exhortos_partes
from plataforma_web.blueprints.fin_vales.views import fin_vales
from plataforma_web.blueprints.fin_vales_adjuntos.views import fin_vales_adjuntos
from plataforma_web.blueprints.funcionarios.views import funcionarios
Expand Down Expand Up @@ -140,6 +143,9 @@ def create_app():
app.register_blueprint(est_informes_registros)
app.register_blueprint(est_variables)
app.register_blueprint(estados)
app.register_blueprint(exh_exhortos)
app.register_blueprint(exh_exhortos_archivos)
app.register_blueprint(exh_exhortos_partes)
app.register_blueprint(fin_vales)
app.register_blueprint(fin_vales_adjuntos)
app.register_blueprint(funcionarios)
Expand Down
Empty file.
61 changes: 61 additions & 0 deletions plataforma_web/blueprints/exh_exhortos/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""
Exh Exhortos
"""

from sqlalchemy.sql import func

from plataforma_web.extensions import db
from lib.universal_mixin import UniversalMixin

class ExhExhorto(db.Model, UniversalMixin):
"""Exhorto Exhorto"""

# Nombre de la tabla
__tablename__ = "exh_exhortos"

# Clave primaria
id = db.Column(db.Integer, primary_key=True)

# UUID identificador con el que el PJ exhortante identifica el exhorto que envía
exhorto_origen_id = db.Column(db.String(64), nullable=False, unique=True)

# Identificador INEGI del Municipio del Estado del PJ exhortado al que se quiere enviar el Exhorto
# municipio_destino_id = db.Column(db.Integer, db.ForeignKey("municipios.id"), index=True, nullable=False)
# municipio_destino = db.relationship("Municipio", back_populates="exh_exhortos_destinos")

# Clave de la materia (el que se obtuvo en la consulta de materias del PJ exhortado) al que el Exhorto hace referencia
materia_id = db.Column(db.Integer, db.ForeignKey("materias.id"), index=True, nullable=False)
materia = db.relationship("Materia", back_populates="exh_exhortos")

# Identificador INEGI del Estado de origen del Municipio donde se ubica el Juzgado del PJ exhortante
# estado_origen_id = Column(Integer, ForeignKey("estados.id"), index=True, nullable=False)
# estado_origen = relationship("Estado", back_populates="exhortos")

# Identificador INEGI del Municipio donde está localizado el Juzgado del PJ exhortante
municipio_origen_id = db.Column(db.Integer, db.ForeignKey("municipios.id"), index=True, nullable=False)
municipio_origen = db.relationship("Municipio", back_populates="exh_exhortos_origenes")

# Identificador propio del Juzgado/Área que envía el Exhorto
juzgado_origen_id = db.Column(db.String(64))
# Nombre del Juzgado/Área que envía el Exhorto
juzgado_origen_nombre = db.Column(db.String(256), nullable=False)
# El número de expediente (o carpeta procesal, carpeta...) que tiene el asunto en el Juzgado de Origen
numero_expediente_origen = db.Column(db.String(256), nullable=False)
numero_oficio_origen = db.Column(db.String(256))
tipo_juicio_asunto_delitos = db.Column(db.String(256), nullable=False)
juez_exhortante = db.Column(db.String(256))
fojas = db.Column(db.Integer, nullable=False)
dias_responder = db.Column(db.Integer, nullable=False)
tipo_diligenciacion_nombre = db.Column(db.String(256))
fecha_origen = db.Column(db.DateTime, server_default=func.now())
observaciones = db.Column(db.String(1024))

# Hijos
# partes PersonaParte[] NO
exh_exhortos_partes = db.relationship('ExhExhortoParte', back_populates='exh_exhorto', lazy='noload')
# archivos ArchivoARecibir[] SI
exh_exhortos_archivos = db.relationship('ExhExhortoArchivo', back_populates='exh_exhorto', lazy='noload')

def __repr__(self):
"""Representación"""
return f"<Exhorto {self.id}>"
27 changes: 27 additions & 0 deletions plataforma_web/blueprints/exh_exhortos/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Exh Exhortos, vistas
"""

import json
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required

from lib.datatables import get_datatable_parameters, output_datatable_json
from lib.safe_string import safe_clave, safe_string

from plataforma_web.blueprints.bitacoras.models import Bitacora
from plataforma_web.blueprints.modulos.models import Modulo
from plataforma_web.blueprints.permisos.models import Permiso
from plataforma_web.blueprints.usuarios.decorators import permission_required
from plataforma_web.blueprints.exh_exhortos.models import ExhExhorto

MODULO = "EXH EXHORTOS"

exh_exhortos = Blueprint("exh_exhortos", __name__, template_folder="templates")


@exh_exhortos.before_request
@login_required
@permission_required(MODULO, Permiso.VER)
def before_request():
"""Permiso por defecto"""
Empty file.
29 changes: 29 additions & 0 deletions plataforma_web/blueprints/exh_exhortos_archivos/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Exh Exhortos Archivos
"""

from plataforma_web.extensions import db
from lib.universal_mixin import UniversalMixin

class ExhExhortoArchivo(db.Model, UniversalMixin):
"""Exhorto Archivo"""

# Nombre de la tabla
__tablename__ = "exh_exhortos_archivos"

# Clave primaria
id = db.Column(db.Integer, primary_key=True)

# Clave foránea
exh_exhorto_id = db.Column(db.Integer, db.ForeignKey('exh_exhortos.id'), index=True, nullable=False)
exh_exhorto = db.relationship('ExhExhorto', back_populates='exh_exhortos_archivos')

# Columnas
nombre_archivo = db.Column(db.String(256), nullable=False)
hash_sha1 = db.Column(db.String(256))
hash_sha256 = db.Column(db.String(256))
tipo_documento = db.Column(db.Integer(), nullable=False) # 1=Oficio, 2=Acuerdo, 3=Anexo

def __repr__(self):
"""Representación"""
return f"<ExhExhortoArchivo {self.nombre_archivo}>"
27 changes: 27 additions & 0 deletions plataforma_web/blueprints/exh_exhortos_archivos/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Exh Exhortos Archivos, vistas
"""

import json
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required

from lib.datatables import get_datatable_parameters, output_datatable_json
from lib.safe_string import safe_clave, safe_string

from plataforma_web.blueprints.bitacoras.models import Bitacora
from plataforma_web.blueprints.modulos.models import Modulo
from plataforma_web.blueprints.permisos.models import Permiso
from plataforma_web.blueprints.usuarios.decorators import permission_required
from plataforma_web.blueprints.exh_exhortos_archivos.models import ExhExhortoArchivo

MODULO = "EXH EXHORTOS ARCHIVOS"

exh_exhortos_archivos = Blueprint("exh_exhortos_archivos", __name__, template_folder="templates")


@exh_exhortos_archivos.before_request
@login_required
@permission_required(MODULO, Permiso.VER)
def before_request():
"""Permiso por defecto"""
Empty file.
40 changes: 40 additions & 0 deletions plataforma_web/blueprints/exh_exhortos_partes/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
Exhortos Partes Persona
"""

from collections import OrderedDict
from plataforma_web.extensions import db
from lib.universal_mixin import UniversalMixin

class ExhExhortoParte(db.Model, UniversalMixin):
"""Exhorto Parte"""

GENEROS = OrderedDict(
[
("M", "MASCULINO"),
("F", "FEMENINO"),
]
)

# Nombre de la tabla
__tablename__ = "exh_exhortos_partes"

# Clave primaria
id = db.Column(db.Integer, primary_key=True)

# Clave foránea
exh_exhorto_id = db.Column(db.Integer, db.ForeignKey('exh_exhortos.id'), index=True, nullable=False)
exh_exhorto = db.relationship('ExhExhorto', back_populates='exh_exhortos_partes')

# Columnas
nombre = db.Column(db.String(256), nullable=False)
apellido_paterno = db.Column(db.String(256))
apellido_materno = db.Column(db.String(256))
genero = db.Column(db.Enum(*GENEROS, name="tipos_generos", native_enum=False), nullable=True)
es_persona_moral = db.Column(db.Boolean, nullable=False)
tipo_parte = db.Column(db.Integer(), nullable=False, default=0) # 1 = Actor, Promovente, Ofendido; 2 = Demandado, Inculpado, Imputado; 0 = No definido
tipo_parte_nombre = db.Column(db.String(256))

def __repr__(self):
"""Representación"""
return f"<ExhExhortoParte {self.nombre}>"
27 changes: 27 additions & 0 deletions plataforma_web/blueprints/exh_exhortos_partes/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Exh Exhortos Partes, vistas
"""

import json
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask_login import current_user, login_required

from lib.datatables import get_datatable_parameters, output_datatable_json
from lib.safe_string import safe_clave, safe_string

from plataforma_web.blueprints.bitacoras.models import Bitacora
from plataforma_web.blueprints.modulos.models import Modulo
from plataforma_web.blueprints.permisos.models import Permiso
from plataforma_web.blueprints.usuarios.decorators import permission_required
from plataforma_web.blueprints.exh_exhortos_partes.models import ExhExhortoParte

MODULO = "EXH EXHORTOS PARTES"

exh_exhortos_partes = Blueprint("exh_exhortos_partes", __name__, template_folder="templates")


@exh_exhortos_partes.before_request
@login_required
@permission_required(MODULO, Permiso.VER)
def before_request():
"""Permiso por defecto"""
1 change: 1 addition & 0 deletions plataforma_web/blueprints/materias/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Materia(db.Model, UniversalMixin):

# Hijos
autoridades = db.relationship("Autoridad", back_populates="materia", lazy="noload")
exh_exhortos = db.relationship("ExhExhorto", back_populates="materia", lazy="noload")
materias_tipos_juicios = db.relationship("MateriaTipoJuicio", back_populates="materia")
tesis_jurisprudencias = db.relationship("TesisJurisprudencia", back_populates="materia", lazy="noload")
siga_grabaciones = db.relationship("SIGAGrabacion", back_populates="materia", lazy="noload")
Expand Down
5 changes: 5 additions & 0 deletions plataforma_web/blueprints/municipios/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ class Municipio(db.Model, UniversalMixin):
clave = db.Column(db.String(3), nullable=False)
nombre = db.Column(db.String(256), nullable=False)

# Hijos
# exh_exhortos_destinos = db.relationship('ExhExhorto', back_populates='municipio_destino', lazy='noload')
exh_exhortos_origenes = db.relationship('ExhExhorto', back_populates='municipio_origen', lazy='noload')


def __repr__(self):
"""Representación"""
return f"<Municipio {self.clave}>"

0 comments on commit 600e901

Please sign in to comment.