GraphQL Add filter to course tools #2644

pull/2715/head
Angel Fernando Quiroz Campos 6 years ago
parent c81ee0efd6
commit 577c0afede
  1. 6
      src/ApiBundle/GraphQL/Resolver/CourseResolver.php
  2. 10
      src/ApiBundle/GraphQL/Resources/config/Enum.types.yaml
  3. 4
      src/ApiBundle/GraphQL/Resources/config/Query.types.yaml

@ -120,6 +120,12 @@ class CourseResolver implements ResolverInterface, ContainerAwareInterface
}
});
if (!empty($args['type'])) {
$tools = array_filter($tools, function ($tool) use ($args) {
return $tool['name'] === $args['type'];
});
}
$ids = array_column($tools, 'iid');
$qb = $this->em->createQueryBuilder();

@ -39,3 +39,13 @@ ImageSize:
SIZE_HUGE:
description: 'Image in small size: 128px.'
value: '@=constant("ICON_SIZE_HUGE")'
CourseToolType:
type: enum
config:
description: 'One of the types of course tool'
values:
TOOL_DESCRIPTION:
value: '@=constant("TOOL_COURSE_DESCRIPTION")'
TOOL_ANNOUNCEMENT:
value: '@=constant("TOOL_ANNOUNCEMENT")'

@ -135,6 +135,10 @@ Course:
tools:
description: 'List of available tools for student view.'
type: '[CourseTool]'
args:
type:
description: 'Filter by one type of tool'
type: 'CourseToolType'
SessionCategory:
type: object

Loading…
Cancel
Save