diff --git a/models.py b/models.py index dfb5690..d88704a 100644 --- a/models.py +++ b/models.py @@ -2,7 +2,7 @@ from sqlalchemy import Column, String, Text, ForeignKey, TIMESTAMP, text from sqlalchemy.orm import relationship from sqlalchemy.types import UUID as PG_UUID -from database import Base +from db_postgres import Base from sqlalchemy.orm import relationship class User(Base): @@ -70,4 +70,4 @@ class TopicInstruction(Base): id = Column(PG_UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) topic_id = Column(PG_UUID(as_uuid=True), ForeignKey("topics.id"), nullable=False) instruction = Column(Text, nullable=False) - topic = relationship("Topic", back_populates="topic_instructions") \ No newline at end of file + topic = relationship("Topic", back_populates="topic_instructions") diff --git a/routers/agents.py b/routers/agents.py index 9015ba0..ad332eb 100644 --- a/routers/agents.py +++ b/routers/agents.py @@ -22,6 +22,10 @@ def get_agents( db: Session = Depends(get_db), current_user: models.User = Depends(get_current_user) ): + agents = crud.get_agents(db) + # Populate creator information if not already done + for agent in agents: + agent.creator_name = f"{agent.user.first_name} {agent.user.last_name}" return crud.get_agents(db) @router.get("/agents/{agent_id}", response_model=agent_schemas.AgentResponse) diff --git a/schemas/agent_schemas.py b/schemas/agent_schemas.py index 898fbd2..bbd7b5e 100644 --- a/schemas/agent_schemas.py +++ b/schemas/agent_schemas.py @@ -26,7 +26,10 @@ class AgentResponse(AgentBase): user_id: UUID modified_by: Optional[UUID] = None topics: List[TopicResponse] = [] - + + # New field to include creator's name + creator_name: Optional[str] = None + class Config: from_attributes = True