Add Auth model

This commit is contained in:
Backend IM Bot 2025-03-26 17:10:58 +00:00
parent 96a0bbe860
commit 290808c687

15
models/auth.py Normal file
View File

@ -0,0 +1,15 @@
from sqlalchemy import Column, String, DateTime, Boolean
from sqlalchemy.sql import func
from core.database import Base
import uuid
class Auth(Base):
__tablename__ = "auth"
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
user_id = Column(String, nullable=False, index=True)
token = Column(String, nullable=False, unique=True)
is_blacklisted = Column(Boolean, default=False)
expires_at = Column(DateTime, nullable=False)
created_at = Column(DateTime, default=func.now())
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())