Skip to content

Add customer relations contact create mutation

What does this MR do and why?

Adds the ability to create CustomerRelations::Contact via GraphQL.

See !69472 (merged) for similar MR for CustomerRelations::Organization

Screenshots or screen recordings

image

How to set up and validate locally

  1. Enable feature flag from rails console
rails c
Feature.enable(:customer_relations)
  1. Create an organization (picking a group such as flightjs)
mutation {
  customerRelationsOrganizationCreate(input:
    { 
      name: "Hoorah!"
      groupId: "gid://gitlab/Group/26" 
    }) {
    organization {
      id
      name
      description
      createdAt
      updatedAt
    }
    errors
  }
}
  1. Create contact for the organization:
mutation {
  customerRelationsContactCreate(input:
    {
      groupId: "gid://gitlab/Group/26"
      firstName: "Lee"
      lastName: "Tickett"
      description: "Managing Director"
      email: "a@gitlab.example"
      phone: "07777 777777"
      organizationId: "gid://gitlab/CustomerRelations::Organization/1"
    }) {
    contact {
      id
      firstName
      lastName
      description
      email
      phone
      organization {
        id
        name        
      }
      createdAt
      updatedAt
    }
    errors
  }
}
  1. Create contact without an organization:
mutation {
  customerRelationsContactCreate(input:
    {
      groupId: "gid://gitlab/Group/26"
      firstName: "Lee"
      lastName: "Tickett"
      description: "Managing Director"
      email: "a@gitlab.example"
      phone: "07777 777777"
    }) {
    contact {
      id
      firstName
      lastName
      description
      email
      phone
      organization {
        id
        name        
      }
      createdAt
      updatedAt
    }
    errors
  }
}
  1. Query contacts to ensure persisted and AOK:
query {
  group(fullPath: "flightjs") { 
    contacts {
      nodes {
        id
        firstName
        lastName
        email
        phone
        description
        organization {
          id
          name
        }
        createdAt
        updatedAt
      }
    }
  }
}

MR acceptance checklist

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

Related to #2256

Edited by Mayra Cabrera

Merge request reports