Automated Action 2c6298ca4b Implement fintech payment service backend with FastAPI and SQLite
- Set up project structure with FastAPI
- Implement user and account management
- Add send and receive money functionality
- Set up transaction processing system
- Add JWT authentication
- Configure SQLAlchemy with SQLite
- Set up Alembic for database migrations
- Create comprehensive API documentation
2025-06-17 11:53:41 +00:00

31 lines
1.1 KiB
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.base import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
first_name = Column(String, nullable=False)
last_name = Column(String, nullable=False)
hashed_password = Column(String, nullable=False)
is_active = Column(Boolean, default=True)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Relationships
accounts = relationship("Account", back_populates="owner", cascade="all, delete-orphan")
sent_transactions = relationship(
"Transaction",
foreign_keys="[Transaction.sender_id]",
back_populates="sender"
)
received_transactions = relationship(
"Transaction",
foreign_keys="[Transaction.receiver_id]",
back_populates="receiver"
)