anime-gen-api / app /models /user.py
AswinMathew's picture
Hybrid pollen-paced video gen, BYOP, background consistency, browser notifications
c4dfe24 verified
raw
history blame contribute delete
951 Bytes
from sqlalchemy import Column, Integer, String, DateTime, func
from sqlalchemy.orm import relationship
from app.database import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, autoincrement=True)
email = Column(String(255), unique=True, nullable=False, index=True)
username = Column(String(100), unique=True, nullable=False, index=True)
password_hash = Column(String(255), nullable=False)
role = Column(String(20), default="user") # user, admin
pollinations_api_key = Column(String(500), nullable=True) # BYOP: user's own Pollinations key
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
projects = relationship("Project", back_populates="user", cascade="all, delete-orphan")
generation_jobs = relationship("GenerationJob", back_populates="user", cascade="all, delete-orphan")