fix(models): correct relationship and import paths for universign models
This commit is contained in:
parent
a68f5af72e
commit
9f5ccb8e7b
3 changed files with 13 additions and 9 deletions
|
|
@ -24,8 +24,10 @@ from database.models.universign import (
|
||||||
UniversignTransaction,
|
UniversignTransaction,
|
||||||
UniversignSigner,
|
UniversignSigner,
|
||||||
UniversignSyncLog,
|
UniversignSyncLog,
|
||||||
|
UniversignTransactionStatus,
|
||||||
LocalDocumentStatus,
|
LocalDocumentStatus,
|
||||||
SageDocumentType,
|
UniversignSignerStatus,
|
||||||
|
SageDocumentType
|
||||||
)
|
)
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -49,6 +51,8 @@ __all__ = [
|
||||||
"UniversignTransaction",
|
"UniversignTransaction",
|
||||||
"UniversignSigner",
|
"UniversignSigner",
|
||||||
"UniversignSyncLog",
|
"UniversignSyncLog",
|
||||||
|
"UniversignTransactionStatus",
|
||||||
"LocalDocumentStatus",
|
"LocalDocumentStatus",
|
||||||
"SageDocumentType",
|
"UniversignSignerStatus",
|
||||||
|
"SageDocumentType"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,7 @@ class UniversignSyncLog(Base):
|
||||||
response_time_ms = Column(Integer, nullable=True)
|
response_time_ms = Column(Integer, nullable=True)
|
||||||
|
|
||||||
# === RELATION ===
|
# === RELATION ===
|
||||||
transaction = relationship("UniversignSyncLog", back_populates="sync_logs")
|
transaction = relationship("UniversignTransaction", back_populates="sync_logs")
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<SyncLog {self.sync_type} at {self.sync_timestamp}>"
|
return f"<SyncLog {self.sync_type} at {self.sync_timestamp}>"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
from sqlalchemy import select, and_, or_
|
from sqlalchemy import select, and_, or_
|
||||||
from sqlalchemy.orm import selectinload
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
from database.models.universign_models import (
|
from database import (
|
||||||
UniversignTransaction,
|
UniversignTransaction,
|
||||||
UniversignSigner,
|
UniversignSigner,
|
||||||
UniversignSyncLog,
|
UniversignSyncLog,
|
||||||
|
|
@ -20,7 +20,7 @@ from database.models.universign_models import (
|
||||||
LocalDocumentStatus,
|
LocalDocumentStatus,
|
||||||
UniversignSignerStatus,
|
UniversignSignerStatus,
|
||||||
)
|
)
|
||||||
from status_mapping import (
|
from utils.universign_status_mapping import (
|
||||||
map_universign_to_local,
|
map_universign_to_local,
|
||||||
get_sage_status_code,
|
get_sage_status_code,
|
||||||
is_transition_allowed,
|
is_transition_allowed,
|
||||||
|
|
@ -279,14 +279,14 @@ class UniversignSyncService:
|
||||||
select(UniversignTransaction)
|
select(UniversignTransaction)
|
||||||
.where(
|
.where(
|
||||||
and_(
|
and_(
|
||||||
UniversignTransaction.needs_sync == True,
|
UniversignTransaction.needs_sync,
|
||||||
or_(
|
or_(
|
||||||
# Transactions non finales
|
# Transactions non finales
|
||||||
~UniversignTransaction.local_status.in_(
|
~UniversignTransaction.local_status.in_(
|
||||||
[
|
[
|
||||||
LocalDocumentStatus.SIGNE,
|
LocalDocumentStatus.SIGNED,
|
||||||
LocalDocumentStatus.REFUSE,
|
LocalDocumentStatus.REJECTED,
|
||||||
LocalDocumentStatus.EXPIRE,
|
LocalDocumentStatus.EXPIRED,
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
# OU dernière sync > 1h (vérification finale)
|
# OU dernière sync > 1h (vérification finale)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue