from pydantic import BaseModel from sqlalchemy import Column, JSON from sqlmodel import Field, SQLModel from app.models.common import AESEncryptedColumn, DeploymentType from app.models.kb_generate_task import KBGenerateConfig class JiraSiteConfig(KBGenerateConfig): pass class JiraSite(SQLModel, table=True): __tablename__ = "jira_sites" id: int = Field(primary_key=True) deployment_type: DeploymentType = Field(nullable=False) host: str = Field(nullable=False, max_length=128) name: str = Field(nullable=False, max_length=32) bot_user_id: str = Field(nullable=False, description="user email") bot_user_token: str = Field(sa_column=Column(AESEncryptedColumn, nullable=False)) config: JiraSiteConfig = Field(default={}, sa_column=Column(JSON))