Automated Action 43235eb604 Create TechDating API backend
- Setup project structure and basic FastAPI application
- Define database models for users, profiles, matches, and messages
- Set up database connection and create Alembic migrations
- Implement user authentication and registration endpoints
- Create API endpoints for profile management, matches, and messaging
- Add filtering and search functionality for tech profiles
- Setup environment variable configuration
- Create README with project information and setup instructions
2025-05-28 15:17:44 +00:00

25 lines
1.2 KiB
Python

from sqlalchemy import Boolean, Column, Integer, String, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from app.db.session import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True, nullable=False)
username = Column(String, unique=True, index=True, nullable=False)
hashed_password = Column(String, nullable=False)
is_active = Column(Boolean, default=True)
is_superuser = Column(Boolean, default=False)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Relationships
profile = relationship("Profile", back_populates="user", uselist=False)
sent_matches = relationship("Match", foreign_keys="Match.sender_id", back_populates="sender")
received_matches = relationship("Match", foreign_keys="Match.receiver_id", back_populates="receiver")
sent_messages = relationship("Message", foreign_keys="Message.sender_id", back_populates="sender")
received_messages = relationship("Message", foreign_keys="Message.receiver_id", back_populates="receiver")