mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 06:57:47 +01:00
20 lines
802 B
Python
20 lines
802 B
Python
from sqlalchemy import Column, String
|
|
from sqlalchemy.orm import relationship, mapped_column, Mapped
|
|
from fastapi_users.db import SQLAlchemyBaseUserTableUUID, SQLAlchemyBaseOAuthAccountTableUUID
|
|
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")
|
|
|
|
# Relationship
|
|
transactions = relationship("Transaction", back_populates="user")
|
|
categories = relationship("Category", back_populates="user")
|