Skip to content

Expose issue contacts via GraphQL

Lee Tickett requested to merge 2256-expose-issue-contacts-via-graphql into master

What does this MR do and why?

Exposes contacts against issues via GraphQL. This forms part of the ongoing effort to build a minimum viable solution for customer relations (crm).

Screenshots or screen recordings

image

How to set up and validate locally

1. Ensure feature flag is enabled: `Feature.enable(:customer_relations)`
2. Create a few contacts against an issue using the rails console (I used the most recent issue on the flight project in the flightjs group):
[1] pry(main)> p = Group.find(26).projects.first
=> #<Project id:6 flightjs/Flight>>
[2] pry(main)> i = p.issues.last
=> #<Issue id:136 flightjs/Flight#30>
[3] pry(main)> i.customer_relations_contacts.create(group_id: 26, first_name: "Dave", last_name: "Davies")
=> #<CustomerRelations::Contact:0x0000556af002ed50
[4] pry(main)> i.customer_relations_contacts.create(group_id: 26, first_name: "Steve", last_name: "Jones")
=> #<CustomerRelations::Contact:0x000055c2b035c758
[5] pry(main)> i.save
=> true
3. Query GraphQL for an issue or multiple issues and their contacts:
query {
  group(fullPath: "flightjs") {
    issues {
        nodes {
        id
        customerRelationsContacts {
          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 Peter Leitzen

Merge request reports