Skip to content

Commit

Permalink
Ensure correct types for DTCs are referenced in resolvers using tc.ge…
Browse files Browse the repository at this point in the history
…tTypeName()
  • Loading branch information
jhbuchanan45 committed May 25, 2021
1 parent e602693 commit d586798
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/resolvers/createOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function createOne<TSource = any, TContext = any, TDoc extends Document =
t.setFields({
...payloadRecordId(tc, opts?.recordId),
record: {
type: tc,
type: tc.getTypeName(),
description: 'Created document',
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/dataLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function dataLoader<TSource = any, TContext = any, TDoc extends Document
const aliasesReverse = prepareAliasesReverse(model.schema);

return tc.schemaComposer.createResolver<TSource, TArgs>({
type: tc,
type: tc.getTypeName(),
name: 'dataLoader',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/dataLoaderMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function dataLoaderMany<TSource = any, TContext = any, TDoc extends Docum
const aliasesReverse = prepareAliasesReverse(model.schema);

return tc.schemaComposer.createResolver<TSource, TArgs>({
type: tc.List.NonNull,
type: tc.schemaComposer.getAnyTC(tc.getTypeName()).List.NonNull,
name: 'dataLoaderMany',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/findByIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function findByIds<TSource = any, TContext = any, TDoc extends Document =
const aliasesReverse = prepareAliasesReverse(model.schema);

return tc.schemaComposer.createResolver<TSource, TArgs>({
type: tc.NonNull.List.NonNull,
type: tc.schemaComposer.getAnyTC(tc.getTypeName()).NonNull.List.NonNull,
name: 'findByIds',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/findOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function findOne<TSource = any, TContext = any, TDoc extends Document = a
const aliasesReverse = prepareAliasesReverse(model.schema);

return tc.schemaComposer.createResolver<TSource, TArgs>({
type: tc,
type: tc.getTypeName(),
name: 'findOne',
kind: 'query',
args: {
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/removeById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function removeById<TSource = any, TContext = any, TDoc extends Document
t.setFields({
...payloadRecordId(tc, opts?.recordId),
record: {
type: tc,
type: tc.getTypeName(),
description: 'Removed document',
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/removeOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function removeOne<TSource = any, TContext = any, TDoc extends Document =
t.setFields({
...payloadRecordId(tc, opts?.recordId),
record: {
type: tc,
type: tc.getTypeName(),
description: 'Removed document',
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/updateById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function updateById<TSource = any, TContext = any, TDoc extends Document
t.setFields({
...payloadRecordId(tc, opts?.recordId),
record: {
type: tc,
type: tc.getTypeName(),
description: 'Updated document',
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/updateOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function updateOne<TSource = any, TContext = any, TDoc extends Document =
t.setFields({
...payloadRecordId(tc, opts?.recordId),
record: {
type: tc,
type: tc.getTypeName(),
description: 'Updated document',
},
});
Expand Down

0 comments on commit d586798

Please sign in to comment.