Skip to content

Commit

Permalink
Merge pull request #17 from klerick/fix-id-field-name
Browse files Browse the repository at this point in the history
fix(json-api-nestjs): correct name for id field
  • Loading branch information
klerick authored Dec 15, 2022
2 parents 823b868 + b17dfc6 commit 69d84a9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,12 @@ export class TransformMixinService<T> {
},
};
}

const idNameField =
table === this.currentResourceName
? this.currentPrimaryField
: this.relationPrimaryField.get(table);
return {
id: data[this.currentPrimaryField].toString(),
id: data[idNameField].toString(),
type: urlTable,
attributes,
relationships,
Expand Down

0 comments on commit 69d84a9

Please sign in to comment.