Skip to content

Commit

Permalink
OxoAgentsType
Browse files Browse the repository at this point in the history
  • Loading branch information
elyousfi5 committed Jun 14, 2024
1 parent b2278db commit 0d86b11
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/ostorlab/serve_app/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def resolve_args(
return AgentArgumentsType(args=args)


class AgentsType(graphene.ObjectType):
class OxoAgentsType(graphene.ObjectType):
"""Graphene object type for a list of agents."""

agents = graphene.List(AgentType, required=True)
Expand All @@ -686,7 +686,7 @@ class AgentGroupType(graphene_sqlalchemy.SQLAlchemyObjectType):

key = graphene.String()
agents = graphene.Field(
AgentsType,
OxoAgentsType,
required=True,
page=graphene.Int(required=False),
number_elements=graphene.Int(required=False),
Expand Down Expand Up @@ -724,16 +724,16 @@ def resolve_agents(
info: graphql_base.ResolveInfo,
page: int = None,
number_elements: int = DEFAULT_NUMBER_ELEMENTS,
) -> AgentsType:
) -> OxoAgentsType:
"""Resolve agents query.
Args:
self (models.AgentGroup): The agent group object.
info (graphql_base.ResolveInfo): GraphQL resolve info.
self: The agent group object.
info: GraphQL resolve info.
Returns:
AgentsType: List of agents.
List of agents.
"""
if number_elements <= 0:
return AgentsType(agents=[])
return OxoAgentsType(agents=[])

with models.Database() as session:
agents = (
Expand All @@ -751,9 +751,9 @@ def resolve_agents(
has_next=page.has_next(),
has_previous=page.has_previous(),
)
return AgentsType(agents=page, page_info=page_info)
return OxoAgentsType(agents=page, page_info=page_info)
else:
return AgentsType(agents=agents)
return OxoAgentsType(agents=agents)

def resolve_asset_types(
self: models.AgentGroup, info: graphql_base.ResolveInfo
Expand Down

0 comments on commit 0d86b11

Please sign in to comment.