by_overview.rb 904 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. module Gql::Queries
  3. class Tickets::ByOverview < BaseQuery
  4. description 'Fetch tickets of a given ticket overview'
  5. argument :overview_id, GraphQL::Types::ID, loads: Gql::Types::OverviewType, description: 'Overview ID'
  6. argument :order_by, String, required: false, description: 'Set a custom order by'
  7. argument :order_direction, Gql::Types::Enum::OrderDirectionType, required: false, description: 'Set a custom order direction'
  8. type Gql::Types::TicketType.connection_type, null: false
  9. def resolve(overview:, order_by: nil, order_direction: nil)
  10. # This will fetch tickets with 'overview' permissions, which logically include 'read' permissions.
  11. ::Ticket::Overviews.tickets_for_overview(overview, context.current_user, order_by: order_by, order_direction: order_direction)
  12. end
  13. end
  14. end