File size: 1,322 Bytes
b8199c4
 
9334ecd
fbb097f
 
b8199c4
50160e7
b8199c4
50160e7
 
 
 
 
 
 
5764c74
9334ecd
3930b6b
50160e7
fbb097f
 
9334ecd
50160e7
fbb097f
 
 
 
 
 
 
 
 
9334ecd
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
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
    email_verification_token = Column(String, unique=True, nullable=True)
    # 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")