first commit
This commit is contained in:
52
app/modules/__init__.py
Normal file
52
app/modules/__init__.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""
|
||||
UNIFICACION DE LOS MODELOS XMA
|
||||
Todos los modelos deben importarse para que alembic los detecte
|
||||
"""
|
||||
|
||||
# Importar Base directamente desde database para evitar circular imports
|
||||
from database import Base
|
||||
|
||||
# Importar todos los modelos
|
||||
from app.modules.clients.models import Client
|
||||
from app.modules.users.models import Users
|
||||
from app.modules.affidavit_logs.models import AffidavitRecord
|
||||
from app.modules.branches.models import Branches
|
||||
from app.modules.coments.models import Coments
|
||||
from app.modules.configuration.models import Configuration
|
||||
from app.modules.credits.models import Credits
|
||||
from app.modules.edos.models import EDOS
|
||||
from app.modules.efos.models import EFOS
|
||||
from app.modules.feed.models import Feed
|
||||
from app.modules.files.models import Files
|
||||
from app.modules.interactions.models import Interacction
|
||||
from app.modules.invoices.models import Invoices
|
||||
from app.modules.license.models import License
|
||||
from app.modules.location.models import Locations
|
||||
from app.modules.moves.models import Moves
|
||||
from app.modules.suppliers.models import Suppliers
|
||||
|
||||
# Metadata para Alembic
|
||||
target_metadata = Base.metadata
|
||||
|
||||
# Lista explícita de modelos XMA
|
||||
__all__ = [
|
||||
"Base",
|
||||
"target_metadata",
|
||||
"Users",
|
||||
"Client",
|
||||
"Locations",
|
||||
"AffidavitRecord",
|
||||
"Branches",
|
||||
"Coments",
|
||||
"Configuration",
|
||||
"Credits",
|
||||
"EDOS",
|
||||
"EFOS",
|
||||
"Feed",
|
||||
"Interacction",
|
||||
"Files",
|
||||
"Invoices",
|
||||
"License",
|
||||
"Moves",
|
||||
"Suppliers",
|
||||
]
|
||||
BIN
app/modules/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
app/modules/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
app/modules/affidavit_logs/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/affidavit_logs/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
58
app/modules/affidavit_logs/models.py
Normal file
58
app/modules/affidavit_logs/models.py
Normal file
@@ -0,0 +1,58 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum, Index
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class StatusOP(str, enum.Enum):
|
||||
COMPLETED = "completed"
|
||||
PARTIAL = "partial"
|
||||
INITIAL = "initial"
|
||||
NO_PROCECED = "no_proceced"
|
||||
INVALID = "invalid"
|
||||
|
||||
class Operation(str, enum.Enum):
|
||||
DELETED ="deleted"
|
||||
CREATED ="created"
|
||||
UPDATED ="updated"
|
||||
TRIED ="tried"
|
||||
MOST ="mosted"
|
||||
LESS ="less"
|
||||
MINUS ="minus"
|
||||
CANCELED ="canceled"
|
||||
|
||||
|
||||
class AffidavitRecord(Base):
|
||||
__tablename__ = "affidavit_logs"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
|
||||
operation = Column(SQLEnum(Operation, name="operation", create_type=False), default=Operation.TRIED, nullable=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
client_id = Column(Integer, ForeignKey("clients.id"), nullable=True)
|
||||
description = Column(Text,nullable=False)
|
||||
adjustment = Column(String(100), nullable=True)
|
||||
status = Column(SQLEnum(StatusOP, name="status", create_type=False), default=StatusOP.INITIAL, nullable=True)
|
||||
sign = Column(String, nullable=False)
|
||||
|
||||
#timestamsp
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
#trace
|
||||
created_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
updated_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
deleted_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
#relationships
|
||||
user = relationship("Users", foreign_keys=[user_id], back_populates="affidavit_logs")
|
||||
client = relationship("Client", foreign_keys=[client_id])
|
||||
|
||||
__table_args__ = (
|
||||
Index('idx_affidavit_user', 'user_id'),
|
||||
Index('idx_affidavit_client', 'client_id'),
|
||||
Index('idx_affidavit_operation', 'operation'),
|
||||
Index('idx_affidavit_status', 'status'),
|
||||
Index('idx_affidavit_created', 'created_at'),
|
||||
)
|
||||
0
app/modules/affidavit_logs/repository.py
Normal file
0
app/modules/affidavit_logs/repository.py
Normal file
0
app/modules/affidavit_logs/route.py
Normal file
0
app/modules/affidavit_logs/route.py
Normal file
0
app/modules/affidavit_logs/schema.py
Normal file
0
app/modules/affidavit_logs/schema.py
Normal file
BIN
app/modules/branches/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/branches/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
47
app/modules/branches/models.py
Normal file
47
app/modules/branches/models.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean,Index, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
|
||||
class Branches(Base):
|
||||
__tablename__ = "branches"
|
||||
|
||||
id = Column(Integer,primary_key=True, nullable=False, autoincrement=True)
|
||||
direccion = Column(String(255), nullable=False)
|
||||
cp = Column(Integer, nullable=False)
|
||||
#physical
|
||||
is_physical = Column(Boolean, nullable=False)
|
||||
location_id = Column(Integer, ForeignKey("location.id"), nullable=False)
|
||||
#validation
|
||||
is_active = Column(Boolean, nullable=False, default=True)
|
||||
#cliente_id
|
||||
client_id = Column(Integer, ForeignKey("clients.id"), nullable=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
#timestamsp
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
#trace
|
||||
created_by = Column(Integer, nullable=True)
|
||||
updated_by = Column(Integer, nullable=True)
|
||||
deleted_by = Column(Integer, nullable=True)
|
||||
|
||||
#indices
|
||||
__table_args__ = (
|
||||
Index('idx_branches_client', 'client_id'),
|
||||
Index('idx_branches_location', 'location_id'),
|
||||
Index('idx_branches_user', 'user_id'),
|
||||
Index('idx_branches_active', 'is_active')
|
||||
)
|
||||
|
||||
#relaciones
|
||||
|
||||
client = relationship("Client", foreign_keys=[client_id], back_populates="branches")
|
||||
location = relationship("Locations", foreign_keys=[location_id], back_populates="branches")
|
||||
user = relationship("Users", back_populates="branch")
|
||||
|
||||
0
app/modules/branches/repository.py
Normal file
0
app/modules/branches/repository.py
Normal file
0
app/modules/branches/route.py
Normal file
0
app/modules/branches/route.py
Normal file
0
app/modules/branches/schema.py
Normal file
0
app/modules/branches/schema.py
Normal file
BIN
app/modules/clients/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/clients/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
76
app/modules/clients/models.py
Normal file
76
app/modules/clients/models.py
Normal file
@@ -0,0 +1,76 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Float, Index, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class Medio(str, enum.Enum):
|
||||
MANUAL = "manual"
|
||||
DIOT = "diot"
|
||||
EXCEL = "excel"
|
||||
FACTURA = "factura"
|
||||
|
||||
class Tercero(str, enum.Enum):
|
||||
NACIONAL = "nacional"
|
||||
EXTRANJERO = "extranjero"
|
||||
GLOBAL = "global"
|
||||
|
||||
class Operacion(str, enum.Enum):
|
||||
PRESTACIONSERVICIOSPROFECIONALES = "prestacion"
|
||||
ARRENDAMIENTOSINMUENBLES = "arrendamientos"
|
||||
OTROS = "otros"
|
||||
|
||||
|
||||
|
||||
class Client(Base):
|
||||
__tablename__ = "clients"
|
||||
|
||||
#Identificacion
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
rfc = Column(String(60), nullable=False, unique=True)
|
||||
email = Column(String(150), nullable=False, unique=True)
|
||||
|
||||
#Datos fiscales
|
||||
short_name = Column(String(255), nullable=True)
|
||||
razon_social = Column(String(255), nullable=False, index=True)
|
||||
fiscal_number = Column(String(15), nullable=False, unique=True)
|
||||
cellphone = Column(String(20), nullable=False)
|
||||
|
||||
|
||||
#clasififcacion
|
||||
medio = Column(SQLEnum(Medio, name="medio_enum", create_type=False), default=Medio.MANUAL, nullable=False)
|
||||
third_type = Column(SQLEnum(Tercero, name="tercero_enum", create_type=False), default=Tercero.GLOBAL, nullable=False)
|
||||
operation_type = Column(SQLEnum(Operacion, name="operacion_enum", create_type=False), default=Operacion.OTROS, nullable=False)
|
||||
is_foreign = Column(Boolean, nullable=True, default=False)
|
||||
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
location_id = Column(Integer, ForeignKey("location.id"), nullable=True)
|
||||
|
||||
#timestamps
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
#trazabilidad
|
||||
created_by = Column(Integer, nullable=True)
|
||||
updated_by = Column(Integer, nullable=True)
|
||||
deleted_by = Column(Integer, nullable=True)
|
||||
|
||||
__table_args = (
|
||||
Index('idx_clients_user', 'user_id'),
|
||||
Index('idx_clients_location', 'location_id'),
|
||||
)
|
||||
|
||||
#relationships
|
||||
|
||||
user = relationship("Users", foreign_keys=[user_id], back_populates="clients")
|
||||
location = relationship("Locations", foreign_keys=[location_id])
|
||||
license = relationship("License", back_populates="client")
|
||||
branches = relationship("Branches", back_populates="client")
|
||||
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Client(id={self.id}, rfc={self.rfc}, razon_social={self.razon_social})>"
|
||||
|
||||
|
||||
0
app/modules/clients/repository.py
Normal file
0
app/modules/clients/repository.py
Normal file
0
app/modules/clients/route.py
Normal file
0
app/modules/clients/route.py
Normal file
0
app/modules/clients/schema.py
Normal file
0
app/modules/clients/schema.py
Normal file
BIN
app/modules/coments/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/coments/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
37
app/modules/coments/models.py
Normal file
37
app/modules/coments/models.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Index, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
|
||||
class Coments(Base):
|
||||
__tablename__= "coments"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
texto = Column(Text, nullable=False)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
feed_id= Column( Integer, ForeignKey("feed.id"), nullable=True)
|
||||
|
||||
is_active = Column(Boolean, nullable=False, default=True)
|
||||
|
||||
created_at = Column( DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
deactivate_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
|
||||
created_by = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
deactivated_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
#index
|
||||
__table_args__ = (
|
||||
Index('idx_coments_feed', 'feed_id'),
|
||||
Index('idx_coments_user', 'user_id'),
|
||||
Index('idx_coments_created', 'created_at'),
|
||||
Index('idx_coments_active', 'is_active')
|
||||
)
|
||||
|
||||
#Relaciones
|
||||
user = relationship("Users", foreign_keys=[user_id], back_populates="coments")
|
||||
feed = relationship("Feed", foreign_keys=[feed_id])
|
||||
creator = relationship("Users", foreign_keys=[created_by])
|
||||
|
||||
0
app/modules/coments/repository.py
Normal file
0
app/modules/coments/repository.py
Normal file
0
app/modules/coments/route.py
Normal file
0
app/modules/coments/route.py
Normal file
0
app/modules/coments/schema.py
Normal file
0
app/modules/coments/schema.py
Normal file
0
app/modules/coments/services.py
Normal file
0
app/modules/coments/services.py
Normal file
BIN
app/modules/configuration/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/configuration/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
34
app/modules/configuration/models.py
Normal file
34
app/modules/configuration/models.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean, Index, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
|
||||
class Configuration(Base):
|
||||
__tablename__ = "configuration"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
|
||||
|
||||
#SMTP data
|
||||
smtp_host = Column(String(100), nullable=True)
|
||||
smtp_port = Column(Integer, nullable=True)
|
||||
smtp_user = Column(String(100), nullable=True)
|
||||
smtp_password = Column(String(100), nullable=True)
|
||||
|
||||
is_active = Column(Boolean, nullable=False, default=True)
|
||||
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime(timezone=True), nullable=True)
|
||||
last_send = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
|
||||
created_by = Column(Integer, nullable=False)
|
||||
updtated_by = Column(Integer, nullable=True)
|
||||
deleted_by = Column(Integer, nullable=True)
|
||||
|
||||
__table_args__ = (
|
||||
Index('idx_cofig_active', 'is_active'),
|
||||
)
|
||||
0
app/modules/configuration/repository.py
Normal file
0
app/modules/configuration/repository.py
Normal file
0
app/modules/configuration/route.py
Normal file
0
app/modules/configuration/route.py
Normal file
0
app/modules/configuration/schema.py
Normal file
0
app/modules/configuration/schema.py
Normal file
BIN
app/modules/credits/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/credits/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
50
app/modules/credits/models.py
Normal file
50
app/modules/credits/models.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
# Articulo 69 de codigo fiscal de la federacion!!!
|
||||
# 69 article of fiscal code of federation, mexican united states.
|
||||
|
||||
class Supuestos(str, enum.Enum):
|
||||
CANCELADOS ="cancelados"
|
||||
CONDONADOS ="condonados"
|
||||
FIRMES ="firmes"
|
||||
SENTENCIAS ="sentencias"
|
||||
EXIGIBLES ="exigibles"
|
||||
RETORNO_INVERSIONES ="retorno_inversiones"
|
||||
FRACCION_X ="fraccion_x"
|
||||
FRACCION_VII ="fraccion_vii"
|
||||
NO_LOCALIZADOS ="no_localizados"
|
||||
|
||||
|
||||
class Credits(Base):
|
||||
__tablename__="credits"
|
||||
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, nullable=False)
|
||||
title = Column(String(30), nullable=False)
|
||||
rfc = Column(String(25), nullable=False)
|
||||
razon_social = Column(String(100), nullable=False)
|
||||
tipo_persona = Column(String(100), nullable=False)
|
||||
supuesto = Column(SQLEnum(Supuestos, name="supuestos", create_type=False), nullable=False)
|
||||
fecha_primera_publicacion = Column(Date, nullable=False)
|
||||
fecha_publicacion_ley_transparencia = Column(Date, nullable=True)
|
||||
fecha_cancelacion = Column(Date, nullable=True)
|
||||
fecha_cancelacion_csd = Column(Date, nullable=True)
|
||||
entidad_federativa = Column(String, nullable=False)
|
||||
monto = Column(Integer, nullable=True)
|
||||
motivo = Column(Text, nullable=True)
|
||||
location_id = Column(Integer, ForeignKey("location.id"), nullable=False)
|
||||
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=True)
|
||||
|
||||
uploaded_by = Column(Integer, nullable=True)
|
||||
|
||||
# relationships
|
||||
location = relationship("Locations", back_populates="credits")
|
||||
|
||||
0
app/modules/credits/repository.py
Normal file
0
app/modules/credits/repository.py
Normal file
0
app/modules/credits/route.py
Normal file
0
app/modules/credits/route.py
Normal file
0
app/modules/credits/schema.py
Normal file
0
app/modules/credits/schema.py
Normal file
BIN
app/modules/diot/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/diot/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
0
app/modules/diot/models.py
Normal file
0
app/modules/diot/models.py
Normal file
0
app/modules/diot/repository.py
Normal file
0
app/modules/diot/repository.py
Normal file
0
app/modules/diot/route.py
Normal file
0
app/modules/diot/route.py
Normal file
0
app/modules/diot/schema.py
Normal file
0
app/modules/diot/schema.py
Normal file
BIN
app/modules/edos/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/edos/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
30
app/modules/edos/models.py
Normal file
30
app/modules/edos/models.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
#articulo 69-B-Bis del CFF
|
||||
# 69 article -B - Bis, of fiscal code of fedration of mexican united estates
|
||||
|
||||
class Situacion(str, enum.Enum):
|
||||
SENTENCIA_FAVORABLE ="sentencia_favorable"
|
||||
DEFINITIVO="definitivo"
|
||||
|
||||
class EDOS(Base):
|
||||
__tablename__="edos"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
numero = Column(Integer, nullable=False)
|
||||
razon_social = Column(String(100), nullable=False)
|
||||
situacion = Column(SQLEnum(Situacion, name="situcion", create_type=False), nullable=False)
|
||||
numero_definitivo = Column(String(60), nullable=False)
|
||||
fecha_definitivo = Column(Date, nullable=False )
|
||||
publicaccion_sat = Column(Date, nullable=True)
|
||||
numero_def_dof = Column(String(100), nullable=True)
|
||||
fecha_def_dof = Column(Date, nullable=True)
|
||||
publicacion_dof = Column(Date, nullable=True)
|
||||
numero_fav_sat = Column(String(100), nullable=True)
|
||||
|
||||
|
||||
0
app/modules/edos/repository.py
Normal file
0
app/modules/edos/repository.py
Normal file
0
app/modules/edos/route.py
Normal file
0
app/modules/edos/route.py
Normal file
0
app/modules/edos/schema.py
Normal file
0
app/modules/edos/schema.py
Normal file
BIN
app/modules/efos/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/efos/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
33
app/modules/efos/models.py
Normal file
33
app/modules/efos/models.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
#Articulo 69-B del codigo fiscal de la federacion
|
||||
#69-B article of fiscal code of federation of mexican united states
|
||||
|
||||
class Situacion(str, enum.Enum):
|
||||
DEFINITIVO ="definitivo"
|
||||
DESVIRTUADO ="desvituado"
|
||||
PRESUNTO ="presunto"
|
||||
SENTENCIA_FAVORABLE ="sentencia_favorable"
|
||||
|
||||
class EFOS(Base):
|
||||
__tablename__ = "efos"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
numero = Column(Integer, nullable=False)
|
||||
rfc = Column(String(30), nullable=False)
|
||||
nombre_contribuyente = Column(String(100), nullable=False)
|
||||
situacion = Column(String(60), SQLEnum(Situacion, name="situacion", create_type=False), nullable=False)
|
||||
publi_presuntos_sat = Column(Date, nullable=True)
|
||||
publi_desvirtuados_sat = Column(Date, nullable=True)
|
||||
publi_definitivos_sat = Column(Date, nullable=True)
|
||||
publi_favorables_sat = Column(Date, nullable=True)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=False)
|
||||
|
||||
loaded_by = Column(Integer, nullable=False)
|
||||
0
app/modules/efos/repository.py
Normal file
0
app/modules/efos/repository.py
Normal file
0
app/modules/efos/route.py
Normal file
0
app/modules/efos/route.py
Normal file
0
app/modules/efos/schema.py
Normal file
0
app/modules/efos/schema.py
Normal file
0
app/modules/entreprise/models.py
Normal file
0
app/modules/entreprise/models.py
Normal file
0
app/modules/entreprise/repository.py
Normal file
0
app/modules/entreprise/repository.py
Normal file
0
app/modules/entreprise/route.py
Normal file
0
app/modules/entreprise/route.py
Normal file
0
app/modules/entreprise/schema.py
Normal file
0
app/modules/entreprise/schema.py
Normal file
BIN
app/modules/feed/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/feed/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
26
app/modules/feed/models.py
Normal file
26
app/modules/feed/models.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class Feed(Base):
|
||||
__tablename__ = "feed"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
title = Column(String(50), nullable=False )
|
||||
body = Column(Text, nullable=True)
|
||||
document_url = Column(String, nullable=True)
|
||||
publication_date = Column(Date, nullable=True)
|
||||
is_important = Column(Boolean, default=False, nullable=False)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
created_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
updated_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
file_id = Column(Integer, nullable=True)
|
||||
|
||||
#relationships
|
||||
user = relationship("Users", foreign_keys=[user_id], back_populates="feed")
|
||||
0
app/modules/feed/repository.py
Normal file
0
app/modules/feed/repository.py
Normal file
0
app/modules/feed/route.py
Normal file
0
app/modules/feed/route.py
Normal file
0
app/modules/feed/schema.py
Normal file
0
app/modules/feed/schema.py
Normal file
BIN
app/modules/files/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/files/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
24
app/modules/files/models.py
Normal file
24
app/modules/files/models.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class Files(Base):
|
||||
__tablename__ = "files"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
title = Column(String(50), nullable=True)
|
||||
summary = Column(Text, nullable=False)
|
||||
document_url = Column(String(100), nullable=False)
|
||||
file_type = Column(String(50), nullable=False)
|
||||
file_size = Column(Integer, nullable=False)
|
||||
|
||||
feed_id = Column(Integer, nullable=False)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=False )
|
||||
|
||||
uploaded_by = Column(Integer, nullable=False)
|
||||
updated_by = Column(Integer, nullable=True)
|
||||
0
app/modules/files/repository.py
Normal file
0
app/modules/files/repository.py
Normal file
0
app/modules/files/route.py
Normal file
0
app/modules/files/route.py
Normal file
0
app/modules/files/schema.py
Normal file
0
app/modules/files/schema.py
Normal file
BIN
app/modules/interactions/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/interactions/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
34
app/modules/interactions/models.py
Normal file
34
app/modules/interactions/models.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class Interaccion(str, enum.Enum):
|
||||
LIKE = "like"
|
||||
DONT_LIKE = "dont_like"
|
||||
APPROVED = "approved"
|
||||
DISAPRROVE = "disapproved"
|
||||
NONE = "none"
|
||||
|
||||
|
||||
class Interacction(Base):
|
||||
__tablename__="interacctions"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
feed_id = Column(Integer, ForeignKey("feed.id"), nullable=False)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
type_iteractions = Column(SQLEnum(Interaccion, name="type_interactios", create_type=False), default=Interaccion.NONE, nullable=False)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
|
||||
#relationships
|
||||
user = relationship("Users", back_populates="interactions")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
0
app/modules/interactions/repository.py
Normal file
0
app/modules/interactions/repository.py
Normal file
0
app/modules/interactions/route.py
Normal file
0
app/modules/interactions/route.py
Normal file
0
app/modules/interactions/schema.py
Normal file
0
app/modules/interactions/schema.py
Normal file
BIN
app/modules/invoices/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/invoices/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
23
app/modules/invoices/models.py
Normal file
23
app/modules/invoices/models.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
|
||||
class Invoices(Base):
|
||||
__tablename__ = "invoices"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
|
||||
emisor = Column(String(100), nullable=False)
|
||||
receptor = Column(String(110), nullable=False)
|
||||
uuid = Column(String(255), nullable=False)
|
||||
total = Column(Integer, nullable=False)
|
||||
tipo = Column(String(50), nullable=True)
|
||||
date = Column(DateTime, nullable=True)
|
||||
|
||||
verified_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
verified_by = Column(Integer, nullable=True)
|
||||
|
||||
|
||||
0
app/modules/invoices/repository.py
Normal file
0
app/modules/invoices/repository.py
Normal file
0
app/modules/invoices/route.py
Normal file
0
app/modules/invoices/route.py
Normal file
0
app/modules/invoices/schema.py
Normal file
0
app/modules/invoices/schema.py
Normal file
BIN
app/modules/license/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/license/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
45
app/modules/license/models.py
Normal file
45
app/modules/license/models.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Index, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
|
||||
|
||||
class License(Base):
|
||||
__tablename__ = "license"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False, autoincrement=True)
|
||||
titular = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
|
||||
begins_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
ends_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
|
||||
token_license = Column(String(30), nullable=True)
|
||||
location_id = Column(Integer, ForeignKey("location.id"), nullable=False)
|
||||
client_id = Column(Integer, ForeignKey("clients.id"), nullable=False)
|
||||
|
||||
|
||||
|
||||
#timestamsp
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime(timezone=True), nullable=False)
|
||||
|
||||
#trace
|
||||
created_by = Column(Integer, nullable=True)
|
||||
updated_by = Column(Integer, nullable=True)
|
||||
deleted_by = Column(Integer, nullable=True)
|
||||
|
||||
__table_arg__ = (
|
||||
Index('idx_license_token', 'token_license'),
|
||||
Index('idx_license_client', 'client_id'),
|
||||
Index('idx_license_active', 'is_active'),
|
||||
Index('idx_license_ends_at', 'ends_at'),
|
||||
)
|
||||
|
||||
#Relations
|
||||
client = relationship("Client", foreign_keys=[client_id], back_populates="license")
|
||||
location = relationship("Locations", foreign_keys=[location_id], back_populates="licenses")
|
||||
user = relationship("Users", foreign_keys=[titular], back_populates="licenses")
|
||||
0
app/modules/license/repository.py
Normal file
0
app/modules/license/repository.py
Normal file
0
app/modules/license/route.py
Normal file
0
app/modules/license/route.py
Normal file
0
app/modules/license/schema.py
Normal file
0
app/modules/license/schema.py
Normal file
BIN
app/modules/location/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/location/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
50
app/modules/location/models.py
Normal file
50
app/modules/location/models.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Index, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class Locations(Base):
|
||||
__tablename__ = "location"
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
|
||||
country = Column(String(120), nullable=False)
|
||||
country_id = Column(Integer, nullable=False)
|
||||
state = Column(String(100), nullable=False)
|
||||
state_id = Column(Integer, nullable=False)
|
||||
city = Column(String(100), nullable=False)
|
||||
city_id = Column(Integer, nullable=False)
|
||||
cp_zp = Column(Integer, nullable=True)
|
||||
street = Column(String(120), nullable=True)
|
||||
is_department = Column(Boolean, nullable=False, default=False)
|
||||
number_ext = Column(Integer, nullable=True)
|
||||
number_int = Column(Integer, nullable=True)
|
||||
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
|
||||
#timestamsp
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime, nullable=True)
|
||||
|
||||
#trace
|
||||
created_by = Column(Integer, nullable=True)
|
||||
updated_by = Column(Integer, nullable=True)
|
||||
deleted_by = Column(Integer, nullable=True)
|
||||
|
||||
#index
|
||||
__table_args__ = (
|
||||
Index('idx_location_country','country'),
|
||||
Index('idx_location_state','state'),
|
||||
Index('idx_location_city','city'),
|
||||
Index('idx_location_cp','cp_zp'),
|
||||
Index('idx_location_active','is_active'),
|
||||
)
|
||||
|
||||
#relationships
|
||||
|
||||
clients = relationship("Client",back_populates="location")
|
||||
branches = relationship("Branches",back_populates="location")
|
||||
credits = relationship("Credits",back_populates="location")
|
||||
licenses = relationship("License",back_populates="location")
|
||||
0
app/modules/location/repository.py
Normal file
0
app/modules/location/repository.py
Normal file
0
app/modules/location/route.py
Normal file
0
app/modules/location/route.py
Normal file
0
app/modules/location/schema.py
Normal file
0
app/modules/location/schema.py
Normal file
0
app/modules/location/service.py
Normal file
0
app/modules/location/service.py
Normal file
BIN
app/modules/moves/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/moves/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
71
app/modules/moves/models.py
Normal file
71
app/modules/moves/models.py
Normal file
@@ -0,0 +1,71 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, Index, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from database import Base
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
|
||||
import enum
|
||||
|
||||
class Action(str, enum.Enum):
|
||||
UPLOAD = "upload"
|
||||
MATCH = "match"
|
||||
QUERY = "query"
|
||||
CONSUMPTION = "consumption"
|
||||
CREATE = "create"
|
||||
DELETE = "delete"
|
||||
SOLD = "sold"
|
||||
INTERACTION = "interaction"
|
||||
COMMENT = "comment"
|
||||
CONFIG = "config"
|
||||
EMAIL = "email"
|
||||
|
||||
class Target(str, enum.Enum):
|
||||
CLIENT = "client"
|
||||
INVOICES = "invoices"
|
||||
FEED = "feed"
|
||||
EFOS = "efos"
|
||||
CREDITS = "credits"
|
||||
USERS = "users"
|
||||
EMAIL = "email"
|
||||
|
||||
|
||||
class Moves(Base):
|
||||
__tablename__ = "moves"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
|
||||
action_type = Column(SQLEnum(Action, name="action_type", create_type=False), nullable=False)
|
||||
target_type = Column(SQLEnum(Target, name="target_type", create_type=False), nullable=False)
|
||||
|
||||
description = Column(Text, nullable=True)
|
||||
move_metadata = Column(JSONB, nullable=True)
|
||||
|
||||
ip_address = Column(String(45), nullable=True)
|
||||
user_agent = Column(String(255), nullable=True)
|
||||
|
||||
client_id = Column(Integer, ForeignKey("clients.id"), nullable=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
is_active = Column(Boolean, nullable=False, default=True)
|
||||
|
||||
#relationships
|
||||
user = relationship("Users", foreign_keys=[user_id], back_populates="moves")
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
created_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_by = Column(Integer, ForeignKey("users.id"), nullable=True)
|
||||
|
||||
__table_args_ = (
|
||||
Index('idx_moves_client','client_id'),
|
||||
Index('idx_moves_user','user_id'),
|
||||
Index('idx_moves_action','action_type'),
|
||||
Index('idx_moves_target','target_type'),
|
||||
Index('idx_moves_created','created_at'),
|
||||
Index('idx_moves_active','is_active'),
|
||||
)
|
||||
|
||||
#Relaciones
|
||||
client = relationship("Client", foreign_keys=[client_id])
|
||||
creator = relationship("Users", foreign_keys=[created_by])
|
||||
0
app/modules/moves/repository.py
Normal file
0
app/modules/moves/repository.py
Normal file
0
app/modules/moves/route.py
Normal file
0
app/modules/moves/route.py
Normal file
0
app/modules/moves/schema.py
Normal file
0
app/modules/moves/schema.py
Normal file
BIN
app/modules/reports/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/reports/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
0
app/modules/reports/models.py
Normal file
0
app/modules/reports/models.py
Normal file
0
app/modules/reports/repository.py
Normal file
0
app/modules/reports/repository.py
Normal file
0
app/modules/reports/route.py
Normal file
0
app/modules/reports/route.py
Normal file
0
app/modules/reports/schema.py
Normal file
0
app/modules/reports/schema.py
Normal file
BIN
app/modules/suppliers/__pycache__/models.cpython-311.pyc
Normal file
BIN
app/modules/suppliers/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
55
app/modules/suppliers/models.py
Normal file
55
app/modules/suppliers/models.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from sqlalchemy import Column, Integer, String, Index, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class SupplierType(str, enum.Enum):
|
||||
NACIONAL = "nacional"
|
||||
EXTRANJERO = "exttranjero"
|
||||
GLOBAL = "global"
|
||||
|
||||
|
||||
class Suppliers(Base):
|
||||
__tablename__ = "suppliers"
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
|
||||
#Identificacion
|
||||
rfc = Column(String(60), nullable=False, unique=True)
|
||||
email = Column(String(150), nullable=False, unique=True)
|
||||
|
||||
#Datos fiscales
|
||||
short_name = Column(String(255), nullable=True)
|
||||
razon_social = Column(String(255), nullable=False, index=True)
|
||||
fiscal_number = Column(String(15), nullable=False, unique=True)
|
||||
cellphone = Column(String(20), nullable=False)
|
||||
|
||||
supplier_type = Column(SQLEnum(SupplierType, name="suppliertype", create_type=True),
|
||||
nullable=False, default=SupplierType.NACIONAL)
|
||||
|
||||
location_id = Column(Integer, ForeignKey("location.id"), nullable=True)
|
||||
is_active = Column(Boolean, default=True, nullable=False)
|
||||
|
||||
client_id = Column(Integer, ForeignKey("clients.id"), nullable=False)
|
||||
|
||||
#timestamsp
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
deleted_at = Column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
#trace
|
||||
created_by = Column(Integer, nullable=True)
|
||||
updated_by = Column(Integer, nullable=True)
|
||||
deleted_by = Column(Integer, nullable=True)
|
||||
|
||||
#index
|
||||
__table_args__ = (
|
||||
Index('idx_suppliers_client', 'client_id'),
|
||||
Index('idx_suppliers_location', 'location_id'),
|
||||
Index('idx_suppliers_type', 'supplier_type'),
|
||||
Index('idx_suppliers_active', 'is_active'),
|
||||
)
|
||||
|
||||
client = relationship("Client", foreign_keys=[client_id])
|
||||
location = relationship("Locations", foreign_keys=[location_id])
|
||||
0
app/modules/suppliers/repository.py
Normal file
0
app/modules/suppliers/repository.py
Normal file
0
app/modules/suppliers/route.py
Normal file
0
app/modules/suppliers/route.py
Normal file
0
app/modules/suppliers/schema.py
Normal file
0
app/modules/suppliers/schema.py
Normal file
0
app/modules/suppliers/service.py
Normal file
0
app/modules/suppliers/service.py
Normal file
0
app/modules/taxes/models.py
Normal file
0
app/modules/taxes/models.py
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user