• This validator prevents owner user of an organization from updating owner role on another organization that shares an identical name.

    Parameters

    • organizationService: OrganizationDataService
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<util.StatusCodes>

    200 Status OK

    Description

    If an owner role users update their owner role to another organization with an identical name, the users become owner on two organizations.

    This validator prevents the user from being an owner of multiple organizations with identical names.

    1. Filter the array where the role property contains the value 'owner'.

    2. Retrieve the organization name using the orgId found in the URL parameter.

    3. Validate if the userId within the body corresponds to an owner associated with the same organization name.

    4. Verify the existing record to confirm if the orgId specified in the parameter aligns with the orgId in record.

    Throws

    400 NBError Bad Request

    • updating owner role on different organization with the same name

Generated using TypeDoc