Merge pull request #686 from SuanmoSuanyangTechnology/feature/user-alias
Feature/user alias
This commit is contained in:
@@ -16,6 +16,7 @@ from .agent_app_config_model import AgentConfig
|
||||
from .app_release_model import AppRelease
|
||||
from .memory_increment_model import MemoryIncrement
|
||||
from .end_user_model import EndUser
|
||||
from .end_user_info_model import EndUserInfo
|
||||
from .appshare_model import AppShare
|
||||
from .release_share_model import ReleaseShare
|
||||
from .conversation_model import Conversation, Message
|
||||
@@ -60,6 +61,7 @@ __all__ = [
|
||||
"AppRelease",
|
||||
"MemoryIncrement",
|
||||
"EndUser",
|
||||
"EndUserInfo",
|
||||
"AppShare",
|
||||
"ReleaseShare",
|
||||
"Conversation",
|
||||
|
||||
24
api/app/models/end_user_info_model.py
Normal file
24
api/app/models/end_user_info_model.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, DateTime, ForeignKey, String, Text, ARRAY
|
||||
from sqlalchemy.dialects.postgresql import UUID, JSONB
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from app.db import Base
|
||||
|
||||
|
||||
class EndUserInfo(Base):
|
||||
"""终端用户信息表 - 存储用户的别名和扩展信息"""
|
||||
__tablename__ = "end_user_info"
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, nullable=False, index=True)
|
||||
end_user_id = Column(UUID(as_uuid=True), ForeignKey("end_users.id"), nullable=False, index=True, comment="关联的终端用户ID")
|
||||
other_name = Column(String, nullable=False, comment="关联的用户名称")
|
||||
aliases = Column(ARRAY(String), nullable=True, comment="用户别名列表(字符串数组)")
|
||||
meta_data = Column(JSONB, nullable=True, comment="用户相关的扩展信息(JSON格式)")
|
||||
created_at = Column(DateTime, default=datetime.datetime.now, comment="创建时间")
|
||||
updated_at = Column(DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment="更新时间")
|
||||
|
||||
# 与 EndUser 的关系
|
||||
end_user = relationship("EndUser", back_populates="info")
|
||||
@@ -30,14 +30,6 @@ class EndUser(Base):
|
||||
comment="关联的记忆配置ID"
|
||||
)
|
||||
|
||||
# 用户基本信息字段
|
||||
position = Column(String, nullable=True, comment="职位")
|
||||
department = Column(String, nullable=True, comment="部门")
|
||||
contact = Column(String, nullable=True, comment="联系方式")
|
||||
phone = Column(String, nullable=True, comment="电话")
|
||||
hire_date = Column(DateTime, nullable=True, comment="入职日期")
|
||||
updatetime_profile = Column(DateTime, nullable=True, comment="核心档案信息最后更新时间")
|
||||
|
||||
# 用户摘要四个维度 - User Summary Four Dimensions
|
||||
user_summary = Column(Text, nullable=True, comment="缓存的用户摘要(基本介绍)")
|
||||
personality_traits = Column(Text, nullable=True, comment="性格特点")
|
||||
@@ -65,4 +57,7 @@ class EndUser(Base):
|
||||
)
|
||||
|
||||
# 与 WorkSpace 的反向关系
|
||||
workspace = relationship("Workspace", back_populates="end_users")
|
||||
workspace = relationship("Workspace", back_populates="end_users")
|
||||
|
||||
# 与 EndUserInfo 的反向关系
|
||||
info = relationship("EndUserInfo", back_populates="end_user", cascade="all, delete-orphan")
|
||||
Reference in New Issue
Block a user