Skip to content

Commit

Permalink
[core] GraphQL: Don't pluralize type queries
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars authored and saasen committed Feb 27, 2020
1 parent 65309f9 commit 586dde9
Showing 1 changed file with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
const pluralize = require('pluralize')
const {startCase, upperFirst} = require('lodash')

function pluralizeTypeName(name) {
const words = startCase(name).split(' ')
const last = words[words.length - 1]
const plural = pluralize(last.toLowerCase())
words[words.length - 1] = upperFirst(plural)
return words.join('')
}
const {upperFirst} = require('lodash')

function generateTypeQueries(types, filters, sortings) {
const queries = []
Expand Down Expand Up @@ -43,7 +34,7 @@ function generateTypeQueries(types, filters, sortings) {
// Fetch all of type
queryable.forEach(type => {
queries.push({
fieldName: `all${pluralizeTypeName(type.name)}`,
fieldName: `all${upperFirst(type.name)}`,
filter: `_type == "${type.originalName || type.name}"`,
type: {
kind: 'List',
Expand Down

0 comments on commit 586dde9

Please sign in to comment.