diff --git a/src/application/domain/entities/user.py b/src/application/domain/entities/user.py index f0a7961..b7c2634 100644 --- a/src/application/domain/entities/user.py +++ b/src/application/domain/entities/user.py @@ -17,10 +17,9 @@ class UserEntity: crypto_wallet: str | None = None phone: str | None = None - bik: str | None = None - account_number: str | None = None - card_number: str | None = None + passport_data: str | None = None inn: str | None = None + erc20: str | None = None kyc_verified: bool | None = None is_deleted: bool | None = None diff --git a/src/infrastructure/cache/keydb_client.py b/src/infrastructure/cache/keydb_client.py index 494c3e9..56a3ca1 100644 --- a/src/infrastructure/cache/keydb_client.py +++ b/src/infrastructure/cache/keydb_client.py @@ -42,10 +42,9 @@ class KeydbCache(ICache): 'birth_date': str(user.birth_date) if user.birth_date else None, 'crypto_wallet': user.crypto_wallet, 'phone': user.phone, - 'bik': user.bik, - 'account_number': user.account_number, - 'card_number': user.card_number, + 'passport_data': user.passport_data, 'inn': user.inn, + 'erc20': user.erc20, 'kyc_verified': user.kyc_verified, 'is_deleted': user.is_deleted, 'created_at': user.created_at.isoformat() if user.created_at else None, diff --git a/src/infrastructure/cache/remote_cache.py b/src/infrastructure/cache/remote_cache.py index 892ad3a..38cc508 100644 --- a/src/infrastructure/cache/remote_cache.py +++ b/src/infrastructure/cache/remote_cache.py @@ -55,10 +55,9 @@ class RemoteCache(ICache): 'birth_date': str(user.birth_date) if user.birth_date else None, 'crypto_wallet': user.crypto_wallet, 'phone': user.phone, - 'bik': user.bik, - 'account_number': user.account_number, - 'card_number': user.card_number, + 'passport_data': user.passport_data, 'inn': user.inn, + 'erc20': user.erc20, 'kyc_verified': user.kyc_verified, 'is_deleted': user.is_deleted, 'created_at': user.created_at.isoformat() if user.created_at else None, diff --git a/src/infrastructure/database/models/user.py b/src/infrastructure/database/models/user.py index b0ea948..68c2479 100644 --- a/src/infrastructure/database/models/user.py +++ b/src/infrastructure/database/models/user.py @@ -1,30 +1,29 @@ from __future__ import annotations -from sqlalchemy import Boolean,Date,DateTime,String +from sqlalchemy import Boolean,Date,String,DateTime from sqlalchemy.orm import Mapped,mapped_column from src.infrastructure.database.models.base import Base -from src.infrastructure.database.models.mixins import AuditTimestampsMixin,SoftDeleteMixin,UlidPrimaryKeyMixin +from src.infrastructure.database.models.mixins import UlidPrimaryKeyMixin,AuditTimestampsMixin,SoftDeleteMixin -class UserModel(Base,UlidPrimaryKeyMixin,AuditTimestampsMixin,SoftDeleteMixin): - __tablename__='users' +class UserModel(Base, UlidPrimaryKeyMixin, AuditTimestampsMixin, SoftDeleteMixin): + __tablename__ = 'users' - email: Mapped[str]=mapped_column(String(255),nullable=False,unique=True,index=True) - password_hash: Mapped[str]=mapped_column(String(255),nullable=False) + email: Mapped[str] = mapped_column(String(255), nullable=False, unique=True, index=True) + password_hash: Mapped[str] = mapped_column(String(255), nullable=False) - last_name: Mapped[str|None]=mapped_column(String(128),nullable=True) - first_name: Mapped[str|None]=mapped_column(String(128),nullable=True) - middle_name: Mapped[str|None]=mapped_column(String(128),nullable=True) - birth_date: Mapped[Date|None]=mapped_column(Date,nullable=True) + last_name: Mapped[str | None] = mapped_column(String(128), nullable=True) + first_name: Mapped[str | None] = mapped_column(String(128), nullable=True) + middle_name: Mapped[str | None] = mapped_column(String(128), nullable=True) + birth_date: Mapped[Date | None] = mapped_column(Date, nullable=True) - crypto_wallet: Mapped[str|None]=mapped_column(String(255),nullable=True) - phone: Mapped[str|None]=mapped_column(String(16),nullable=True) + crypto_wallet: Mapped[str | None] = mapped_column(String(255), nullable=True) + phone: Mapped[str | None] = mapped_column(String(16), nullable=True) - bik: Mapped[str|None]=mapped_column(String(9),nullable=True) - account_number: Mapped[str|None]=mapped_column(String(20),nullable=True) - card_number: Mapped[str|None]=mapped_column(String(19),nullable=True) - inn: Mapped[str|None]=mapped_column(String(12),nullable=True) + passport_data: Mapped[str | None] = mapped_column(String(255), nullable=True) + inn: Mapped[str | None] = mapped_column(String(12), nullable=True) + erc20: Mapped[str | None] = mapped_column(String(255), nullable=True) - kyc_verified: Mapped[bool]=mapped_column(Boolean,nullable=False,server_default='false',default=False) - kyc_verified_at: Mapped[DateTime|None]=mapped_column(DateTime(timezone=True),nullable=True) + kyc_verified: Mapped[bool] = mapped_column(Boolean, nullable=False, server_default='false', default=False) + kyc_verified_at: Mapped[DateTime | None] = mapped_column(DateTime(timezone=True), nullable=True) diff --git a/src/infrastructure/database/repositories/user_repository.py b/src/infrastructure/database/repositories/user_repository.py index 5761911..f5d716a 100644 --- a/src/infrastructure/database/repositories/user_repository.py +++ b/src/infrastructure/database/repositories/user_repository.py @@ -26,10 +26,9 @@ class UserRepository(IUserRepository): birth_date=model.birth_date, crypto_wallet=model.crypto_wallet, phone=model.phone, - bik=model.bik, - account_number=model.account_number, - card_number=model.card_number, + passport_data=model.passport_data, inn=model.inn, + erc20=model.erc20, kyc_verified=model.kyc_verified, is_deleted=model.is_deleted, created_at=model.created_at, diff --git a/src/main.py b/src/main.py index f45aa52..5bbc327 100644 --- a/src/main.py +++ b/src/main.py @@ -88,7 +88,7 @@ app.add_middleware( hsts_preload=False, frame_options='DENY', referrer_policy='strict-origin-when-cross-origin', - content_security_policy="default-src 'self'; frame-ancestors 'none'; base-uri 'self'; object-src 'none'", + content_security_policy="default-src 'self'; script-src 'self' 'unsafe-inline' https://unpkg.com https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline' https://unpkg.com; img-src 'self' data: https://fastapi.tiangolo.com; frame-ancestors 'none'; base-uri 'self'; object-src 'none'", )