Loginauth / models.py
Gregniuki's picture
Update models.py
9334ecd
raw
history blame
1.25 kB
# models.py
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from base import Base
# Your model definitions here
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
hashed_password = Column(String)
is_verified = Column(Boolean, default=False)
credits = Column(Integer, default=10000)
selected_tts_models = Column(String, default='default.onnx') # Store as a string
# Define other user fields as needed
# Add the relationship with VerificationToken
verification_tokens = relationship("VerificationToken", back_populates="user")
# Define other database models as needed
class VerificationToken(Base):
__tablename__ = "verification_tokens"
id = Column(Integer, primary_key=True, index=True)
token = Column(String, unique=True, index=True)
user_id = Column(Integer, ForeignKey('users.id'), nullable=False)
created_at = Column(DateTime(timezone=True), server_default=func.now())
# Define a relationship with the User model
user = relationship("User", back_populates="verification_tokens")