File size: 1,201 Bytes
fc76af0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, Float, ARRAY, DateTime
from sqlalchemy.orm import relationship
from core.database import Base
from datetime import datetime
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
username = Column(String, unique=True, index=True)
hashed_password = Column(String)
first_name = Column(String)
last_name = Column(String)
age = Column(Integer)
preferences = Column(ARRAY(String))
is_active = Column(Boolean, default=True)
is_admin = Column(Boolean, default=False)
updated_at = Column(DateTime, default=datetime.utcnow)
created_at = Column(DateTime, default=datetime.utcnow)
orders = relationship("Order", back_populates="user")
embeddings = relationship("UserEmbeddings", back_populates="user", uselist=False)
class UserEmbeddings(Base):
__tablename__ = "user_embeddings"
id = Column(Integer, primary_key=True, index=True)
user_id = Column(Integer, ForeignKey("users.id"))
embeddings = Column(ARRAY(Float))
user = relationship("User", back_populates="embeddings")
|