from sqlalchemy import Column, String from sqlalchemy.orm import relationship, mapped_column, Mapped from fastapi_users.db import SQLAlchemyBaseUserTableUUID, SQLAlchemyBaseOAuthAccountTableUUID from sqlalchemy.sql.sqltypes import JSON from app.core.base import Base class OAuthAccount(SQLAlchemyBaseOAuthAccountTableUUID, Base): # BankID token is longer than default access_token: Mapped[str] = mapped_column(String(length=4096), nullable=False) class User(SQLAlchemyBaseUserTableUUID, Base): first_name = Column(String(length=100), nullable=True) last_name = Column(String(length=100), nullable=True) oauth_accounts = relationship("OAuthAccount", lazy="joined") config = Column(JSON, default={}) # Relationship transactions = relationship("Transaction", back_populates="user") categories = relationship("Category", back_populates="user")