Se termina con Tokens y Modulo Usuarios
This commit is contained in:
@@ -18,6 +18,22 @@ class User(Base):
|
||||
# Relationships
|
||||
checklists_created = relationship("Checklist", back_populates="creator")
|
||||
inspections = relationship("Inspection", back_populates="mechanic")
|
||||
api_tokens = relationship("APIToken", back_populates="user", cascade="all, delete-orphan")
|
||||
|
||||
|
||||
class APIToken(Base):
|
||||
__tablename__ = "api_tokens"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
token = Column(String(100), unique=True, index=True, nullable=False)
|
||||
description = Column(String(200))
|
||||
is_active = Column(Boolean, default=True)
|
||||
last_used_at = Column(DateTime(timezone=True))
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
# Relationship
|
||||
user = relationship("User", back_populates="api_tokens")
|
||||
|
||||
|
||||
class Checklist(Base):
|
||||
|
||||
Reference in New Issue
Block a user