first commit
This commit is contained in:
26
backend/app/models/datasource_config.py
Normal file
26
backend/app/models/datasource_config.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""User-defined Data Source Configuration model"""
|
||||
|
||||
from sqlalchemy import Boolean, Column, DateTime, Integer, String, Text, JSON
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from app.db.session import Base
|
||||
|
||||
|
||||
class DataSourceConfig(Base):
|
||||
__tablename__ = "datasource_configs"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
name = Column(String(100), nullable=False)
|
||||
description = Column(Text)
|
||||
source_type = Column(String(50), nullable=False) # http, api, database, etc.
|
||||
endpoint = Column(String(500))
|
||||
auth_type = Column(String(20), default="none") # none, bearer, api_key, basic
|
||||
auth_config = Column(JSON, default={}) # Encrypted credentials
|
||||
headers = Column(JSON, default={})
|
||||
config = Column(JSON, default={}) # Additional config like timeout, retry, etc.
|
||||
is_active = Column(Boolean, default=True)
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
|
||||
def __repr__(self):
|
||||
return f"<DataSourceConfig {self.id}: {self.name}>"
|
||||
Reference in New Issue
Block a user