Skip to content

NPS Survey use cases: Add backend logic

Administrator requested to merge tr/nps-survey-backend into contractors/SG-5168

Created by: umpox

Description

Frontend PR: https://github.com/sourcegraph/sourcegraph/pull/34589

Implements the required backend changes for this UI: image

Notes:

  • The use cases are just simple strings, so we just store them as text[] (rather than referencing as IDs in the DB)
  • Store the other use case field in a different column, so we can query separately if needed
  • Added some more context as review comments below!

Example mutation:

mutation {
  submitSurvey(
    input: {email: "[email protected]", score: 10, useCases: [UNDERSTAND_NEW_CODE], otherUseCase: "Find and read documentation", additionalInformation: "Additional stuff"}
  ) {
    alwaysNil
  }
}

Example query:

query {
  surveyResponses {
    nodes {
      id
      createdAt
      email
      score
      useCases
      otherUseCase
      additionalInformation
    }
  }
}

Test plan

Tested locally through the API console. Both mutations and queries

Merge request reports

Loading