Class: WorkItems::TypesFramework::SystemDefined::HierarchyRestriction

Inherits:
Object
  • Object
show all
Includes:
ActiveRecord::FixedItemsModel::Model
Defined in:
app/models/work_items/types_framework/system_defined/hierarchy_restriction.rb

Constant Summary collapse

EPIC_ID =
::WorkItems::Type::BASE_TYPES[:epic][:id]
ISSUE_ID =
::WorkItems::Type::BASE_TYPES[:issue][:id]
TASK_ID =
::WorkItems::Type::BASE_TYPES[:task][:id]
OBJECTIVE_ID =
::WorkItems::Type::BASE_TYPES[:objective][:id]
KEY_RESULT_ID =
::WorkItems::Type::BASE_TYPES[:key_result][:id]
INCIDENT_ID =
::WorkItems::Type::BASE_TYPES[:incident][:id]
TICKET_ID =
::WorkItems::Type::BASE_TYPES[:ticket][:id]
ITEMS =
[
  {
    id: 1,
    parent_type_id: OBJECTIVE_ID,
    child_type_id: OBJECTIVE_ID,
    maximum_depth: 9
  },
  {
    id: 2,
    parent_type_id: OBJECTIVE_ID,
    child_type_id: KEY_RESULT_ID,
    maximum_depth: 1
  },
  {
    id: 3,
    parent_type_id: ISSUE_ID,
    child_type_id: TASK_ID,
    maximum_depth: 1
  },
  {
    id: 4,
    parent_type_id: INCIDENT_ID,
    child_type_id: TASK_ID,
    maximum_depth: 1
  },
  {
    id: 5,
    parent_type_id: EPIC_ID,
    child_type_id: EPIC_ID,
    maximum_depth: 7
  },
  {
    id: 6,
    parent_type_id: EPIC_ID,
    child_type_id: ISSUE_ID,
    maximum_depth: 1
  },
  {
    id: 7,
    parent_type_id: TICKET_ID,
    child_type_id: TASK_ID,
    maximum_depth: 1
  },
  {
    id: 8,
    parent_type_id: EPIC_ID,
    child_type_id: TICKET_ID,
    maximum_depth: 1
  }
].freeze

Class Method Summary collapse

Class Method Details

.hierarchy_relationship_allowed?(parent_type_id:, child_type_id:) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/work_items/types_framework/system_defined/hierarchy_restriction.rb', line 26

def hierarchy_relationship_allowed?(parent_type_id:, child_type_id:)
  where(parent_type_id: parent_type_id, child_type_id: child_type_id).present?
end

.with_parent_type_id(parent_type_id) ⇒ Object



22
23
24
# File 'app/models/work_items/types_framework/system_defined/hierarchy_restriction.rb', line 22

def with_parent_type_id(parent_type_id)
  where(parent_type_id: parent_type_id)
end