• Performs checks on the parentId to ensure it is valid

    Parameters

    • organizationDataService: Pick<OrganizationDataService, "getOrganization">

      injected service use to handle the organization related operations

    • orgUsersDataService: Pick<OrgUserDataService, "getAllOrganizationUsers">

      injected service use to handle the organization users related operations

    • options: {
          idTargetField: null | TargetField;
          maxChildren: number;
          maxDepth: number;
          parentIdTargetField: TargetField;
      }
      • idTargetField: null | TargetField

        the target field for the current id (used for update only, optional)

      • maxChildren: number

        the maximum children allowed for the organization

      • maxDepth: number

        the maximum depth allowed for the organization

      • parentIdTargetField: TargetField

        the target field for the parentId

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

    Returns Promise<StatusCodes>

    200 Status OK

    Description

    Performs the following checks:

    Performs checks on parent Id to see if it is valid

    • If parentId is null/undefined, pass
    • If parentId is string, test organization exists. -> If not exists, throw 400 not exists
    • Check if parentId organization has users -> If users exist on the organization, then throw 501 not implemented
    • Check if parentId organization has a loop I.e. check if parentId organization 'ancestorIds' contains the current id (not relevant for create, only for update)
    • Check if parentId organization depth is too high (arbitrary 8)
    • Check if the parentId has too high of a childrenCount to set more (arbitrary 50)

Generated using TypeDoc