File size: 1,287 Bytes
b8199c4 732833a fbb097f b8199c4 50160e7 b8199c4 50160e7 5764c74 50160e7 fbb097f 50160e7 fbb097f |
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 |
# models.py
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean, ARRAY
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(ARRAY(String), default=['default.onnx']) # Set the default value to 'default.onnx'
# 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")
|