
- 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
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
from sqlalchemy import Column, Integer, DateTime, ForeignKey, Enum
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
import enum
|
|
|
|
from app.db.session import Base
|
|
|
|
|
|
class MatchStatusEnum(str, enum.Enum):
|
|
pending = "pending"
|
|
accepted = "accepted"
|
|
rejected = "rejected"
|
|
|
|
|
|
class Match(Base):
|
|
__tablename__ = "matches"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
sender_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
receiver_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
status = Column(Enum(MatchStatusEnum), default=MatchStatusEnum.pending, nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
# Relationships
|
|
sender = relationship("User", foreign_keys=[sender_id], back_populates="sent_matches")
|
|
receiver = relationship("User", foreign_keys=[receiver_id], back_populates="received_matches")
|
|
messages = relationship("Message", back_populates="match") |