This repository has been archived by the owner on Dec 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added global IDs for strength training items
- Loading branch information
Simon Wears
committed
Mar 25, 2017
1 parent
5f91364
commit 44b9fe5
Showing
6 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
strength_training_activities: 'STRENGTH' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const fromGlobalId = require('graphql-relay').fromGlobalId; | ||
const nodeDefinitions = require('graphql-relay').nodeDefinitions; | ||
|
||
const { nodeInterface, nodeField } = nodeDefinitions( | ||
(globalId, context) => { | ||
const { type, id } = fromGlobalId(globalId); | ||
return context.healthGraphLoader.load(id); | ||
}, | ||
object => { | ||
if (object.hasOwnProperty('exercises')) { | ||
return 'StrengthTrainingItem'; | ||
} | ||
} | ||
); | ||
|
||
module.exports = { nodeField, nodeInterface }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters