<commit_before>import gravity from '../../lib/loaders/gravity';
import { CollectorProfileFields } from './collector_profile';
import {
  GraphQLBoolean,
  GraphQLString,
} from 'graphql';
import { mutationWithClientMutationId } from 'graphql-relay';

let UpdateCollectorProfile;

UpdateCollectorProfile = mutationWithClientMutationId({
  name: 'UpdateCollectorProfile',
  decription: 'Updating a collector profile (loyalty applicant status).',
  inputFields: {
    loyalty_applicant: {
      type: GraphQLBoolean,
    },
    professional_buyer: {
      type: GraphQLBoolean,
    },
    self_reported_purchases: {
      type: GraphQLString,
    },
  },
  outputFields: CollectorProfileFields,
  mutateAndGetPayload: ({
    loyalty_applicant,
    professional_buyer,
    self_reported_purchases,
  }, request, { rootValue: { accessToken } }) => {
    if (!accessToken) return null;
    return gravity.with(accessToken, {
      method: 'PUT',
    })('me/collector_profile', { loyalty_applicant, professional_buyer, self_reported_purchases });
  },
});

export default UpdateCollectorProfile;<commit_msg>Avoid using unnecessary intermediate variable<commit_after>import gravity from '../../lib/loaders/gravity';
import { CollectorProfileFields } from './collector_profile';
import {
  GraphQLBoolean,
  GraphQLString,
} from 'graphql';
import { mutationWithClientMutationId } from 'graphql-relay';

export default mutationWithClientMutationId({
  name: 'UpdateCollectorProfile',
  decription: 'Updating a collector profile (loyalty applicant status).',
  inputFields: {
    loyalty_applicant: {
      type: GraphQLBoolean,
    },
    professional_buyer: {
      type: GraphQLBoolean,
    },
    self_reported_purchases: {
      type: GraphQLString,
    },
  },
  outputFields: CollectorProfileFields,
  mutateAndGetPayload: ({
    loyalty_applicant,
    professional_buyer,
    self_reported_purchases,
  }, request, { rootValue: { accessToken } }) => {
    if (!accessToken) return null;
    return gravity.with(accessToken, {
      method: 'PUT',
    })('me/collector_profile', { loyalty_applicant, professional_buyer, self_reported_purchases });
  },
});
{'fraction_non_alphanumeric': 0.1119368323269856, 'fraction_numerical': 0.0, 'mean_word_length': 4.385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5921071', 'n_tokens_mistral': 666, 'n_tokens_neox': 644, 'n_words': 129}