Use DB hierarchy restrictions

What does this MR do and why?

  • uses hierarchy restrictions stored in DB to validate parent/child types when creating new parent/child relationship
  • maximum_depth restriction is not validated yet - this will be added in a separate MR

Related to #378801 (closed)

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. In rails console enable db restrictions and okrs_mvc flags
    Feature.enable(:hierarchy_db_restrictions)
    Feature.enable(:okrs_mvc)
  2. Validate with mutation which creates new key result under objective:
mutation {
  workItemCreate(input: {projectPath: "flightjs/Flight",title: "test", workItemTypeId: "gid://gitlab/WorkItems::Type/92", hierarchyWidget: {parentId: "gid://gitlab/WorkItem/630"}}) {
    errors
  	workItem {
    	id
    	workItemType {
	      id
  	    name
    	}
    	widgets {
      	... on WorkItemWidgetHierarchy {
          parent {
            id
            title
          }
          availableChildrenTypes {
            nodes{
            	id
            	name
            }
          }
      	  }
    	}
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jan Provaznik

Merge request reports

Loading