Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Nov 11, 2024
1 parent 7c7ee44 commit 22d0fb9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class GraphqlQuerySelectedFieldsRelationParser {
this.objectMetadataMaps,
);

const relationFields = referencedObjectMetadata.fieldsById;
const relationFields = referencedObjectMetadata.fieldsByName;
const fieldParser = new GraphqlQuerySelectedFieldsParser(
this.objectMetadataMaps,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class GraphqlQuerySelectedFieldsParser {

parse(
graphqlSelectedFields: Partial<Record<string, any>>,
fieldMetadataMap: Record<string, FieldMetadataInterface>,
fieldMetadataMapByName: Record<string, FieldMetadataInterface>,
): { select: Record<string, any>; relations: Record<string, any> } {
const result: {
select: Record<string, any>;
Expand All @@ -46,14 +46,14 @@ export class GraphqlQuerySelectedFieldsParser {
}

if (this.isConnectionField(fieldKey, fieldValue)) {
const subResult = this.parse(fieldValue, fieldMetadataMap);
const subResult = this.parse(fieldValue, fieldMetadataMapByName);

Object.assign(result.select, subResult.select);
Object.assign(result.relations, subResult.relations);
continue;
}

const fieldMetadata = fieldMetadataMap[fieldKey];
const fieldMetadata = fieldMetadataMapByName[fieldKey];

if (!fieldMetadata) {
throw new GraphqlQueryRunnerException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class GraphqlQueryParser {
): { select: Record<string, any>; relations: Record<string, any> } {
const parentFields =
this.objectMetadataMaps.byNameSingular[parentObjectMetadata.nameSingular]
?.fieldsById;
?.fieldsByName;

if (!parentFields) {
throw new Error(
Expand Down

0 comments on commit 22d0fb9

Please sign in to comment.