Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
fix(client): find query name
Browse files Browse the repository at this point in the history
  • Loading branch information
Arenukvern committed Mar 14, 2021
1 parent aa0bd33 commit 0f54510
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DocumentNode, print } from 'graphql'
import { Maybe } from '../abstract/BasicTypes'
import { toPluralName } from '../utils'

export enum DefaultGqlOperationType {
create = 'create',
Expand Down Expand Up @@ -56,6 +57,7 @@ export const getDefaultGqlOperations = <TModel = unknown>({
const returnFields = modelFragment
? gqlToFields(modelFragment)
: modelFields?.join('\n')
const pluralModelName = toPluralName(modelName)
const mutations: DefaultGqlOperations = {
create: `
mutation create${modelName}($input: Create${modelName}Input!) {
Expand All @@ -82,8 +84,8 @@ export const getDefaultGqlOperations = <TModel = unknown>({
}
}`,
find: `
query find${modelName}($filter: ${modelName}Filter, $page: PageRequest, $orderBy: OrderByInput) {
find${modelName}s(filter: $filter, page: $page, orderBy: $orderBy) {
query find${pluralModelName}($filter: ${modelName}Filter, $page: PageRequest, $orderBy: OrderByInput) {
find${pluralModelName}(filter: $filter, page: $page, orderBy: $orderBy) {
items{
${returnFields}
}
Expand Down

0 comments on commit 0f54510

Please sign in to comment.