teszt állományok áthelyezése és szelektálása

This commit is contained in:
Roo
2026-06-05 10:50:25 +00:00
parent 18524a08f2
commit f03b5f3916
63 changed files with 633 additions and 527 deletions

View File

@@ -0,0 +1,70 @@
import re
with open('backend/app/services/auth_service.py', 'r') as f:
content = f.read()
shadow_logic = """
p = user.person
# --- SHADOW IDENTITY CHECK ---
shadow_stmt = select(Person).where(
and_(
Person.last_name == kyc_in.last_name if hasattr(kyc_in, "last_name") else Person.last_name == p.last_name,
Person.first_name == kyc_in.first_name if hasattr(kyc_in, "first_name") else Person.first_name == p.first_name,
Person.birth_date == kyc_in.birth_date,
Person.id != p.id # Ne a jelenlegit találja meg
)
)
if kyc_in.birth_date:
shadow_person = (await db.execute(shadow_stmt)).scalar_one_or_none()
else:
shadow_person = None
if shadow_person:
logger.info(f"Shadow Identity megtalálva a {user.id} userhez: Person ID {shadow_person.id}")
user.person_id = shadow_person.id
# Frissítjük a megtalált Person rekordot a KYC adatokkal
shadow_person.mothers_last_name = kyc_in.mothers_last_name
shadow_person.mothers_first_name = kyc_in.mothers_first_name
shadow_person.birth_place = kyc_in.birth_place
shadow_person.phone = kyc_in.phone_number
shadow_person.address_id = addr_id
shadow_person.identity_docs = jsonable_encoder(kyc_in.identity_docs)
shadow_person.is_active = True
# Inaktiváljuk/töröljük a megárvult eredeti Person-t
p.is_active = False
p.is_ghost = True
p = shadow_person
else:
p.mothers_last_name = kyc_in.mothers_last_name
p.mothers_first_name = kyc_in.mothers_first_name
p.birth_place = kyc_in.birth_place
p.birth_date = kyc_in.birth_date
p.phone = kyc_in.phone_number
p.address_id = addr_id
p.identity_docs = jsonable_encoder(kyc_in.identity_docs)
p.is_active = True
# --- SHADOW CHECK VÉGE ---
"""
old_logic = """ # Person adatok dúsítása
p = user.person
p.mothers_last_name = kyc_in.mothers_last_name
p.mothers_first_name = kyc_in.mothers_first_name
p.birth_place = kyc_in.birth_place
p.birth_date = kyc_in.birth_date
p.phone = kyc_in.phone_number
p.address_id = addr_id
p.identity_docs = jsonable_encoder(kyc_in.identity_docs)
p.is_active = True"""
if old_logic in content:
content = content.replace(old_logic, shadow_logic)
with open('backend/app/services/auth_service.py', 'w') as f:
f.write(content)
print("Patched auth_service.py")
else:
print("Could not find the target code in auth_service.py")