diff --git a/app/infrastructure/repositories.py b/app/infrastructure/repositories.py index a023c68..22344f2 100644 --- a/app/infrastructure/repositories.py +++ b/app/infrastructure/repositories.py @@ -1065,21 +1065,21 @@ class AgentRepository: } async def get_by_user(self, user_id: str, port: str | None = None) -> list[dict]: - if not port: + if port is None: return [] stmt = select(Agent).where(Agent.user_id == user_id, Agent.port == port) rows = await self.session.scalars(stmt.order_by(Agent.created_at)) return [self._to_dict(a) for a in rows] async def get(self, agent_id: str, user_id: str, port: str | None = None) -> dict | None: - if not port: + if port is None: return None stmt = select(Agent).where(Agent.id == agent_id, Agent.user_id == user_id, Agent.port == port) a = await self.session.scalar(stmt) return self._to_dict(a) if a else None async def count_by_user(self, user_id: str, port: str | None = None) -> int: - if not port: + if port is None: return 0 stmt = select(Agent.id).where(Agent.user_id == user_id, Agent.port == port) return len(list(await self.session.scalars(stmt))) @@ -1114,7 +1114,7 @@ class AgentRepository: return self._to_dict(a) async def update(self, agent_id: str, user_id: str, fields: dict, port: str | None = None) -> dict | None: - if not port: + if port is None: return None stmt = select(Agent).where(Agent.id == agent_id, Agent.user_id == user_id, Agent.port == port) a = await self.session.scalar(stmt) @@ -1134,7 +1134,7 @@ class AgentRepository: return self._to_dict(a) async def delete(self, agent_id: str, user_id: str, port: str | None = None) -> bool: - if not port: + if port is None: return False stmt = select(Agent).where(Agent.id == agent_id, Agent.user_id == user_id, Agent.port == port) a = await self.session.scalar(stmt)