Atualizar app/models.py
This commit is contained in:
@@ -49,6 +49,8 @@ class User(Base):
|
|||||||
twofa_sensitive_actions = Column(Boolean, default=False)
|
twofa_sensitive_actions = Column(Boolean, default=False)
|
||||||
|
|
||||||
role = Column(String, default="user") # "user", "admin"
|
role = Column(String, default="user") # "user", "admin"
|
||||||
|
|
||||||
|
# Legal
|
||||||
consent_training = Column(Boolean, default=False)
|
consent_training = Column(Boolean, default=False)
|
||||||
terms_accepted_at = Column(DateTime, nullable=True)
|
terms_accepted_at = Column(DateTime, nullable=True)
|
||||||
privacy_accepted_at = Column(DateTime, nullable=True)
|
privacy_accepted_at = Column(DateTime, nullable=True)
|
||||||
@@ -56,7 +58,10 @@ class User(Base):
|
|||||||
cookies_accepted_at = Column(DateTime, nullable=True)
|
cookies_accepted_at = Column(DateTime, nullable=True)
|
||||||
security_accepted_at = Column(DateTime, nullable=True)
|
security_accepted_at = Column(DateTime, nullable=True)
|
||||||
|
|
||||||
|
# Billing
|
||||||
|
plan_id = Column(String, ForeignKey("plans.id"), default="free")
|
||||||
|
|
||||||
|
# Capabilities
|
||||||
can_use_audio = Column(Boolean, default=False)
|
can_use_audio = Column(Boolean, default=False)
|
||||||
can_use_vision = Column(Boolean, default=False)
|
can_use_vision = Column(Boolean, default=False)
|
||||||
can_share = Column(Boolean, default=True)
|
can_share = Column(Boolean, default=True)
|
||||||
@@ -72,6 +77,36 @@ class Cache(Base):
|
|||||||
response = Column(Text)
|
response = Column(Text)
|
||||||
created_at = Column(DateTime, default=datetime.utcnow)
|
created_at = Column(DateTime, default=datetime.utcnow)
|
||||||
|
|
||||||
|
class Plan(Base):
|
||||||
|
__tablename__ = "plans"
|
||||||
|
id = Column(String, primary_key=True)
|
||||||
|
name = Column(String)
|
||||||
|
price_monthly = Column(Float)
|
||||||
|
price_yearly = Column(Float)
|
||||||
|
description = Column(Text)
|
||||||
|
|
||||||
|
# ACL / capabilities
|
||||||
|
can_use_audio = Column(Boolean, default=False)
|
||||||
|
can_use_vision = Column(Boolean, default=False)
|
||||||
|
can_import_docs = Column(Boolean, default=True)
|
||||||
|
can_import_excel = Column(Boolean, default=True)
|
||||||
|
can_export_pdf = Column(Boolean, default=False)
|
||||||
|
can_export_md = Column(Boolean, default=True)
|
||||||
|
priority_queue = Column(String, default="default") # default, premium, admin
|
||||||
|
max_conversations = Column(Integer, default=50)
|
||||||
|
max_attachment_size_mb = Column(Integer, default=10)
|
||||||
|
allowed_models = Column(Text) # JSON list of models
|
||||||
|
|
||||||
|
|
||||||
|
class Subscription(Base):
|
||||||
|
__tablename__ = "subscriptions"
|
||||||
|
id = Column(String, primary_key=True)
|
||||||
|
user_email = Column(String, ForeignKey("users.email"))
|
||||||
|
plan_id = Column(String, ForeignKey("plans.id"))
|
||||||
|
status = Column(String) # active, expired, canceled, pending
|
||||||
|
renew_at = Column(DateTime)
|
||||||
|
created_at = Column(DateTime, default=datetime.utcnow)
|
||||||
|
updated_at = Column(DateTime, default=datetime.utcnow)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user