From 64b186314f0375578149a1558a84e9692e29aa00 Mon Sep 17 00:00:00 2001 From: Claude AI Date: Thu, 29 Jan 2026 11:10:13 +0000 Subject: [PATCH] feat(fase4): add GlobalVariable database model Co-Authored-By: Claude Opus 4.5 --- services/api-gateway/app/models/__init__.py | 2 ++ .../api-gateway/app/models/global_variable.py | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 services/api-gateway/app/models/global_variable.py diff --git a/services/api-gateway/app/models/__init__.py b/services/api-gateway/app/models/__init__.py index 027c644..a45b9ad 100644 --- a/services/api-gateway/app/models/__init__.py +++ b/services/api-gateway/app/models/__init__.py @@ -3,6 +3,7 @@ from app.models.whatsapp import WhatsAppAccount, Contact, Conversation, Message from app.models.flow import Flow, FlowSession, TriggerType from app.models.queue import Queue, QueueAgent, AssignmentMethod from app.models.quick_reply import QuickReply +from app.models.global_variable import GlobalVariable __all__ = [ "User", @@ -17,4 +18,5 @@ __all__ = [ "QueueAgent", "AssignmentMethod", "QuickReply", + "GlobalVariable", ] diff --git a/services/api-gateway/app/models/global_variable.py b/services/api-gateway/app/models/global_variable.py new file mode 100644 index 0000000..5272aa1 --- /dev/null +++ b/services/api-gateway/app/models/global_variable.py @@ -0,0 +1,18 @@ +import uuid +from datetime import datetime +from sqlalchemy import Column, String, Text, DateTime, Boolean +from sqlalchemy.dialects.postgresql import UUID +from app.core.database import Base + + +class GlobalVariable(Base): + __tablename__ = "global_variables" + + id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) + key = Column(String(100), nullable=False, unique=True, index=True) + value = Column(Text, nullable=True) + value_type = Column(String(20), default="string", nullable=False) + description = Column(String(500), nullable=True) + is_secret = Column(Boolean, default=False, nullable=False) + created_at = Column(DateTime, default=datetime.utcnow, nullable=False) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)