from sqlalchemy import Column, String, Integer, Boolean, DateTime, ForeignKey, Float from sqlalchemy.orm import relationship from sqlalchemy.sql import func from core.database import Base import uuid from datetime import datetime class User(Base): __tablename__ = "users" id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4())) first_name = Column(String, nullable=False) last_name = Column(String, nullable=False) email = Column(String, unique=True, nullable=False, index=True) phone = Column(String, nullable=False) password = Column(String, nullable=False) address = Column(String) city = Column(String) country = Column(String) is_active = Column(Boolean, default=True) is_admin = Column(Boolean, default=False) # Relationships bookings = relationship("Booking", back_populates="user") reviews = relationship("Review", back_populates="user") payments = relationship("Payment", back_populates="user") # Timestamps created_at = Column(DateTime, default=func.now()) updated_at = Column(DateTime, default=func.now(), onupdate=func.now())